Package org.eclipse.ui.internal.registry

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


    /* package */void removeActionSet(String id) {
      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(id)) {
          removeAlwaysOn(desc);
          break;
        }
      }

      for (int i = 0; i < alwaysOffActionSets.size(); i++) {
        IActionSetDescriptor desc = (IActionSetDescriptor) alwaysOffActionSets
            .get(i);
        if (desc.getId().equals(id)) {
          removeAlwaysOff(desc);
          break;
        }
      }
    } finally {
View Full Code Here


        oldList.addAll(mapDescToRec.keySet());
        oldList.addAll(invisibleBars.keySet());

        Iterator iter = oldList.iterator();
        while (iter.hasNext()) {
            IActionSetDescriptor desc = (IActionSetDescriptor) iter.next();
            removeActionSet(desc);
        }
    }
View Full Code Here

    public void setActionSets(IActionSetDescriptor[] newArray) {
        // Convert array to list.
        HashSet newList = new HashSet();
       
        for (int i = 0; i < newArray.length; i++) {
            IActionSetDescriptor descriptor = newArray[i];
           
            newList.add(descriptor);
        }
        List oldList = new ArrayList(mapDescToRec.keySet());

        // Remove obsolete actions.
        Iterator iter = oldList.iterator();
        while (iter.hasNext()) {
            IActionSetDescriptor desc = (IActionSetDescriptor) iter.next();
            if (!newList.contains(desc)) {
                SetRec rec = (SetRec) mapDescToRec.get(desc);
                if (rec != null) {
                    mapDescToRec.remove(desc);
                    IActionSet set = rec.set;
                    SubActionBars bars = rec.bars;
                    if (bars != null) {
                        SetRec invisibleRec = new SetRec(desc, set, bars);
                        invisibleBars.put(desc, invisibleRec);
                        bars.deactivate();
                    }
                }
            }
        }

        // Add new actions.
        ArrayList sets = new ArrayList();
       
        for (int i = 0; i < newArray.length; i++) {
            IActionSetDescriptor desc = newArray[i];

            if (!mapDescToRec.containsKey(desc)) {
                try {
                    SetRec rec;
                    // If the action bars and sets have already been created
                    // then
                    // reuse those action sets
                    if (invisibleBars.containsKey(desc)) {
                        rec = (SetRec) invisibleBars.get(desc);
                        if (rec.bars != null) {
                            rec.bars.activate();
                        }
                        invisibleBars.remove(desc);
                    } else {
                        IActionSet set = desc.createActionSet();
                        SubActionBars bars = new ActionSetActionBars(window
                .getActionBars(), window,
                (IActionBarConfigurer2) window.getWindowConfigurer()
                    .getActionBarConfigurer(), desc.getId());
                        rec = new SetRec(desc, set, bars);
                        set.init(window, bars);
                        sets.add(set);

                        // only register against the tracker once - check for
                        // other registrations against the provided extension
                        Object[] existingRegistrations = window
                                .getExtensionTracker().getObjects(
                                        desc.getConfigurationElement()
                                                .getDeclaringExtension());
                        if (existingRegistrations.length == 0
                                || !containsRegistration(existingRegistrations,
                                        desc)) {
                            //register the set with the page tracker
                            //this will be cleaned up by WorkbenchWindow listener
                            window.getExtensionTracker().registerObject(
                                    desc.getConfigurationElement().getDeclaringExtension(),
                                    desc, IExtensionTracker.REF_WEAK);
                        }
                    }
                    mapDescToRec.put(desc, rec);
                } catch (CoreException e) {
                    WorkbenchPlugin
                            .log("Unable to create ActionSet: " + desc.getId(), e);//$NON-NLS-1$
                }
            }
        }
        // We process action sets in two passes for coolbar purposes. First we
        // process base contributions
View Full Code Here

        ActionSetRegistry reg = WorkbenchPlugin.getDefault()
                .getActionSetRegistry();
        IActionSetDescriptor[] array = reg.getActionSets();
        int count = array.length;
        for (int nX = 0; nX < count; nX++) {
            IActionSetDescriptor desc = array[nX];
            if (desc.isInitiallyVisible()) {
        addActionSet(desc.getId());
      }
        }
    }
View Full Code Here

  }

  public String getToolbarLabel(String actionSetId) {
    ActionSetRegistry registry = WorkbenchPlugin.getDefault()
        .getActionSetRegistry();
    IActionSetDescriptor actionSet = registry.findActionSet(actionSetId);
    if (actionSet != null) {
      return actionSet.getLabel();
    }

    if (IWorkbenchActionConstants.TOOLBAR_FILE
        .equalsIgnoreCase(actionSetId)) {
      return WorkbenchMessages.WorkbenchWindow_FileToolbar;
View Full Code Here

  private IPropertyListener getContextListener() {
    if (contextListener == null) {
      contextListener = new IPropertyListener() {
        public void propertyChanged(Object source, int propId) {
          if (source instanceof IActionSetDescriptor) {
            IActionSetDescriptor desc = (IActionSetDescriptor) source;
            String id = desc.getId();
            if (propId == PROP_VISIBLE) {
              activationsById.put(id, contextService
                  .activateContext(id));
            } else if (propId == PROP_HIDDEN) {
              IContextActivation act = (IContextActivation) activationsById
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.