Search in sources :

Example 16 with IEditorRegistry

use of org.eclipse.ui.IEditorRegistry in project jbosstools-openshift by jbosstools.

the class EditResourceHandler method openInEditor.

private void openInEditor(IWorkbenchWindow window, Connection connection, IResource resource) throws PartInitException {
    IStorageEditorInput input = new OpenShiftResourceInput(connection, resource);
    IWorkbenchPage page = window.getActivePage();
    if (page != null) {
        IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
        String defaultJsonEditorId = getDefaultJSONEditorDescriptorId(editorRegistry);
        page.openEditor(input, defaultJsonEditorId);
    }
}
Also used : IStorageEditorInput(org.eclipse.ui.IStorageEditorInput) OpenShiftResourceInput(org.jboss.tools.openshift.internal.ui.property.OpenShiftResourceInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorRegistry(org.eclipse.ui.IEditorRegistry)

Example 17 with IEditorRegistry

use of org.eclipse.ui.IEditorRegistry in project egit by eclipse.

the class EgitUiEditorUtils method getEditorId.

private static String getEditorId(String fileName, IContentType type) {
    IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
    IEditorDescriptor descriptor = registry.getDefaultEditor(fileName, type);
    String id;
    if (descriptor == null || descriptor.isOpenExternal()) {
        id = EditorsUI.DEFAULT_TEXT_EDITOR_ID;
    } else {
        id = descriptor.getId();
    }
    return id;
}
Also used : IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IEditorRegistry(org.eclipse.ui.IEditorRegistry)

Example 18 with IEditorRegistry

use of org.eclipse.ui.IEditorRegistry in project InformationSystem by ObeoNetwork.

the class BindingTreeEditor method getEditorDescriptor.

/**
 * Retrieves the descriptor for this editor.
 *
 * @return the editor descriptor
 */
protected final IEditorDescriptor getEditorDescriptor() {
    final IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
    final IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId());
    return editorDesc;
}
Also used : IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IEditorRegistry(org.eclipse.ui.IEditorRegistry)

Example 19 with IEditorRegistry

use of org.eclipse.ui.IEditorRegistry in project ecf by eclipse.

the class EditorHelper method getEditorIdForFile.

protected String getEditorIdForFile(IFile file) {
    final IWorkbench wb = getWorkbenchWindow().getWorkbench();
    final IEditorRegistry er = wb.getEditorRegistry();
    final IEditorDescriptor desc = er.getDefaultEditor(file.getName());
    if (desc != null)
        return desc.getId();
    else
        return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IEditorRegistry(org.eclipse.ui.IEditorRegistry)

Aggregations

IEditorRegistry (org.eclipse.ui.IEditorRegistry)19 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)18 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)7 IWorkbench (org.eclipse.ui.IWorkbench)7 IContentType (org.eclipse.core.runtime.content.IContentType)5 Image (org.eclipse.swt.graphics.Image)5 InputStream (java.io.InputStream)2 Path (org.eclipse.core.runtime.Path)2 Point (org.eclipse.swt.graphics.Point)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IStorageEditorInput (org.eclipse.ui.IStorageEditorInput)2 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 FileEditorInput (org.eclipse.ui.part.FileEditorInput)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URL (java.net.URL)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1