Package org.eclipse.ui

Examples of org.eclipse.ui.IWorkbenchPartDescriptor


    return (T) data.get(key);
  }

  @Override
  public IWorkbenchPartDescriptor getPart() {
    IWorkbenchPartDescriptor part = viewRegistry().find(get(PART_ID));
    if (part == null) {
      return editorRegistry().findEditor(get(PART_ID));
    }
    return part;
  }
View Full Code Here


  }

  @Override
  public Image getImage(@Nullable Object element) {
    if (element instanceof IWorkbenchPartDescriptor) {
      IWorkbenchPartDescriptor part = (IWorkbenchPartDescriptor) element;
      if (images.containsKey(part.getId())) {
        return images.get(part.getId());
      }
      ImageDescriptor des = part.getImageDescriptor();
      Image img = (des != null) ? des.createImage() : null;
      images.put(part.getId(), img);
      return img;
    }
    return super.getImage(element);
  }
View Full Code Here

        is(duration));
  }
 
  @Test
  public void shouldReturnTheEditor() {
    IWorkbenchPartDescriptor editor = PlatformUI.getWorkbench()
        .getEditorRegistry().getDefaultEditor("a.txt");
    assertThat(
        create(date, workspace, duration, editor.getId()).getPart(),
        is(editor));
  }
View Full Code Here

        is(partId));
  }
 
  @Test
  public void shouldReturnTheView() {
    IWorkbenchPartDescriptor view = PlatformUI.getWorkbench()
        .getViewRegistry().getViews()[0];
    assertThat(
        create(date, workspace, duration, view.getId()).getPart(),
        is(view));
  }
View Full Code Here

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

    assertThat(toString(actual, expected), actual, equalTo(expected));
  }

  @Test
  public void shouldBuildAPathWithUndefinedWorkbenchPartId() {
    IWorkbenchPartDescriptor undefined =
        new UndefinedWorkbenchPartDescriptor("abc123");
    ICategory[] categories = {
        Category.DATE, Category.WORKSPACE, Category.WORKBENCH_TOOL};
    List<TreePath> expected = asList(newPath(date, ws, undefined, duration));

    IPartData data = mock(IPartData.class);
    given(data.get(IPartData.DATE)).willReturn(date);
    given(data.get(IPartData.DURATION)).willReturn(duration);
    given(data.get(IPartData.PART_ID)).willReturn(undefined.getId());
    given(data.get(IPartData.WORKSPACE)).willReturn(ws);

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

TOP

Related Classes of org.eclipse.ui.IWorkbenchPartDescriptor

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.