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
public abstract class SubContributionManager extends Object implements IContributionManager
ASubContributionManageris 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
Constructors Constructor Description SubContributionManager(IContributionManager mgr)Constructs a newSubContributionManager
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(IAction action)Adds 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.voiddisposeManager()Disposes this sub contribution manager, removing all its items and cleaning up any other resources allocated by it.IContributionItemfind(String id)Finds the contribution item with the given id.IContributionItem[]getItems()Returns all contribution items known to this manager.IContributionManagerOverridesgetOverrides()Returns the overrides for the items of this manager.IContributionManagergetParent()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.booleanisVisible()Returns 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.Enumeration<SubContributionItem>items()Deprecated.Use getItems(String value) instead.voidmarkDirty()Marks 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.IContributionItemremove(String id)Removes and returns the contribution item with the given id from this manager.IContributionItemremove(IContributionItem item)Removes the given contribution item from the contribution items known to this manager.voidremoveAll()Removes 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, wait
-
Methods inherited from interface org.eclipse.jface.action.IContributionManager
update
-
-
-
-
Constructor Detail
-
SubContributionManager
public SubContributionManager(IContributionManager mgr)
Constructs a newSubContributionManager- Parameters:
mgr- the parent contribution manager. All contributions made to theSubContributionManagerare forwarded and appear in the parent manager.
-
-
Method Detail
-
add
public void add(IAction action)
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
public void add(IContributionItem item)
Description copied from interface:IContributionManagerAdds a contribution item to this manager.- Specified by:
addin interfaceIContributionManager- Parameters:
item- the contribution item, this cannot benull
-
appendToGroup
public void appendToGroup(String groupName, IAction action)
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
public void appendToGroup(String groupName, IContributionItem item)
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
public IContributionItem find(String id)
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
public IContributionItem[] getItems()
Description copied from interface:IContributionManagerReturns all contribution items known to this manager.- Specified by:
getItemsin interfaceIContributionManager- 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:IContributionManagerReturns the overrides for the items of this manager.- Specified by:
getOverridesin interfaceIContributionManager- Returns:
- the overrides for the items of this manager
-
insertAfter
public void insertAfter(String id, IAction action)
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
public void insertAfter(String id, IContributionItem item)
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
public void insertBefore(String id, IAction action)
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
public void insertBefore(String id, IContributionItem item)
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
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 clientwrap- 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 public Enumeration<SubContributionItem> 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
public void prependToGroup(String groupName, IAction action)
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
public void prependToGroup(String groupName, IContributionItem item)
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
public IContributionItem remove(String id)
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
public IContributionItem remove(IContributionItem item)
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
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 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.
-
-