|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A contribution manager organizes contributions to such UI components as menus, toolbars and status lines.
A contribution manager keeps track of a list of contribution items. Each contribution item may has an optional identifier, which can be used to retrieve items from a manager, and for positioning items relative to each other. The list of contribution items can be subdivided into named groups using special contribution items that serve as group markers.
The IContributionManager
interface provides general
protocol for adding, removing, and retrieving contribution items.
It also provides convenience methods that make it convenient
to contribute actions. This interface should be implemented
by all objects that wish to manage contributions.
There are several implementions of this interface in this package,
including ones for menus (
),
tool bars (MenuManager
),
and status lines (ToolBarManager
).
StatusLineManager
Method Summary | |
void |
add(IAction action)
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. |
IContributionItem |
find(String id)
Finds the contribution item with the given id. |
IContributionItem[] |
getItems()
Returns all contribution items known to this manager. |
IContributionManagerOverrides |
getOverrides()
Returns the overrides for the items of this 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. |
void |
markDirty()
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. |
IContributionItem |
remove(IContributionItem item)
Removes the given contribution item from the contribution items known to this manager. |
IContributionItem |
remove(String id)
Removes and returns the contribution item with the given id from this manager. |
void |
removeAll()
Removes all contribution items from this manager. |
void |
update(boolean force)
Updates this manager's underlying widget(s) with any changes which have been made to it or its items. |
Method Detail |
public void add(IAction action)
add(new ActionContributionItem(action))
.
action
- the actionpublic void add(IContributionItem item)
item
- the contribution itempublic void appendToGroup(String groupName, IAction action)
appendToGroup(groupName,new ActionContributionItem(action))
.
groupName
- the name of the groupaction
- the action
IllegalArgumentException
- if there is no group with
the given namepublic void appendToGroup(String groupName, IContributionItem item)
groupName
- the name of the groupitem
- the contribution item
IllegalArgumentException
- if there is no group with
the given namepublic IContributionItem find(String id)
id
- the contribution item id
null
if
no item with the given id can be foundpublic IContributionItem[] getItems()
public IContributionManagerOverrides getOverrides()
public void insertAfter(String id, IAction action)
insertAfter(id,new ActionContributionItem(action))
.
id
- the contribution item idaction
- the action to insert
IllegalArgumentException
- if there is no item with
the given idpublic void insertAfter(String ID, IContributionItem item)
item
- the contribution item to insert
IllegalArgumentException
- if there is no item with
the given idpublic void insertBefore(String id, IAction action)
insertBefore(id,new ActionContributionItem(action))
.
id
- the contribution item idaction
- the action to insert
IllegalArgumentException
- if there is no item with
the given idpublic void insertBefore(String ID, IContributionItem item)
item
- the contribution item to insert
IllegalArgumentException
- if there is no item with
the given idpublic boolean isDirty()
true
if this manager is dirty, and false
if it is up-to-datepublic boolean isEmpty()
true
if there are no items, and
false
otherwisepublic void markDirty()
public void prependToGroup(String groupName, IAction action)
prependToGroup(groupName,new ActionContributionItem(action))
.
groupName
- the name of the groupaction
- the action
IllegalArgumentException
- if there is no group with
the given namepublic void prependToGroup(String groupName, IContributionItem item)
groupName
- the name of the groupitem
- the contribution item
IllegalArgumentException
- if there is no group with
the given namepublic IContributionItem remove(String id)
null
if this manager has no contribution items
with the given id.
id
- the contribution item id
null
if nonepublic IContributionItem remove(IContributionItem item)
item
- the contribution item
item
parameter if the item was removed,
and null
if it was not foundpublic void removeAll()
public void update(boolean force)
force
- true
means update even if not dirty,
and false
for normal incremental updating
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |