当前位置: 首页>>代码示例>>Java>>正文


Java XtextEditor.isDirty方法代码示例

本文整理汇总了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;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:N4JSMarkerResolutionGenerator.java

示例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;
}
 
开发者ID:agacek,项目名称:jkind-xtext,代码行数:41,代码来源:RunJLustre2ExcelHandler.java

示例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;
}
 
开发者ID:agacek,项目名称:jkind-xtext,代码行数:40,代码来源:RunJKindHandler.java

示例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;
}
 
开发者ID:agacek,项目名称:jkind-xtext,代码行数:44,代码来源:RunJRealizabilityHandler.java


注:本文中的org.eclipse.xtext.ui.editor.XtextEditor.isDirty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。