Examples of IEditorDescriptor


Examples of org.eclipse.ui.IEditorDescriptor

    if (element instanceof Object[]) {
      return PlatformUI.getWorkbench().getSharedImages().getImage(
          ISharedImages.IMG_OBJ_FOLDER);

    } else if (element instanceof IEditorDescriptor) {
      IEditorDescriptor editor = (IEditorDescriptor) element;
      String id = editor.getId();
      Image img = images.get(id);
      if (img == null) {
        img = editor.getImageDescriptor().createImage();
        images.put(id, img);
      }
      return img;
    }
    return null;
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

        .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

Examples of org.eclipse.ui.IEditorDescriptor

  }

  @Override
  protected String getMessage(Object treeNode) {
    if (treeNode instanceof IEditorDescriptor) {
      IEditorDescriptor editor = (IEditorDescriptor) treeNode;
      StringBuilder builder = new StringBuilder();
      builder.append(editor.getLabel());
      builder.append("\n");
      builder.append(editor.getId());
      return builder.toString();
    }
    return super.getMessage(treeNode);
  }
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

  }
 
  @Override
  protected boolean isLeafMatch(Viewer viewer, Object element) {
    if (element instanceof IEditorDescriptor) {
      IEditorDescriptor edit = (IEditorDescriptor) element;
      return (wordMatches(edit.getLabel()) || wordMatches(edit.getId()));
    }
    return false;
  }
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    page.closeAllEditors(false);

    IFile file = (IFile) unit.getResource();
    IEditorDescriptor editor = workbench.getEditorRegistry().getDefaultEditor(
        file.getName());
    IEditorInput input = new FileEditorInput(file);
    return (JavaEditor) page.openEditor(input, editor.getId());
  }
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

  @Override
  public void shouldCorrectlyBuildMultiplePaths() {
    WorkspaceStorage ws2 = new WorkspaceStorage(new Path(".b"), null);
    LocalDate date2 = date.minusDays(2);
    Duration duration2 = duration.withMillis(10000);
    IEditorDescriptor editor = PlatformUI.getWorkbench().getEditorRegistry()
        .getDefaultEditor("1.txt");

    ICategory[] categories = {Category.WORKSPACE, Category.WORKBENCH_TOOL};
    List<TreePath> expected = asList(
        newPath(ws, view, duration),
        newPath(ws2, editor, duration2));

    IPartData data2 = mock(IPartData.class);
    given(data2.get(IPartData.DATE)).willReturn(date2);
    given(data2.get(IPartData.DURATION)).willReturn(duration2);
    given(data2.get(IPartData.PART_ID)).willReturn(editor.getId());
    given(data2.get(IPartData.WORKSPACE)).willReturn(ws2);

    ICategoryProvider provider = mock(ICategoryProvider.class);
    given(provider.getSelected()).willReturn(asList(categories));
    ITreePathBuilder builder = create(provider);
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

        }

        // 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$
                { file.getName() } );
            MessageDialog.openWarning( workbenchWindow.getShell(), Messages
                .getString( "OpenFileAction.Warning_message" ), msg ); //$NON-NLS-1$
            return;
        }

        // create IEdiorInput
        IPath location = new Path( file.getAbsolutePath() );
        ImageDescriptor imageDescriptor = descriptor.getImageDescriptor();
        IPathEditorInput input = new PathEditorInput( location, imageDescriptor );

        // activate editor
        IWorkbenchPage page = workbenchWindow.getActivePage();
        String editorId = descriptor.getId();
        try
        {
            page.openEditor( input, editorId );
        }
        catch ( PartInitException e )
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

    }
  }
 
  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

Examples of org.eclipse.ui.IEditorDescriptor

    /* (non-Javadoc)
     * Method declared on IFileEditorMapping.
     */
    public ImageDescriptor getImageDescriptor() {
        IEditorDescriptor editor = getDefaultEditor();
        if (editor == null) {
            return WorkbenchImages
                    .getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
        }
        return editor.getImageDescriptor();  
    }
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

  public String getExtension() {
    return extension;
  }

  public ImageDescriptor getImageDescriptor() {
    IEditorDescriptor editor = getDefaultEditor();
    if (editor == null) {
      return WorkbenchImages
          .getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
    }

    return editor.getImageDescriptor();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.