本文整理汇总了Java中org.eclipse.xtext.ui.editor.XtextEditor.isDirty方法的典型用法代码示例。如果您正苦于以下问题:Java XtextEditor.isDirty方法的具体用法?Java XtextEditor.isDirty怎么用?Java XtextEditor.isDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.ui.editor.XtextEditor
的用法示例。
在下文中一共展示了XtextEditor.isDirty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: existsDirtyEditorFor
import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
/**
* Returns true iff for at least one of the given markers the corresponding editor is open and is dirty. Does not
* open any editors if they aren't open already.
*/
private boolean existsDirtyEditorFor(IMarker[] markers) {
// look for an editor containing one of the given markers that is already open and dirty
for (IMarker marker : markers) {
final XtextEditor editorForMarker = findEditor(marker.getResource()); // returns null if not open already
if (editorForMarker != null && editorForMarker.isDirty())
return true;
}
return false;
}
示例2: executeOnEditor
import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
@Override
protected Object executeOnEditor(ExecutionEvent event) {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
if (window == null) {
return null;
}
final XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
if (xtextEditor == null) {
return null;
}
FileEditorInput input = (FileEditorInput) xtextEditor.getEditorInput();
final java.io.File fileOnDisk = input.getFile().getLocation().toFile();
if (xtextEditor.isDirty()) {
if (MessageDialog.openConfirm(window.getShell(), "Save and Run JLustre2Excel",
"The file " + input.getName() + " has unsaved changes. Save file and continue?")) {
xtextEditor.doSave(null);
} else {
return null;
}
}
WorkspaceJob job = new WorkspaceJob("JLustre2Excel") {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) {
if (hasErrors(xtextEditor)) {
return errorStatus("Lustre file contains errors");
}
if (hasFunctions(xtextEditor)) {
return errorStatus("Functions are not support in JLustre2Excel");
}
return runJob(fileOnDisk);
}
};
job.schedule();
return null;
}
示例3: executeOnEditor
import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
@Override
protected Object executeOnEditor(ExecutionEvent event) {
window = HandlerUtil.getActiveWorkbenchWindow(event);
if (window == null) {
return null;
}
final XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
if (xtextEditor == null) {
return null;
}
FileEditorInput input = (FileEditorInput) xtextEditor.getEditorInput();
final java.io.File fileOnDisk = input.getFile().getLocation().toFile();
if (xtextEditor.isDirty()) {
if (MessageDialog.openConfirm(window.getShell(), "Save and Run JKind", "The file "
+ input.getName() + " has unsaved changes. Save file and continue?")) {
xtextEditor.doSave(null);
} else {
return null;
}
}
WorkspaceJob job = new WorkspaceJob("JKind Analysis") {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) {
activateTerminateHandler(monitor, this);
JKindResult result = initializeJKindResult(xtextEditor);
if (result == null) {
return errorStatus("Lustre file contains errors");
}
return runJob(fileOnDisk, result, monitor);
}
};
job.schedule();
return null;
}
示例4: executeOnEditor
import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
@Override
protected Object executeOnEditor(ExecutionEvent event) {
window = HandlerUtil.getActiveWorkbenchWindow(event);
if (window == null) {
return null;
}
final XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
if (xtextEditor == null) {
return null;
}
FileEditorInput input = (FileEditorInput) xtextEditor.getEditorInput();
final java.io.File fileOnDisk = input.getFile().getLocation().toFile();
if (xtextEditor.isDirty()) {
if (MessageDialog
.openConfirm(window.getShell(), "Save and Run JRealizability", "The file "
+ input.getName() + " has unsaved changes. Save file and continue?")) {
xtextEditor.doSave(null);
} else {
return null;
}
}
WorkspaceJob job = new WorkspaceJob("JKind Analysis") {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) {
activateTerminateHandler(monitor, this);
if (!hasQuery(xtextEditor)) {
return errorStatus("Main node does not contain realizability query");
}
JRealizabilityResult result = initializeJRealizabilityResult(xtextEditor);
if (result == null) {
return errorStatus("Lustre file contains errors");
}
return runJob(fileOnDisk, result, monitor);
}
};
job.schedule();
return null;
}