Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorRegistry


            return;
        }

        // get editor for this file
        IWorkbench workbench = workbenchWindow.getWorkbench();
        IEditorRegistry editorRegistry = workbench.getEditorRegistry();
        IEditorDescriptor descriptor = editorRegistry.getDefaultEditor( file.getName() );

        if ( descriptor == null )
        {
            String msg = MessageFormat.format(
                Messages.getString( "OpenFileAction.No_appropriate_editor_found_for_x" ), new Object[] //$NON-NLS-1$
View Full Code Here


              Display.getDefault().asyncExec(new Runnable() {
                public void run() {
                  try {
                    IContentType contentType = iFile.getContentDescription().getContentType();
                    IEditorRegistry editorRegistry = workbench.getEditorRegistry();
                    String fileName = iFile.getName();
                    IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(fileName, contentType);
                    String editorId;
                    if (descriptor != null) {
                      editorId = descriptor.getId();
                    }
                    else {
                      descriptor = editorRegistry.getDefaultEditor(fileName + ".txt"); //$NON-NLS-1$
                      editorId = descriptor.getId();
                    }
                   
                    if (editorId != null)
                    {
View Full Code Here

  }

  @Override
  protected Object getInput() {
    Set<IEditorDescriptor> editors = new HashSet<IEditorDescriptor>();
    IEditorRegistry registry = PlatformUI.getWorkbench()
        .getEditorRegistry();
   
    for (IConfigurationElement e : Platform.getExtensionRegistry()
        .getConfigurationElementsFor("org.eclipse.ui.editors")) {
     
      IEditorDescriptor edit = registry.findEditor(e.getAttribute("id"));
      if (edit != null) {
        editors.add(edit);
      }
    }
    return editors;
View Full Code Here

      return emptyList();
    }

    IWorkbench workbench = PlatformUI.getWorkbench();
    IViewRegistry viewRegistry = workbench.getViewRegistry();
    IEditorRegistry editorRegistry = workbench.getEditorRegistry();

    List<TreePath> result = newArrayList();
    for (IPartData data : dataCol) {

      List<Object> segments = newArrayList();
      for (ICategory c : provider.getSelected()) {
        if (!(c instanceof Category)) {
          continue;
        }

        switch ((Category) c) {
        case WORKSPACE:
          segments.add(data.get(IPartData.WORKSPACE));
          break;
        case DATE:
          segments.add(data.get(IPartData.DATE));
          break;
        case WORKBENCH_TOOL:
          String id = data.get(IPartData.PART_ID);
          IWorkbenchPartDescriptor part = viewRegistry.find(id);
          if (part == null) {
            part = editorRegistry.findEditor(id);
          }
          if (part == null) {
            part = new UndefinedWorkbenchPartDescriptor(id);
          }
          segments.add(part);
View Full Code Here

            return;
        }

        // get editor for this file
        IWorkbench workbench = workbenchWindow.getWorkbench();
        IEditorRegistry editorRegistry = workbench.getEditorRegistry();
        IEditorDescriptor descriptor = editorRegistry.getDefaultEditor( file.getName() );

        if ( descriptor == null )
        {
            String msg = MessageFormat.format(
                Messages.getString( "OpenFileAction.No_appropriate_editor_found_for_x" ), new Object[] //$NON-NLS-1$
View Full Code Here

      }
    }
  }
 
  private String getEditorId(File file) {
    IEditorRegistry editorRegistry= workbench.getEditorRegistry();
    IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(file.getName());
    return descriptor == null ? null : descriptor.getId();
  }
View Full Code Here

      boolean setVisible, IMemento editorState) throws PartInitException {
    if (editorId == null || input == null) {
      throw new IllegalArgumentException();
    }

    IEditorRegistry reg = getEditorRegistry();
    EditorDescriptor desc = (EditorDescriptor) reg.findEditor(editorId);
    if (desc == null) {
      throw new PartInitException(NLS.bind(
          WorkbenchMessages.EditorManager_unknownEditorIDMessage,
          editorId));
    }
View Full Code Here

    // find all descriptors
    EditorDescriptor[] descArray = new EditorDescriptor[editorArray.length];
    IEditorReference refArray[] = new IEditorReference[editorArray.length];
    IEditorPart partArray[] = new IEditorPart[editorArray.length];

    IEditorRegistry reg = getEditorRegistry();
    for (int i = 0; i < editorArray.length; i++) {
      EditorDescriptor innerDesc = (EditorDescriptor) reg
          .findEditor(editorArray[i]);
      if (innerDesc == null) {
        throw new PartInitException(NLS.bind(
            WorkbenchMessages.EditorManager_unknownEditorIDMessage,
            editorArray[i]));
View Full Code Here

                ImageDescriptor image = null;
                if (desc != null) {
          image = desc.getImageDescriptor();
        }
                if (image == null) {
                    IEditorRegistry registry = WorkbenchPlugin.getDefault()
                            .getEditorRegistry();
                    image = registry.getImageDescriptor(input.getName());
          //TODO: how can this honour content types?  Guessing at the content type perhaps?
         
                    if (image == null) {
                        // @issue what should be the default image?
                        // image = registry.getDefaultEditor().getImageDescriptor();
View Full Code Here

        return null;
    }

    private static String getEditorId(File file) {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IEditorRegistry editorRegistry = workbench.getEditorRegistry();
        IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(file.getName(), getContentType(file));
        if (descriptor != null) {
            return descriptor.getId();
        }
        return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorRegistry

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.