Ejemplo n.º 1
0
 /* (non-Javadoc)
  * Method declared on IAction.
  */
 public void run() {
   if (workbenchWindow == null) {
     // action has been disposed
     return;
   }
   boolean locked = isChecked();
   ((WorkbenchWindow) workbenchWindow).lockCoolBar(locked);
 }
  /**
   * Sets whether the CoolBar/PerspectiveBar should be visible.
   *
   * @param visible whether the CoolBar/PerspectiveBar should be visible
   * @since 3.1
   */
  private void setBarVisibility(final boolean visible) {
    WorkbenchWindow window = (WorkbenchWindow) getSite().getWorkbenchWindow();

    final boolean layout =
        (visible != window.getCoolBarVisible())
            || (visible
                != window
                    .getPerspectiveBarVisible()); // don't layout unless things have actually
                                                  // changed
    if (visible) {
      window.setCoolBarVisible(true);
      window.setPerspectiveBarVisible(true);
    } else {
      window.setCoolBarVisible(false);
      window.setPerspectiveBarVisible(false);
    }

    if (layout) {
      window.getShell().layout();
    }
  }
 /**
  * Constructor for ChangeToPerspectiveMenu.
  *
  * @param window the workbench window this action applies to.
  */
 public ChangeToPerspectiveMenu(IWorkbenchWindow window, String id) {
   super(window, id);
   // indicate that a open perspectives submenu has been created
   ((WorkbenchWindow) window).addSubmenu(WorkbenchWindow.OPEN_PERSPECTIVE_SUBMENU);
   showActive(true);
 }