本文整理汇总了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);
});
}
示例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);
}
}
}
示例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());
}
}
示例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());
}
}
}
示例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;
}
示例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;
}