|
Eclipse Platform 2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.action.ContributionManager
Abstract base class for all contribution managers, and standard implementation
of IContributionManager
. This class provides functionality
common across the specific managers defined by this framework.
This class maintains a list of contribution items and a dirty flag, both as
internal state. In addition to providing implementations of most
IContributionManager
methods, this class automatically
coalesces adjacent separators, hides beginning and ending separators,
and deals with dynamically changing sets of contributions. When the set
of contributions does change dynamically, the changes are propagated
to the control via the update
method, which subclasses
must implement.
Note: A ContributionItem
cannot be shared between different
ContributionManager
s.
Constructor Summary | |
protected |
ContributionManager()
Creates a new contribution manager. |
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. |
protected void |
dumpStatistics()
Internal debug method for printing statistics about this manager to System.out . |
IContributionItem |
find(String id)
Finds the contribution item with the given id. |
IContributionItem[] |
getItems()
Returns all contribution items known to this manager. |
IContributionManagerOverrides |
getOverrides()
The ContributionManager implemenatation of this
method declared on IContributionManager returns
the current overrides. |
protected boolean |
hasDynamicItems()
Returns whether this contribution manager contains dynamic items. |
int |
indexOf(String id)
Returns the index of the item with the given id. |
void |
insert(int index,
IContributionItem item)
Insert the item at the given index. |
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. |
protected void |
itemAdded(IContributionItem item)
The given item was added to the list of contributions. |
protected void |
itemRemoved(IContributionItem item)
The given item was removed from the list of contributions. |
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. |
protected void |
setDirty(boolean d)
Sets whether this manager is dirty. |
void |
setOverrides(IContributionManagerOverrides newOverrides)
Sets the overrides for this contribution manager |
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 |
protected ContributionManager()
Method Detail |
public void add(IAction action)
IContributionManager
add(new ActionContributionItem(action))
.add
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
action
- the actionpublic void add(IContributionItem item)
IContributionManager
add
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
item
- the contribution itempublic void appendToGroup(String groupName, IAction action)
IContributionManager
appendToGroup(groupName,new ActionContributionItem(action))
.appendToGroup
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
groupName
- the name of the groupaction
- the actionIllegalArgumentException
- if there is no group with
the given namepublic void appendToGroup(String groupName, IContributionItem item)
IContributionManager
appendToGroup
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
groupName
- the name of the groupitem
- the contribution itemIllegalArgumentException
- if there is no group with
the given nameprotected void dumpStatistics()
System.out
.public IContributionItem find(String id)
IContributionManager
find
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
id
- the contribution item idnull
if
no item with the given id can be foundpublic IContributionItem[] getItems()
IContributionManager
getItems
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
public IContributionManagerOverrides getOverrides()
ContributionManager
implemenatation of this
method declared on IContributionManager
returns
the current overrides. If there is no overrides it lazily creates
one which overrides no item state.getOverrides
in interface IContributionManager
protected boolean hasDynamicItems()
true
if this manager contains dynamic items, and
false
otherwisepublic int indexOf(String id)
int
the index or -1 if the item is not foundpublic void insert(int index, IContributionItem item)
public void insertAfter(String ID, IAction action)
IContributionManager
insertAfter(id,new ActionContributionItem(action))
.insertAfter
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
id
- the contribution item idaction
- the action to insertIllegalArgumentException
- if there is no item with
the given idpublic void insertAfter(String ID, IContributionItem item)
IContributionManager
insertAfter
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
id
- the contribution item iditem
- the contribution item to insertIllegalArgumentException
- if there is no item with
the given idpublic void insertBefore(String ID, IAction action)
IContributionManager
insertBefore(id,new ActionContributionItem(action))
.insertBefore
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
id
- the contribution item idaction
- the action to insertIllegalArgumentException
- if there is no item with
the given idpublic void insertBefore(String ID, IContributionItem item)
IContributionManager
insertBefore
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
id
- the contribution item iditem
- the contribution item to insertIllegalArgumentException
- if there is no item with
the given idpublic boolean isDirty()
IContributionManager
isDirty
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
true
if this manager is dirty, and false
if it is up-to-datepublic boolean isEmpty()
IContributionManager
isEmpty
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
true
if there are no items, and
false
otherwiseprotected void itemAdded(IContributionItem item)
protected void itemRemoved(IContributionItem item)
public void markDirty()
IContributionManager
markDirty
in interface IContributionManager
public void prependToGroup(String groupName, IAction action)
IContributionManager
prependToGroup(groupName,new ActionContributionItem(action))
.prependToGroup
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
groupName
- the name of the groupaction
- the actionIllegalArgumentException
- if there is no group with
the given namepublic void prependToGroup(String groupName, IContributionItem item)
IContributionManager
prependToGroup
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
groupName
- the name of the groupitem
- the contribution itemIllegalArgumentException
- if there is no group with
the given namepublic IContributionItem remove(String ID)
IContributionManager
null
if this manager has no contribution items
with the given id.remove
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
id
- the contribution item idnull
if nonepublic IContributionItem remove(IContributionItem item)
IContributionManager
remove
in interface IContributionManager
org.eclipse.jface.action.IContributionManager
item
- the contribution itemitem
parameter if the item was removed,
and null
if it was not foundpublic void removeAll()
IContributionManager
removeAll
in interface IContributionManager
protected void setDirty(boolean d)
true
- if this manager is dirty, and false
if it is up-to-datepublic void setOverrides(IContributionManagerOverrides newOverrides)
newOverrides
- the overrides for the items of this manager
|
Eclipse Platform 2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |