Examples of IPerspectiveDescriptor


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