Package org.eclipse.ui

Examples of org.eclipse.ui.IPerspectiveDescriptor


        } else {
          inputSame = input.equals(page.getInput());
        }
        if (inputSame) {
          inputSameAsWindow = true;
          IPerspectiveDescriptor perspectives[] = page
              .getOpenPerspectives();
          for (int i = 0; i < perspectives.length; i++) {
            IPerspectiveDescriptor persp = perspectives[i];
            if (perspectiveId.equals(persp.getId())) {
              win.makeVisible();
              page.setPerspective(persp);
              return page;
            }
          }
        }
      }
    }

    // If another window has the requested input and the requested
    // perpective open and active, then that window is given focus.
    IWorkbenchWindow[] windows = getWorkbenchWindows();
    for (int i = 0; i < windows.length; i++) {
      win = (WorkbenchWindow) windows[i];
      if (window != win) {
        WorkbenchPage page = win.getActiveWorkbenchPage();
        if (page != null) {
          boolean inputSame = false;
          if (input == null) {
            inputSame = (page.getInput() == null);
          } else {
            inputSame = input.equals(page.getInput());
          }
          if (inputSame) {
            Perspective persp = page.getActivePerspective();
            if (persp != null) {
              IPerspectiveDescriptor desc = persp.getDesc();
              if (desc != null) {
                if (perspectiveId.equals(desc.getId())) {
                  win.getShell().open();
                  return page;
                }
              }
            }
          }
        }
      }
    }

    // If the specified window has the same requested input but not the
    // requested
    // perspective, then the window is given focus and the perspective is
    // opened and shown
    // on condition that the user preference is not to open perspectives in
    // a new window.
    win = (WorkbenchWindow) window;
    if (inputSameAsWindow && win != null) {
      IPreferenceStore store = WorkbenchPlugin.getDefault()
          .getPreferenceStore();
      int mode = store.getInt(IPreferenceConstants.OPEN_PERSP_MODE);

      if (IPreferenceConstants.OPM_NEW_WINDOW != mode) {
        IWorkbenchPage page = win.getActiveWorkbenchPage();
        IPerspectiveDescriptor desc = getPerspectiveRegistry()
            .findPerspectiveWithId(perspectiveId);
        if (desc == null) {
          throw new WorkbenchException(
              NLS
                  .bind(
                      WorkbenchMessages.WorkbenchPage_ErrorCreatingPerspective,
                      perspectiveId));
        }
        win.getShell().open();
        if (page == null) {
          page = win.openPage(perspectiveId, input);
        } else {
          page.setPerspective(desc);
        }
        return page;
      }
    }

    // If the specified window has no active perspective, then open the
    // requested perspective and show the specified window.
    if (win != null) {
      IWorkbenchPage page = win.getActiveWorkbenchPage();
      IPerspectiveDescriptor persp = null;
      if (page != null) {
        persp = page.getPerspective();
      }
      if (persp == null) {
        IPerspectiveDescriptor desc = getPerspectiveRegistry()
            .findPerspectiveWithId(perspectiveId);
        if (desc == null) {
          throw new WorkbenchException(
              NLS
                  .bind(
View Full Code Here


    }
   
    String newDefault = PrefUtil.getAPIPreferenceStore().getDefaultString(
                IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
   
    IPerspectiveDescriptor desc = null;
        if (newDefault != null) {
      desc = workbench.getPerspectiveRegistry().findPerspectiveWithId(newDefault);
    }
        if (desc == null) {
          newDefault = workbench.getPerspectiveRegistry().getDefaultPerspective();
View Full Code Here

            images = new Image[2];
            if (editorRef != null) {
                images[0] = editorRef.getTitleImage();
                WorkbenchPage p = ((WorkbenchPartReference) editorRef)
                        .getPane().getPage();
                IPerspectiveDescriptor persp = p.getPerspective();
                ImageDescriptor image = persp.getImageDescriptor();
                if (image == null) {
          image = WorkbenchImages
                            .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_DEF_PERSPECTIVE);
        }
            } else {
View Full Code Here

                .getShell(), workbenchWindow.getWorkbench().getPerspectiveRegistry());
        dlg.open();
        if (dlg.getReturnCode() == Window.CANCEL) {
      return;
    }
        IPerspectiveDescriptor desc = dlg.getSelection();
        if (desc != null) {
            try {
              IWorkbench workbench = workbenchWindow.getWorkbench();
        IAdaptable input = ((Workbench) workbench)
            .getDefaultPageInput();
        workbenchWindow.openPage(desc.getId(), input);
            } catch (WorkbenchException e) {
                WorkbenchPlugin.log("Error opening perspective ", e); //$NON-NLS-1$
            }
        }
    }
View Full Code Here

            if (page == null) {
                continue;
            }
            IPerspectiveDescriptor[] perspDescs = page.getOpenPerspectives();
            for (int j = 0; j < perspDescs.length; j++) {
                IPerspectiveDescriptor descriptor = perspDescs[j];
                IViewReference reference = page.findPerspective(descriptor)
                        .findView(IIntroConstants.INTRO_VIEW_ID);
                if (reference != null) {
                    IViewPart part = reference.getView(false);
                    if (part != null && part instanceof ViewIntroAdapterPart) {
View Full Code Here

            if ( activeEditor != null )
            {
                lastEditorTitle = activeEditor.getTitleToolTip();
                title = NLS.bind( "{0} - {1}", lastEditorTitle, title ); //$NON-NLS-1$
            }
            IPerspectiveDescriptor persp = currentPage.getPerspective();
            String label = ""; //$NON-NLS-1$
            if ( persp != null )
            {
                label = persp.getLabel();
            }
            IAdaptable input = currentPage.getInput();
            if ( input != null )
            {
                label = currentPage.getLabel();
View Full Code Here

    {
        IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
        IWorkbenchWindow window = configurer.getWindow();
        IEditorPart activeEditor = null;
        IWorkbenchPage currentPage = window.getActivePage();
        IPerspectiveDescriptor persp = null;
        IAdaptable input = null;

        if ( currentPage != null )
        {
            activeEditor = currentPage.getActiveEditor();
View Full Code Here

        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

        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

        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

TOP

Related Classes of org.eclipse.ui.IPerspectiveDescriptor

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.