Package org.eclipse.ui.internal.registry

Examples of org.eclipse.ui.internal.registry.IActionSetDescriptor


        service.activateContext(ContextAuthority.DEFER_EVENTS);
        if (newPersp != null) {
          IActionSetDescriptor[] newAlwaysOn = newPersp
              .getAlwaysOnActionSets();
          for (int i = 0; i < newAlwaysOn.length; i++) {
            IActionSetDescriptor descriptor = newAlwaysOn[i];

            actionSets.showAction(descriptor);
          }

          IActionSetDescriptor[] newAlwaysOff = newPersp
              .getAlwaysOffActionSets();
          for (int i = 0; i < newAlwaysOff.length; i++) {
            IActionSetDescriptor descriptor = newAlwaysOff[i];

            actionSets.maskAction(descriptor);
          }
        }

        if (oldPersp != null) {
          IActionSetDescriptor[] newAlwaysOn = oldPersp
              .getAlwaysOnActionSets();
          for (int i = 0; i < newAlwaysOn.length; i++) {
            IActionSetDescriptor descriptor = newAlwaysOn[i];

            actionSets.hideAction(descriptor);
          }

          IActionSetDescriptor[] newAlwaysOff = oldPersp
              .getAlwaysOffActionSets();
          for (int i = 0; i < newAlwaysOff.length; i++) {
            IActionSetDescriptor descriptor = newAlwaysOff[i];

            actionSets.unmaskAction(descriptor);
          }
        }
      } finally {
View Full Code Here


        Perspective persp = getActivePerspective();
        if (persp != null) {
            ActionSetRegistry reg = WorkbenchPlugin.getDefault()
                 .getActionSetRegistry();
           
            IActionSetDescriptor desc = reg.findActionSet(actionSetID);
            if (desc != null) {
                persp.addActionSet(desc);
                window.updateActionSets();
                window.firePerspectiveChanged(this, getPerspective(),
                        CHANGE_ACTION_SET_SHOW);
View Full Code Here

    final Object variable = context
        .getVariable(ISources.ACTIVE_ACTION_SETS_NAME);
    if (variable instanceof IActionSetDescriptor[]) {
      final IActionSetDescriptor[] descriptors = (IActionSetDescriptor[]) variable;
      for (int i = 0; i < descriptors.length; i++) {
        final IActionSetDescriptor descriptor = descriptors[i];
        final String currentId = descriptor.getId();
        if (actionSetId.equals(currentId)) {
          return EvaluationResult.TRUE;
        }
      }
    }
View Full Code Here

        ActionSetRegistry reg = WorkbenchPlugin.getDefault()
                .getActionSetRegistry();
        Iterator iter = stringList.iterator();
        while (iter.hasNext()) {
            String id = (String) iter.next();
            IActionSetDescriptor desc = reg.findActionSet(id);
            if (desc != null) {
        outputList.add(desc);
      } else {
        WorkbenchPlugin.log("Unable to find Action Set: " + id);//$NON-NLS-1$
      }
View Full Code Here

        try {
          if (service!=null) {
            service.activateContext(ContextAuthority.DEFER_EVENTS);
          }
      for (Iterator iter = temp.iterator(); iter.hasNext();) {
        IActionSetDescriptor descriptor = (IActionSetDescriptor) iter
            .next();
        addAlwaysOn(descriptor);
      }
    } finally {
      if (service!=null) {
View Full Code Here

      IMemento[] actions = memento
          .getChildren(IWorkbenchConstants.TAG_ALWAYS_ON_ACTION_SET);
      for (int x = 0; x < actions.length; x++) {
        String actionSetID = actions[x]
            .getString(IWorkbenchConstants.TAG_ID);
        final IActionSetDescriptor d = WorkbenchPlugin.getDefault()
            .getActionSetRegistry().findActionSet(actionSetID);
        if (d != null) {
          StartupThreading
              .runWithoutExceptions(new StartupRunnable() {
                public void runWithException() throws Throwable {
                  addAlwaysOn(d);
                }
              });

          knownActionSetIds.add(actionSetID);
        }
      }

      // Load the always off action sets.
      actions = memento
          .getChildren(IWorkbenchConstants.TAG_ALWAYS_OFF_ACTION_SET);
      for (int x = 0; x < actions.length; x++) {
        String actionSetID = actions[x]
            .getString(IWorkbenchConstants.TAG_ID);
        final IActionSetDescriptor d = WorkbenchPlugin.getDefault()
            .getActionSetRegistry().findActionSet(actionSetID);
        if (d != null) {
          StartupThreading
              .runWithoutExceptions(new StartupRunnable() {
                public void runWithException() throws Throwable {
                  addAlwaysOff(d);
                }
              });
          knownActionSetIds.add(actionSetID);
        }
      }

      // Load "show view actions".
      actions = memento
          .getChildren(IWorkbenchConstants.TAG_SHOW_VIEW_ACTION);
      showViewShortcuts = new ArrayList(actions.length);
      for (int x = 0; x < actions.length; x++) {
        String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
        showViewShortcuts.add(id);
      }

      // Load "show in times".
      actions = memento.getChildren(IWorkbenchConstants.TAG_SHOW_IN_TIME);
      for (int x = 0; x < actions.length; x++) {
        String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
        String timeStr = actions[x]
            .getString(IWorkbenchConstants.TAG_TIME);
        if (id != null && timeStr != null) {
          try {
            long time = Long.parseLong(timeStr);
            showInTimes.put(id, new Long(time));
          } catch (NumberFormatException e) {
            // skip this one
          }
        }
      }

      // Load "show in parts" from registry, not memento
      showInPartIds = getShowInIdsFromRegistry();

      // Load "new wizard actions".
      actions = memento
          .getChildren(IWorkbenchConstants.TAG_NEW_WIZARD_ACTION);
      newWizardShortcuts = new ArrayList(actions.length);
      for (int x = 0; x < actions.length; x++) {
        String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
        newWizardShortcuts.add(id);
      }

      // Load "perspective actions".
      actions = memento
          .getChildren(IWorkbenchConstants.TAG_PERSPECTIVE_ACTION);
      perspectiveShortcuts = new ArrayList(actions.length);
      for (int x = 0; x < actions.length; x++) {
        String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
        perspectiveShortcuts.add(id);
      }

      ArrayList extActionSets = getPerspectiveExtensionActionSets();
      for (int i = 0; i < extActionSets.size(); i++) {
        String actionSetID = (String) extActionSets.get(i);
        if (knownActionSetIds.contains(actionSetID)) {
          continue;
        }
        final IActionSetDescriptor d = WorkbenchPlugin.getDefault()
            .getActionSetRegistry().findActionSet(actionSetID);
        if (d != null) {
          StartupThreading
              .runWithoutExceptions(new StartupRunnable() {
                public void runWithException() throws Throwable {
                  addAlwaysOn(d);
                }
              });
          knownActionSetIds.add(d.getId());
        }
      }

      // Add the visible set of action sets to our knownActionSetIds
      // Now go through the registry to ensure we pick up any new action
      // sets
      // that have been added but not yet considered by this perspective.
      ActionSetRegistry reg = WorkbenchPlugin.getDefault()
          .getActionSetRegistry();
      IActionSetDescriptor[] array = reg.getActionSets();
      int count = array.length;
      for (int i = 0; i < count; i++) {
        IActionSetDescriptor desc = array[i];
        if ((!knownActionSetIds.contains(desc.getId()))
            && (desc.isInitiallyVisible())) {
          addActionSet(desc);
        }
      }
    } finally {
          // restart context changes
View Full Code Here


        // Save the "always on" action sets.
        Iterator itr = alwaysOnActionSets.iterator();
        while (itr.hasNext()) {
            IActionSetDescriptor desc = (IActionSetDescriptor) itr.next();
            IMemento child = memento
                    .createChild(IWorkbenchConstants.TAG_ALWAYS_ON_ACTION_SET);
            child.putString(IWorkbenchConstants.TAG_ID, desc.getId());
        }

        // Save the "always off" action sets.
        itr = alwaysOffActionSets.iterator();
        while (itr.hasNext()) {
            IActionSetDescriptor desc = (IActionSetDescriptor) itr.next();
            IMemento child = memento
                    .createChild(IWorkbenchConstants.TAG_ALWAYS_OFF_ACTION_SET);
            child.putString(IWorkbenchConstants.TAG_ID, desc.getId());
        }

        // Save "show view actions"
        itr = showViewShortcuts.iterator();
        while (itr.hasNext()) {
View Full Code Here

        return result;
    }
   
    public void turnOnActionSets(IActionSetDescriptor[] newArray) {
        for (int i = 0; i < newArray.length; i++) {
            IActionSetDescriptor descriptor = newArray[i];
           
            addAlwaysOn(descriptor);
        }
    }
View Full Code Here

        }
    }
   
    public void turnOffActionSets(IActionSetDescriptor[] toDisable) {
        for (int i = 0; i < toDisable.length; i++) {
            IActionSetDescriptor descriptor = toDisable[i];
           
            turnOffActionSet(descriptor);
        }
    }
View Full Code Here

    /* package */void addActionSet(IActionSetDescriptor newDesc) {
      IContextService service = (IContextService)page.getWorkbenchWindow().getService(IContextService.class);
      try {
      service.activateContext(ContextAuthority.DEFER_EVENTS);
      for (int i = 0; i < alwaysOnActionSets.size(); i++) {
        IActionSetDescriptor desc = (IActionSetDescriptor) alwaysOnActionSets
            .get(i);
        if (desc.getId().equals(newDesc.getId())) {
          removeAlwaysOn(desc);
          removeAlwaysOff(desc);
          break;
        }
      }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.internal.registry.IActionSetDescriptor

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.