Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorDescriptor


      if (!file.exists())
        return;
     
      IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();     
      IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
      page.openEditor(new FileEditorInput(file), desc.getId());
     
    } catch (CoreException e) {
      Logger.logException(e);
    }   
View Full Code Here


    protected void openFile(IFile file)
    {
        if (file.exists()) {
            try {
                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
                page.openEditor(new FileEditorInput(file), desc.getId());
            } catch (PartInitException e) {
                Logger.logException(e);
            }
        }
    }
View Full Code Here

   
      if(editorInput==null) {
        editorInput = new FileEditorInput(file);
      }
     
        IEditorDescriptor editor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
       String editorId = editor==null ? "org.eclipse.ui.DefaultTextEditor" : editor.getId();
      try {
      activePage.openEditor(editorInput, editorId);
    } catch (PartInitException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
View Full Code Here

  }

  public static void openEditor(IFile file, String editorId) throws PartInitException {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    IEditorDescriptor defaultEditor = workbench.getEditorRegistry().getDefaultEditor(file.getFullPath().toString());
    page.openEditor(new FileEditorInput(file), defaultEditor == null
        ? editorId
        : defaultEditor.getId());
  }
View Full Code Here

  }

  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;
  }
View Full Code Here

  }
 
  private static IEditorPart openZipEntryStorage(int line, IFile file,
      ZipEntryStorage storage) throws PartInitException, CoreException {
    IEditorInput input = new ZipEntryEditorInput(storage);
    IEditorDescriptor desc = IDE.getEditorDescriptor(storage.getName());
    IEditorPart editor = SpringUIUtils.openInEditor(input, desc.getId());
    IMarker marker = file.createMarker(IMarker.TEXT);
    marker.setAttribute(IMarker.LINE_NUMBER, line);
    IDE.gotoMarker(editor, marker);
    return editor;
  }
View Full Code Here

    IFileEditorMapping[] mappings = registry.getFileEditorMappings();
    for (IFileEditorMapping mapping : mappings) {
      if (mapping.getExtension().equals("java")) {
        if (mapping instanceof FileEditorMapping) {
          IEditorDescriptor desc = registry.findEditor(AspectJEditor.ASPECTJ_EDITOR_ID);
          ((FileEditorMapping) mapping).setDefaultEditor((EditorDescriptor) desc);
        }
      }
    }
    registry.setFileEditorMappings((FileEditorMapping[]) mappings);
View Full Code Here

      return new IClasspathEntry[0];
    }
  }

  private boolean isAJEditorDefault() {
    IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(
        ".java",
        ContentTypeManager.getInstance().getContentType(JavaCore.JAVA_SOURCE_CONTENT_TYPE));
    return desc.getId().equals(AspectJEditor.ASPECTJ_EDITOR_ID);
  }
View Full Code Here

        else if (mapping.getExtension().equals("class"))
        {
          classPlain = mapping;
        }
      }
      IEditorDescriptor jdtClassViewer = registry.findEditor(JDT_EDITOR_ID);

      // * If there is a "class without source" type - handle this and revert
      // "class" to the default handler.
      // * Else register as the default handler for "class"

View Full Code Here

        List<IContributionItem> list = new ArrayList<IContributionItem>();
        if (classes.size() > 0)
        {
          // Add an action to open all selected classes
          IEditorDescriptor jdtClassViewer = registry
              .findEditor(Startup.JDT_EDITOR_ID);
          IEditorDescriptor jdRealignClassViewer = registry
              .findEditor(Startup.EDITOR_ID);
          list.add(new ActionContributionItem(new OpenClassesAction(jdtClassViewer.getLabel(),
              jdRealignClassViewer, classes)));
        }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.