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
ConstructorDescriptionConstructs a newSubContributionManager
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an action as a contribution item to this manager.void
add
(IContributionItem item) Adds a contribution item to this manager.void
appendToGroup
(String groupName, IAction action) Adds a contribution item for the given action at the end of the group with the given name.void
appendToGroup
(String groupName, IContributionItem item) Adds a contribution item to this manager at the end of the group with the given name.void
Disposes 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.void
insertAfter
(String id, IAction action) Inserts a contribution item for the given action after the item with the given id.void
insertAfter
(String id, IContributionItem item) Inserts a contribution item after the item with the given id.void
insertBefore
(String id, IAction action) Inserts a contribution item for the given action before the item with the given id.void
insertBefore
(String id, IContributionItem item) Inserts a contribution item before the item with the given id.boolean
isDirty()
Returns whether the list of contributions has recently changed and has yet to be reflected in the corresponding widgets.boolean
isEmpty()
Returns whether this manager has any contribution items.boolean
Returns whether the contribution list is visible.protected void
itemAdded
(IContributionItem item, SubContributionItem wrap) Notifies that an item has been added.protected void
itemRemoved
(IContributionItem item) Notifies that an item has been removed.items()
Deprecated.Use getItems(String value) instead.void
Marks this contribution manager as dirty.void
prependToGroup
(String groupName, IAction action) Adds a contribution item for the given action at the beginning of the group with the given name.void
prependToGroup
(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.void
Removes all contribution items from this manager.void
setVisible
(boolean visible) Sets the visibility of the manager.protected IContributionItem
unwrap
(IContributionItem item) Unwraps a nested contribution item.protected SubContributionItem
wrap
(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, wait
Methods 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 theSubContributionManager
are forwarded and appear in the parent manager.
-
-
Method Details
-
add
Description copied from interface:IContributionManager
Adds an action as a contribution item to this manager. Equivalent toadd(new ActionContributionItem(action))
.- Specified by:
add
in interfaceIContributionManager
- Parameters:
action
- the action, this cannot benull
-
add
Description copied from interface:IContributionManager
Adds a contribution item to this manager.- Specified by:
add
in interfaceIContributionManager
- Parameters:
item
- the contribution item, this cannot benull
-
appendToGroup
Description copied from interface:IContributionManager
Adds 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:
appendToGroup
in interfaceIContributionManager
- Parameters:
groupName
- the name of the groupaction
- the action
-
appendToGroup
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 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:IContributionManager
Finds the contribution item with the given id.- Specified by:
find
in interfaceIContributionManager
- Parameters:
id
- the contribution item id- Returns:
- the contribution item, or
null
if no item with the given id can be found
-
getItems
Description copied from interface:IContributionManager
Returns all contribution items known to this manager.- Specified by:
getItems
in interfaceIContributionManager
- Returns:
- a list of contribution items
-
getParent
Returns the parent manager.- Returns:
- the parent manager
-
getOverrides
Description copied from interface:IContributionManager
Returns the overrides for the items of this manager.- Specified by:
getOverrides
in interfaceIContributionManager
- Returns:
- the overrides for the items of this manager
-
insertAfter
Description copied from interface:IContributionManager
Inserts a contribution item for the given action after the item with the given id. Equivalent toinsertAfter(id,new ActionContributionItem(action))
.- Specified by:
insertAfter
in interfaceIContributionManager
- Parameters:
id
- the contribution item idaction
- the action to insert
-
insertAfter
Description copied from interface:IContributionManager
Inserts a contribution item after the item with the given id.- Specified by:
insertAfter
in interfaceIContributionManager
- Parameters:
id
- the contribution item iditem
- the contribution item to insert
-
insertBefore
Description copied from interface:IContributionManager
Inserts a contribution item for the given action before the item with the given id. Equivalent toinsertBefore(id,new ActionContributionItem(action))
.- Specified by:
insertBefore
in interfaceIContributionManager
- Parameters:
id
- the contribution item idaction
- the action to insert
-
insertBefore
Description copied from interface:IContributionManager
Inserts a contribution item before the item with the given id.- Specified by:
insertBefore
in interfaceIContributionManager
- Parameters:
id
- the contribution item iditem
- 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 interfaceIContributionManager
- Returns:
true
if this manager is dirty, andfalse
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 interfaceIContributionManager
- Returns:
true
if there are no items, andfalse
otherwise
-
isVisible
public boolean isVisible()Returns whether the contribution list is visible. If the visibility istrue
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
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:IContributionManager
Marks this contribution manager as dirty.- Specified by:
markDirty
in interfaceIContributionManager
-
prependToGroup
Description copied from interface:IContributionManager
Adds 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:
prependToGroup
in interfaceIContributionManager
- Parameters:
groupName
- the name of the groupaction
- the action
-
prependToGroup
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 interfaceIContributionManager
- Parameters:
groupName
- the name of the groupitem
- the contribution item
-
remove
Description copied from interface:IContributionManager
Removes and returns the contribution item with the given id from this manager. Returnsnull
if this manager has no contribution items with the given id.- Specified by:
remove
in interfaceIContributionManager
- Parameters:
id
- the contribution item id- Returns:
- the item that was found and removed, or
null
if none
-
remove
Description copied from interface:IContributionManager
Removes the given contribution item from the contribution items known to this manager.- Specified by:
remove
in interfaceIContributionManager
- Parameters:
item
- the contribution item- Returns:
- the
item
parameter if the item was removed, andnull
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 interfaceIContributionManager
-
setVisible
public void setVisible(boolean visible) Sets the visibility of the manager. If the visibility istrue
then 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
, ifitem
is aSubContributionItem
;item
otherwise.
-