當前位置: 首頁>>代碼示例>>Java>>正文


Java IEditorPart.doSave方法代碼示例

本文整理匯總了Java中org.eclipse.ui.IEditorPart.doSave方法的典型用法代碼示例。如果您正苦於以下問題:Java IEditorPart.doSave方法的具體用法?Java IEditorPart.doSave怎麽用?Java IEditorPart.doSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.IEditorPart的用法示例。


在下文中一共展示了IEditorPart.doSave方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doSave

import org.eclipse.ui.IEditorPart; //導入方法依賴的package包/類
@Override
public void doSave(final IProgressMonitor monitor) {
  final IEditorPart editor = this.getActiveEditor();
  if (editor instanceof KodKodEditor) {
    editor.doSave(monitor);
  } else {
    // do nothing
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:10,代碼來源:RelationModelEditor.java

示例2: doSave

import org.eclipse.ui.IEditorPart; //導入方法依賴的package包/類
@Override
public void doSave(final IProgressMonitor monitor) {
  final IEditorPart editor = this.getActiveEditor();
  if (editor instanceof Editor) {
    editor.doSave(monitor);
  } else {
    // do nothing
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:10,代碼來源:MetaModelEditor.java

示例3: execute

import org.eclipse.ui.IEditorPart; //導入方法依賴的package包/類
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final String filePath = getFilePath();
  if (filePath == null) {
    return null;
  }

  final IEditorPart editor = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
      .getActivePage().getActiveEditor();;

  if (editor == null) {
    return null;
  }

  if (editor.isDirty()) {
    final IFile file = ResourceUtil.getFile(editor.getEditorInput());
    final MessageDialog warningdialog =
        new MessageDialog(MarkerActivator.getShell(), "Save Specification", null,
            file.getName()
                + " has been modified. You must save file for update the specification. Do you want to save now?",
            MessageDialog.WARNING, new String[] {"Yes", "No"}, 0);
    if (warningdialog.open() != 0) {
      return null;
    }

    AlloyOtherSolutionReasoning.getInstance().finish();
    editor.doSave(new NullProgressMonitor());
  }

  final String content = getContent(filePath);
  if (content == null) {
    return null;
  }

  AlloyUtilities.updateSpec(filePath, content);

  try {
    TraceManager.get().loadSpec(filePath);
  } catch (final TraceException e) {
    e.printStackTrace();
  }

  final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Status Information",
      null, "Specification has been updated.", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
  dialog.open();

  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:49,代碼來源:UpdateSpecificationHandler.java


注:本文中的org.eclipse.ui.IEditorPart.doSave方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。