Package org.eclipse.jface.action
Class SubContributionManager
java.lang.Object
org.eclipse.jface.action.SubContributionManager
- All Implemented Interfaces:
IContributionManager
- Direct Known Subclasses:
SubCoolBarManager,SubMenuManager,SubStatusLineManager,SubToolBarManager
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 Summary
ConstructorsConstructorDescriptionConstructs a newSubContributionManager -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an action as a contribution item to this manager.voidadd(IContributionItem item) Adds a contribution item to this manager.voidappendToGroup(String groupName, IAction action) Adds a contribution item for the given action at the end of the group with the given name.voidappendToGroup(String groupName, IContributionItem item) Adds a contribution item to this manager at the end of the group with the given name.voidDisposes this sub contribution manager, removing all its items and cleaning up any other resources allocated by it.Finds the contribution item with the given id.getItems()Returns all contribution items known to this manager.Returns the overrides for the items of this manager.Returns the parent manager.voidinsertAfter(String id, IAction action) Inserts a contribution item for the given action after the item with the given id.voidinsertAfter(String id, IContributionItem item) Inserts a contribution item after the item with the given id.voidinsertBefore(String id, IAction action) Inserts a contribution item for the given action before the item with the given id.voidinsertBefore(String id, IContributionItem item) Inserts a contribution item before the item with the given id.booleanisDirty()Returns whether the list of contributions has recently changed and has yet to be reflected in the corresponding widgets.booleanisEmpty()Returns whether this manager has any contribution items.booleanReturns whether the contribution list is visible.protected voiditemAdded(IContributionItem item, SubContributionItem wrap) Notifies that an item has been added.protected voiditemRemoved(IContributionItem item) Notifies that an item has been removed.items()Deprecated.Use getItems(String value) instead.voidMarks this contribution manager as dirty.voidprependToGroup(String groupName, IAction action) Adds a contribution item for the given action at the beginning of the group with the given name.voidprependToGroup(String groupName, IContributionItem item) Adds a contribution item to this manager at the beginning of the group with the given name.Removes and returns the contribution item with the given id from this manager.remove(IContributionItem item) Removes the given contribution item from the contribution items known to this manager.voidRemoves all contribution items from this manager.voidsetVisible(boolean visible) Sets the visibility of the manager.protected IContributionItemunwrap(IContributionItem item) Unwraps a nested contribution item.protected SubContributionItemwrap(IContributionItem item) Wraps a contribution item in a sub contribution item, and returns the new wrapper.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.action.IContributionManager
update
-
Constructor Details
-
SubContributionManager
Constructs a newSubContributionManager- Parameters:
mgr- the parent contribution manager. All contributions made to theSubContributionManagerare forwarded and appear in the parent manager.
-
-
Method Details
-
add
Description copied from interface:IContributionManagerAdds an action as a contribution item to this manager. Equivalent toadd(new ActionContributionItem(action)).- Specified by:
addin interfaceIContributionManager- Parameters:
action- the action, this cannot benull
-
add
Description copied from interface:IContributionManagerAdds a contribution item to this manager.- Specified by:
addin interfaceIContributionManager- Parameters:
item- the contribution item, this cannot benull
-
appendToGroup
Description copied from interface:IContributionManagerAdds a contribution item for the given action at the end of the group with the given name. Equivalent toappendToGroup(groupName,new ActionContributionItem(action)).- Specified by:
appendToGroupin interfaceIContributionManager- Parameters:
groupName- the name of the groupaction- the action
-
appendToGroup
Description copied from interface:IContributionManagerAdds a contribution item to this manager at the end of the group with the given name.- Specified by:
appendToGroupin interfaceIContributionManager- Parameters:
groupName- the name of the groupitem- 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
Description copied from interface:IContributionManagerFinds the contribution item with the given id.- Specified by:
findin interfaceIContributionManager- Parameters:
id- the contribution item id- Returns:
- the contribution item, or
nullif no item with the given id can be found
-
getItems
Description copied from interface:IContributionManagerReturns all contribution items known to this manager.- Specified by:
getItemsin interfaceIContributionManager- Returns:
- a list of contribution items
-
getParent
Returns the parent manager.- Returns:
- the parent manager
-
getOverrides
Description copied from interface:IContributionManagerReturns the overrides for the items of this manager.- Specified by:
getOverridesin interfaceIContributionManager- Returns:
- the overrides for the items of this manager
-
insertAfter
Description copied from interface:IContributionManagerInserts a contribution item for the given action after the item with the given id. Equivalent toinsertAfter(id,new ActionContributionItem(action)).- Specified by:
insertAfterin interfaceIContributionManager- Parameters:
id- the contribution item idaction- the action to insert
-
insertAfter
Description copied from interface:IContributionManagerInserts a contribution item after the item with the given id.- Specified by:
insertAfterin interfaceIContributionManager- Parameters:
id- the contribution item iditem- the contribution item to insert
-
insertBefore
Description copied from interface:IContributionManagerInserts a contribution item for the given action before the item with the given id. Equivalent toinsertBefore(id,new ActionContributionItem(action)).- Specified by:
insertBeforein interfaceIContributionManager- Parameters:
id- the contribution item idaction- the action to insert
-
insertBefore
Description copied from interface:IContributionManagerInserts a contribution item before the item with the given id.- Specified by:
insertBeforein interfaceIContributionManager- Parameters:
id- the contribution item iditem- the contribution item to insert
-
isDirty
public boolean isDirty()Description copied from interface:IContributionManagerReturns whether the list of contributions has recently changed and has yet to be reflected in the corresponding widgets.- Specified by:
isDirtyin interfaceIContributionManager- Returns:
trueif this manager is dirty, andfalseif it is up-to-date
-
isEmpty
public boolean isEmpty()Description copied from interface:IContributionManagerReturns whether this manager has any contribution items.- Specified by:
isEmptyin interfaceIContributionManager- Returns:
trueif there are no items, andfalseotherwise
-
isVisible
public boolean isVisible()Returns whether the contribution list is visible. If the visibility istruethen each item within the manager appears within the parent manager. Otherwise, the items are not visible.- Returns:
trueif the manager is visible
-
itemAdded
Notifies that an item has been added.Subclasses are not expected to override this method.
- Parameters:
item- the item contributed by the clientwrap- the item contributed to the parent manager as a proxy for the item contributed by the client
-
itemRemoved
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:IContributionManagerMarks this contribution manager as dirty.- Specified by:
markDirtyin interfaceIContributionManager
-
prependToGroup
Description copied from interface:IContributionManagerAdds a contribution item for the given action at the beginning of the group with the given name. Equivalent toprependToGroup(groupName,new ActionContributionItem(action)).- Specified by:
prependToGroupin interfaceIContributionManager- Parameters:
groupName- the name of the groupaction- the action
-
prependToGroup
Description copied from interface:IContributionManagerAdds a contribution item to this manager at the beginning of the group with the given name.- Specified by:
prependToGroupin interfaceIContributionManager- Parameters:
groupName- the name of the groupitem- the contribution item
-
remove
Description copied from interface:IContributionManagerRemoves and returns the contribution item with the given id from this manager. Returnsnullif this manager has no contribution items with the given id.- Specified by:
removein interfaceIContributionManager- Parameters:
id- the contribution item id- Returns:
- the item that was found and removed, or
nullif none
-
remove
Description copied from interface:IContributionManagerRemoves the given contribution item from the contribution items known to this manager.- Specified by:
removein interfaceIContributionManager- Parameters:
item- the contribution item- Returns:
- the
itemparameter if the item was removed, andnullif it was not found
-
removeAll
public void removeAll()Description copied from interface:IContributionManagerRemoves all contribution items from this manager.Note: The items will not get disposed.
- Specified by:
removeAllin interfaceIContributionManager
-
setVisible
public void setVisible(boolean visible) Sets the visibility of the manager. If the visibility istruethen each item within the manager appears within the parent manager. Otherwise, the items are not visible.- Parameters:
visible- the new visibility
-
wrap
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
Unwraps a nested contribution item. If the contribution item is an instance ofSubContributionItem, then its inner item is returned. Otherwise, the item itself is returned.- Parameters:
item- The item to unwrap; may benull.- Returns:
- The inner item of
item, ifitemis aSubContributionItem;itemotherwise.
-