Examples of IPerspectiveDescriptor


Examples of org.eclipse.ui.IPerspectiveDescriptor

      public void run() {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();

        IPerspectiveRegistry reg = workbench.getPerspectiveRegistry();
        IPerspectiveDescriptor rtPerspectiveDesc =(IPerspectiveDescriptor) reg.findPerspectiveWithId(perspectiveId);

        if (activeWindow!= null){
          IWorkbenchPage page = activeWindow.getActivePage();
          page.setPerspective(rtPerspectiveDesc);
        }
View Full Code Here

Examples of org.eclipse.ui.IPerspectiveDescriptor

            ConnectionCorePlugin.getDefault().getConnectionFolderManager().getRootConnectionFolder().addConnectionId(
                connection.getId() );

            // Getting the window, LDAP perspective and current perspective
            IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            IPerspectiveDescriptor ldapPerspective = getLdapPerspective();
            IPerspectiveDescriptor currentPerspective = window.getActivePage().getPerspective();

            // Checking if we are already in the LDAP perspective
            if ( ( ldapPerspective != null ) && ( ldapPerspective.equals( currentPerspective ) ) )
            {
                // As we're already in the LDAP perspective, we only indicate to the user
View Full Code Here

Examples of org.eclipse.ui.IPerspectiveDescriptor

  }

  @Override
  public Image getImage(Object element) {
    if (element instanceof IPerspectiveDescriptor) {
      IPerspectiveDescriptor p = (IPerspectiveDescriptor) element;
      Image img = images.get(p.getId());
      if (img == null) {
        img = p.getImageDescriptor().createImage();
        images.put(p.getId(), img);
      }
      return img;
    }
    return super.getImage(element);
  }
View Full Code Here

Examples of org.eclipse.ui.IPerspectiveDescriptor

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

Examples of org.eclipse.ui.IPerspectiveDescriptor

        is(duration));
  }
 
  @Test
  public void shouldReturnThePerspective() {
    IPerspectiveDescriptor pp = PlatformUI.getWorkbench()
        .getPerspectiveRegistry().getPerspectives()[0];
    assertThat(
        create(date, workspace, duration, pp.getId()).getPerspective(),
        is(pp));
  }
View Full Code Here

Examples of org.eclipse.ui.IPerspectiveDescriptor

   * Checks the conditions and starts recording if OK.
   *
   * @param activeWin The current active window.
   */
  private void checkStart(@Nullable IWorkbenchWindow activeWin) {
    IPerspectiveDescriptor p = WorkbenchUtil.getPerspective(activeWin);
    if (p != null) {
      recorder.start(p);
    }
  }
View Full Code Here

Examples of org.eclipse.ui.IPerspectiveDescriptor

        case DATE:
          segments.add(data.get(IPerspectiveData.DATE));
          break;
        case PERSPECTIVE:
          String id = data.get(IPerspectiveData.PERSPECTIVE_ID);
          IPerspectiveDescriptor p = registry.findPerspectiveWithId(id);
          if (p == null) {
            p = new UndefinedPerspectiveDescriptor(id);
          }
          segments.add(p);
          break;
View Full Code Here

Examples of org.eclipse.ui.IPerspectiveDescriptor

        perspective.getId());
  }

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

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

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

Examples of org.eclipse.ui.IPerspectiveDescriptor

  @Override
  public void shouldCorrectlyBuildMultiplePaths() {
    WorkspaceStorage ws2 = new WorkspaceStorage(new Path(".b"), null);
    LocalDate date2 = date.minusDays(2);
    Duration duration2 = duration.withMillis(10000);
    IPerspectiveDescriptor p2 = PlatformUI.getWorkbench()
        .getPerspectiveRegistry().getPerspectives()[1];

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

    IPerspectiveData data2 = mock(IPerspectiveData.class);
    given(data2.get(IPerspectiveData.DATE)).willReturn(date2);
    given(data2.get(IPerspectiveData.DURATION)).willReturn(duration2);
    given(data2.get(IPerspectiveData.WORKSPACE)).willReturn(ws2);
    given(data2.get(IPerspectiveData.PERSPECTIVE_ID)).willReturn(p2.getId());

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

Examples of org.eclipse.ui.IPerspectiveDescriptor

   
    private static class PerspectiveSelectionAction extends SelectionAdapter {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IPerspectiveDescriptor perspectiveDescriptor = (IPerspectiveDescriptor) e.widget
                    .getData(KEY_PERSPECTIVE);

            ICommandService commandService = (ICommandService) PlatformUI.getWorkbench()
                    .getService(ICommandService.class);

            Command command = commandService.getCommand("org.eclipse.ui.perspectives.showPerspective");


            Map parameters = new HashMap();
            parameters.put("org.eclipse.ui.perspectives.showPerspective.perspectiveId", perspectiveDescriptor.getId());
            ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, parameters);

            IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
                    .getService(IHandlerService.class);
            try {
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.