Search in sources :

Example 1 with XtextEditorInfo

use of org.eclipse.xtext.ui.editor.XtextEditorInfo in project xtext-eclipse by eclipse.

the class OriginalEditorSelector method getXtextEditor.

protected IEditorDescriptor getXtextEditor(URI uri) {
    IResourceServiceProvider serviceProvider = resourceServiceProviderRegistry.getResourceServiceProvider(uri);
    if (serviceProvider != null) {
        XtextEditorInfo editorInfo = serviceProvider.get(XtextEditorInfo.class);
        if (editorInfo != null) {
            IEditorRegistry editorRegistry = workbench.getEditorRegistry();
            IEditorDescriptor result = editorRegistry.findEditor(editorInfo.getEditorId());
            // null is ok
            return result;
        }
    }
    return null;
}
Also used : IResourceServiceProvider(org.eclipse.xtext.resource.IResourceServiceProvider) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) XtextEditorInfo(org.eclipse.xtext.ui.editor.XtextEditorInfo) IEditorRegistry(org.eclipse.ui.IEditorRegistry)

Aggregations

IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)1 IEditorRegistry (org.eclipse.ui.IEditorRegistry)1 IResourceServiceProvider (org.eclipse.xtext.resource.IResourceServiceProvider)1 XtextEditorInfo (org.eclipse.xtext.ui.editor.XtextEditorInfo)1