Class SubContributionManager

    • Constructor Detail

      • SubContributionManager

        public SubContributionManager​(IContributionManager mgr)
        Constructs a new SubContributionManager
        Parameters:
        mgr - the parent contribution manager. All contributions made to the SubContributionManager are forwarded and appear in the parent manager.
    • Method Detail

      • add

        public void add​(IAction action)
        Description copied from interface: IContributionManager
        Adds an action as a contribution item to this manager. Equivalent to add(new ActionContributionItem(action)).
        Specified by:
        add in interface IContributionManager
        Parameters:
        action - the action, this cannot be null
      • appendToGroup

        public void appendToGroup​(String groupName,
                                  IAction action)
        Description copied from interface: IContributionManager
        Adds a contribution item for the given action at the end of the group with the given name. Equivalent to appendToGroup(groupName,new ActionContributionItem(action)).
        Specified by:
        appendToGroup in interface IContributionManager
        Parameters:
        groupName - the name of the group
        action - the action
      • disposeManager

        public void disposeManager()
        Disposes this sub contribution manager, removing all its items and cleaning up any other resources allocated by it. This must leave no trace of this sub contribution manager in the parent manager. Subclasses may extend.
        Since:
        3.0
      • find

        public IContributionItem find​(String id)
        Description copied from interface: IContributionManager
        Finds the contribution item with the given id.
        Specified by:
        find in interface IContributionManager
        Parameters:
        id - the contribution item id
        Returns:
        the contribution item, or null if no item with the given id can be found
      • getParent

        public IContributionManager getParent()
        Returns the parent manager.
        Returns:
        the parent manager
      • insertAfter

        public void insertAfter​(String id,
                                IAction action)
        Description copied from interface: IContributionManager
        Inserts a contribution item for the given action after the item with the given id. Equivalent to insertAfter(id,new ActionContributionItem(action)).
        Specified by:
        insertAfter in interface IContributionManager
        Parameters:
        id - the contribution item id
        action - the action to insert
      • insertBefore

        public void insertBefore​(String id,
                                 IAction action)
        Description copied from interface: IContributionManager
        Inserts a contribution item for the given action before the item with the given id. Equivalent to insertBefore(id,new ActionContributionItem(action)).
        Specified by:
        insertBefore in interface IContributionManager
        Parameters:
        id - the contribution item id
        action - the action to insert
      • isDirty

        public boolean isDirty()
        Description copied from interface: IContributionManager
        Returns whether the list of contributions has recently changed and has yet to be reflected in the corresponding widgets.
        Specified by:
        isDirty in interface IContributionManager
        Returns:
        true if this manager is dirty, and false if it is up-to-date
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: IContributionManager
        Returns whether this manager has any contribution items.
        Specified by:
        isEmpty in interface IContributionManager
        Returns:
        true if there are no items, and false otherwise
      • isVisible

        public boolean isVisible()
        Returns whether the contribution list is visible. If the visibility is true then each item within the manager appears within the parent manager. Otherwise, the items are not visible.
        Returns:
        true if the manager is visible
      • itemAdded

        protected void itemAdded​(IContributionItem item,
                                 SubContributionItem wrap)
        Notifies that an item has been added.

        Subclasses are not expected to override this method.

        Parameters:
        item - the item contributed by the client
        wrap - the item contributed to the parent manager as a proxy for the item contributed by the client
      • itemRemoved

        protected void itemRemoved​(IContributionItem item)
        Notifies that an item has been removed.

        Subclasses are not expected to override this method.

        Parameters:
        item - the item contributed by the client
      • prependToGroup

        public void prependToGroup​(String groupName,
                                   IAction action)
        Description copied from interface: IContributionManager
        Adds a contribution item for the given action at the beginning of the group with the given name. Equivalent to prependToGroup(groupName,new ActionContributionItem(action)).
        Specified by:
        prependToGroup in interface IContributionManager
        Parameters:
        groupName - the name of the group
        action - the action
      • remove

        public IContributionItem remove​(String id)
        Description copied from interface: IContributionManager
        Removes and returns the contribution item with the given id from this manager. Returns null if this manager has no contribution items with the given id.
        Specified by:
        remove in interface IContributionManager
        Parameters:
        id - the contribution item id
        Returns:
        the item that was found and removed, or null if none
      • setVisible

        public void setVisible​(boolean visible)
        Sets the visibility of the manager. If the visibility is true then each item within the manager appears within the parent manager. Otherwise, the items are not visible.
        Parameters:
        visible - the new visibility
      • wrap

        protected SubContributionItem wrap​(IContributionItem item)
        Wraps a contribution item in a sub contribution item, and returns the new wrapper.
        Parameters:
        item - the contribution item to be wrapped
        Returns:
        the wrapped item
      • unwrap

        protected IContributionItem unwrap​(IContributionItem item)
        Unwraps a nested contribution item. If the contribution item is an instance of SubContributionItem, then its inner item is returned. Otherwise, the item itself is returned.
        Parameters:
        item - The item to unwrap; may be null.
        Returns:
        The inner item of item, if item is a SubContributionItem;item otherwise.