本文整理汇总了Java中org.eclipse.ui.IEditorPart.isDirty方法的典型用法代码示例。如果您正苦于以下问题:Java IEditorPart.isDirty方法的具体用法?Java IEditorPart.isDirty怎么用?Java IEditorPart.isDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.IEditorPart
的用法示例。
在下文中一共展示了IEditorPart.isDirty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}