Class SubContributionManager

java.lang.Object
org.eclipse.jface.action.SubContributionManager
All Implemented Interfaces:
IContributionManager
Direct Known Subclasses:
SubCoolBarManager, SubMenuManager, SubStatusLineManager, SubToolBarManager

public abstract class SubContributionManager extends Object implements IContributionManager
A SubContributionManager is used to define a set of contribution items within a parent manager. Once defined, the visibility of the entire set can be changed as a unit.
  • Constructor Details

    • 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 Details

    • 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
    • add

      public void add(IContributionItem item)
      Description copied from interface: IContributionManager
      Adds a contribution item to this manager.
      Specified by:
      add in interface IContributionManager
      Parameters:
      item - the contribution item, 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
    • appendToGroup

      public void appendToGroup(String groupName, IContributionItem item)
      Description copied from interface: IContributionManager
      Adds a contribution item to this manager at the end of the group with the given name.
      Specified by:
      appendToGroup in interface IContributionManager
      Parameters:
      groupName - the name of the group
      item - the contribution item
    • 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
    • getItems

      public IContributionItem[] getItems()
      Description copied from interface: IContributionManager
      Returns all contribution items known to this manager.
      Specified by:
      getItems in interface IContributionManager
      Returns:
      a list of contribution items
    • getParent

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

      public IContributionManagerOverrides getOverrides()
      Description copied from interface: IContributionManager
      Returns the overrides for the items of this manager.
      Specified by:
      getOverrides in interface IContributionManager
      Returns:
      the overrides for the items of this 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
    • insertAfter

      public void insertAfter(String id, IContributionItem item)
      Description copied from interface: IContributionManager
      Inserts a contribution item after the item with the given id.
      Specified by:
      insertAfter in interface IContributionManager
      Parameters:
      id - the contribution item id
      item - the contribution item 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
    • insertBefore

      public void insertBefore(String id, IContributionItem item)
      Description copied from interface: IContributionManager
      Inserts a contribution item before the item with the given id.
      Specified by:
      insertBefore in interface IContributionManager
      Parameters:
      id - the contribution item id
      item - the contribution item 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
    • items

      Deprecated.
      Use getItems(String value) instead.
      Returns:
      fetch all enumeration of wrappers for the item
    • markDirty

      public void markDirty()
      Description copied from interface: IContributionManager
      Marks this contribution manager as dirty.
      Specified by:
      markDirty in interface IContributionManager
    • 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
    • prependToGroup

      public void prependToGroup(String groupName, IContributionItem item)
      Description copied from interface: IContributionManager
      Adds a contribution item to this manager at the beginning of the group with the given name.
      Specified by:
      prependToGroup in interface IContributionManager
      Parameters:
      groupName - the name of the group
      item - the contribution item
    • 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
    • remove

      public IContributionItem remove(IContributionItem item)
      Description copied from interface: IContributionManager
      Removes the given contribution item from the contribution items known to this manager.
      Specified by:
      remove in interface IContributionManager
      Parameters:
      item - the contribution item
      Returns:
      the item parameter if the item was removed, and null if it was not found
    • removeAll

      public void removeAll()
      Description copied from interface: IContributionManager
      Removes all contribution items from this manager.

      Note: The items will not get disposed.

      Specified by:
      removeAll in interface IContributionManager
    • 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.