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


Java XtextEditor.getResource方法代码示例

本文整理汇总了Java中org.eclipse.xtext.ui.editor.XtextEditor.getResource方法的典型用法代码示例。如果您正苦于以下问题:Java XtextEditor.getResource方法的具体用法?Java XtextEditor.getResource怎么用?Java XtextEditor.getResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.ui.editor.XtextEditor的用法示例。


在下文中一共展示了XtextEditor.getResource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newValidationJob

import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
private ValidationJob newValidationJob(final XtextEditor editor) {

		final IXtextDocument document = editor.getDocument();
		final IAnnotationModel annotationModel = editor.getInternalSourceViewer().getAnnotationModel();

		final IssueResolutionProvider issueResolutionProvider = getService(editor, IssueResolutionProvider.class);
		final MarkerTypeProvider markerTypeProvider = getService(editor, MarkerTypeProvider.class);
		final MarkerCreator markerCreator = getService(editor, MarkerCreator.class);

		final IValidationIssueProcessor issueProcessor = new CompositeValidationIssueProcessor(
				new AnnotationIssueProcessor(document, annotationModel, issueResolutionProvider),
				new MarkerIssueProcessor(editor.getResource(), markerCreator, markerTypeProvider));

		return editor.getDocument().modify(resource -> {
			final IResourceServiceProvider serviceProvider = resource.getResourceServiceProvider();
			final IResourceValidator resourceValidator = serviceProvider.getResourceValidator();
			return new ValidationJob(resourceValidator, editor.getDocument(), issueProcessor, ALL);
		});
	}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:OwnResourceValidatorAwareValidatingEditorCallback.java

示例2: organizeImportsInEditor

import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
/** Organize provided editor. */
public static void organizeImportsInEditor(XtextEditor editor, final Interaction interaction) {
	try {
		IResource resource = editor.getResource();
		DocumentImportsOrganizer imortsOrganizer = getOrganizeImports(resource);
		imortsOrganizer.organizeDocument(editor.getDocument(), interaction);
	} catch (RuntimeException re) {
		if (re.getCause() instanceof BreakException) {
			LOGGER.debug("user canceled");
		} else {
			LOGGER.warn("Unrecognized RT-exception", re);
		}

	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:16,代码来源:OrganizeImportsService.java

示例3: afterCreatePartControl

import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
@Override
public void afterCreatePartControl(XtextEditor editor) {
	IResource resource = editor.getResource();
	if (resource != null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible()
			&& !resource.getProject().isHidden()) {
		toggleNature.toggleNature(resource.getProject());
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:9,代码来源:AlwaysAddNatureCallback.java

示例4: handleNatureAdding

import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
private void handleNatureAdding(XtextEditor editor) {
	IResource resource = editor.getResource();
	if (resource!=null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible() && !resource.getProject().isHidden()) {
		String title = Messages.NatureAddingEditorCallback_MessageDialog_Title;
		String message = Messages.NatureAddingEditorCallback_MessageDialog_Msg0 + resource.getProject().getName() + Messages.NatureAddingEditorCallback_MessageDialog_Msg1;
		MessageDialog dialog = new MessageDialog(editor.getEditorSite().getShell(), title, null, message, MessageDialog.QUESTION, 
				new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
		int open = dialog.open();
		if (open==0) {
			toggleNature.toggleNature(resource.getProject());
		}
	}
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:14,代码来源:SadlEditorCallback.java

示例5: getEditorProject

import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
private IPath getEditorProject(XtextEditor editor) {
	IPath prjLoc = null;
	if (editor.getResource() != null) {
		prjLoc = editor.getResource().getProject().getLocation();
	} else {
		System.out.println("getIndicatorFile called with an editor with a null resource. Please report.");
	}
	return prjLoc;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:10,代码来源:SadlEditorCallback.java

示例6: newValidationJob

import org.eclipse.xtext.ui.editor.XtextEditor; //导入方法依赖的package包/类
private ValidationJob newValidationJob(XtextEditor editor) {
	MarkerIssueProcessor markerIssueProcessor = new MarkerIssueProcessor(editor.getResource(), markerCreator, markerTypeProvider);
	ValidationJob validationJob = new ValidationJob(resourceValidator, editor.getDocument(), markerIssueProcessor, CheckMode.NORMAL_AND_FAST);
	return validationJob;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:6,代码来源:ValidatingEditorCallback.java


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