|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.action.ContributionManager | +--org.eclipse.jface.action.MenuManager
A menu manager is a contribution manager which realizes itself and its items in a menu control; either as a menu bar, a sub-menu, or a context menu.
This class may be instantiated; it may also be subclassed.
Constructor Summary | |
MenuManager()
Creates a menu manager. |
|
MenuManager(String text)
Creates a menu manager with the given text. |
|
MenuManager(String text,
String id)
Creates a menu manager with the given text and id. |
Method Summary | |
void |
addMenuListener(IMenuListener listener)
Adds a menu listener to this menu. |
Menu |
createContextMenu(Control parent)
Creates and returns an SWT context menu control for this menu, and installs all registered contributions. |
Menu |
createMenuBar(Shell parent)
Creates and returns an SWT menu bar control for this menu, for use in the given shell, and installs all registered contributions. |
void |
dispose()
Disposes of this menu manager and frees all allocated SWT resources. |
void |
fill(Composite parent)
Fills the given composite control with controls representing this contribution item. |
void |
fill(Menu parent,
int index)
Fills the given menu with controls representing this contribution item. |
void |
fill(ToolBar parent,
int index)
Fills the given tool bar with controls representing this contribution item. |
IMenuManager |
findMenuUsingPath(String path)
Finds the manager for the menu at the given path. |
IContributionItem |
findUsingPath(String path)
Finds the contribution item at the given path. |
String |
getId()
Returns the menu id. |
Menu |
getMenu()
Returns the SWT menu control for this menu manager. |
IContributionManagerOverrides |
getOverrides()
Returns the overrides for the items of this manager. |
IContributionManager |
getParent()
Returns the parent contribution manager of this manger. |
boolean |
getRemoveAllWhenShown()
Returns whether all items should be removed when the menu is first shown, but before notifying menu listeners. |
boolean |
isDynamic()
Returns whether this contribution item is dynamic. |
boolean |
isEnabled()
Returns whether this menu should be enabled or not. |
boolean |
isGroupMarker()
Returns whether this contribution item is a group marker. |
boolean |
isSeparator()
Returns whether this contribution item is a separator. |
boolean |
isSubstituteFor(IContributionItem item)
|
boolean |
isVisible()
Returns whether this contribution item is visibile within its manager. |
void |
removeMenuListener(IMenuListener listener)
Removes the given menu listener from this menu. |
void |
setOverrides(IContributionManagerOverrides newOverrides)
Sets the overrides for this contribution manager |
void |
setParent(IContributionManager manager)
Sets the parent manager of this item |
void |
setRemoveAllWhenShown(boolean removeAll)
Sets whether all items should be removed when the menu is first shown, but before notifying menu listeners. |
void |
setVisible(boolean visible)
Sets whether this contribution item is visibile within its manager. |
void |
update()
Updates any SWT controls cached by this contribution item with any changes which have been made to this contribution item since the last update. |
void |
update(boolean force)
The MenuManager implementation of this IContributionManager
updates this menu, but not any of its submenus. |
protected void |
update(boolean force,
boolean recursive)
Incrementally builds the menu from the contribution items. |
void |
update(String property)
Updates any SWT controls cached by this contribution item with changes for the the given property. |
void |
updateAll(boolean force)
Incrementally builds the menu from the contribution items, and does so recursively for all submenus. |
Methods inherited from class org.eclipse.jface.action.ContributionManager |
add, add, appendToGroup, appendToGroup, dumpStatistics, find, getItems, hasDynamicItems, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll, setDirty |
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 |
add, add, appendToGroup, appendToGroup, find, getItems, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll |
Constructor Detail |
public MenuManager()
null
.
Typically used for creating a context menu, where it doesn't need to be referred to by id.
public MenuManager(String text)
null
.
Typically used for creating a sub-menu, where it doesn't need to be referred to by id.
text
- the text for the menu, or null
if nonepublic MenuManager(String text, String id)
text
- the text for the menu, or null
if noneid
- the menu id, or null
if it is to have no idMethod Detail |
public void addMenuListener(IMenuListener listener)
IMenuManager
addMenuListener
in interface IMenuManager
listener
- a menu listenerpublic Menu createContextMenu(Control parent)
Note that the menu is not expected to be dynamic.
parent
- the parent control
public Menu createMenuBar(Shell parent)
parent
- the parent shell
public void dispose()
removeAll
for that purpose.
public void fill(Composite parent)
IContributionItem
StatusLineManager
.
fill
in interface IContributionItem
parent
- the parent controlpublic void fill(Menu parent, int index)
IContributionItem
MenuManager
.
fill
in interface IContributionItem
parent
- the parent menuindex
- the index where the controls are inserted,
or -1
to insert at the endpublic void fill(ToolBar parent, int index)
IContributionItem
ToolBarManager
.
fill
in interface IContributionItem
parent
- the parent tool barindex
- the index where the controls are inserted,
or -1
to insert at the endpublic IMenuManager findMenuUsingPath(String path)
IMenuManager
'/'
.
Convenience for findUsingPath(path)
which
extracts an IMenuManager
if possible.
findMenuUsingPath
in interface IMenuManager
path
- the path string
null
if there is no such contribution item or if the item does
not have an associated menu managerpublic IContributionItem findUsingPath(String path)
IMenuManager
'/'
.
findUsingPath
in interface IMenuManager
path
- the path string
null
if there is no
such contribution itempublic String getId()
getId
in interface IContributionItem
public Menu getMenu()
public IContributionManagerOverrides getOverrides()
IContributionManager
getOverrides
in interface IContributionManager
getOverrides
in class ContributionManager
public IContributionManager getParent()
public boolean getRemoveAllWhenShown()
IMenuManager
false
.
getRemoveAllWhenShown
in interface IMenuManager
true
if all items should be removed when shown, false
if notpublic boolean isDynamic()
IContributionItem
isDynamic
in interface IContributionItem
true
if this item is dynamic, and
false
for normal itemspublic boolean isEnabled()
The default implementation of this framework method
returns true
. Subclasses may reimplement.
isEnabled
in interface IMenuManager
true
if enabled, and
false
if disabledpublic boolean isGroupMarker()
IContributionItem
isGroupMarker
in interface IContributionItem
true
if this item is a group marker, and
false
for normal itemsGroupMarker
,
IContributionManager.appendToGroup(java.lang.String, org.eclipse.jface.action.IAction)
,
IContributionManager.prependToGroup(java.lang.String, org.eclipse.jface.action.IAction)
public boolean isSeparator()
IContributionItem
isSeparator
in interface IContributionItem
true
if this item is a separator, and
false
for normal itemsSeparator
public boolean isSubstituteFor(IContributionItem item)
public boolean isVisible()
IContributionItem
isVisible
in interface IContributionItem
true
if this item is visible, and
false
otherwisepublic void removeMenuListener(IMenuListener listener)
IMenuManager
removeMenuListener
in interface IMenuManager
listener
- the menu listenerpublic void setRemoveAllWhenShown(boolean removeAll)
IMenuManager
setRemoveAllWhenShown
in interface IMenuManager
removeAll
- true
if all items should be removed when shown, false
if notpublic void setVisible(boolean visible)
IContributionItem
setVisible
in interface IContributionItem
visible
- true
if this item should be visible, and
false
otherwisepublic void setOverrides(IContributionManagerOverrides newOverrides)
setOverrides
in class ContributionManager
newOverrides
- the overrides for the items of this managerpublic void setParent(IContributionManager manager)
IContributionItem
setParent
in interface IContributionItem
manager
- the parent contribution managerpublic void update()
IContributionItem
update
in interface IContributionItem
public void update(boolean force)
MenuManager
implementation of this IContributionManager
updates this menu, but not any of its submenus.
update
in interface IContributionManager
force
- true
means update even if not dirty,
and false
for normal incremental updatingupdateAll(boolean)
public void update(String property)
IContributionItem
update
in interface IContributionItem
protected void update(boolean force, boolean recursive)
force
- true
means update even if not dirty,
and false
for normal incremental updatingrecursive
- true
means recursively update
all submenus, and false
means just this menupublic void updateAll(boolean force)
IMenuManager
updateAll
in interface IMenuManager
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 |