|
|
|
|
org.eclipse.jface.action
Class SubMenuManager
java.lang.Object
org.eclipse.jface.action.SubContributionManager
org.eclipse.jface.action.SubMenuManager
-
All Implemented Interfaces:
-
IContributionItem,
IContributionManager,
IMenuManager
-
public class SubMenuManager
- extends
SubContributionManager
- implements
IMenuManager
A SubMenuManager 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.
A client may ask for and make additions to a submenu. The visibility of these items
is also controlled by the visibility of the SubMenuManager .
Method Summary
|
void
|
addMenuListener
(
IMenuListener listener)
Adds a menu listener to this menu. |
void
|
dispose
()
The default implementation of this IContributionItem
method does nothing. |
void
|
disposeManager
()
Disposes this sub contribution manager, removing all its items
and cleaning up any other resources allocated by it. |
void
|
fill
(
Composite parent)
Fills the given composite control with controls representing this
contribution item. |
void
|
fill
(
CoolBar parent,
int index)
Fills the given cool bar 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. |
IContributionItem
|
find
(
String id)
Finds the contribution item with the given id. |
IMenuManager
|
findMenuUsingPath
(
String path)
The menu returned is wrapped within a SubMenuManager to
monitor additions and removals. |
IContributionItem
|
findUsingPath
(
String path)
Finds the contribution item at the given path. |
String
|
getId
()
Returns the identifier of this contribution item. |
protected
IMenuManager
|
getParentMenuManager
()
|
boolean
|
getRemoveAllWhenShown
()
Returns whether all items should be removed when the menu is about to
show, but before notifying menu listeners. |
protected
IMenuManager
|
getWrapper
(
IMenuManager mgr)
Returns the menu wrapper for a menu manager. |
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. |
void
|
removeAll
()
Remove all contribution items. |
void
|
removeMenuListener
(
IMenuListener listener)
Removes the given menu listener from this menu. |
void
|
saveWidgetState
()
Saves any state information of the control(s) owned by this contribution item. |
void
|
setParent
(
IContributionManager parent)
Sets the parent manager of this item |
void
|
setRemoveAllWhenShown
(boolean removeAll)
Sets whether all items should be removed when the menu is about to show,
but before notifying menu listeners. |
void
|
setVisible
(boolean visible)
Sets the visibility of the 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)
Updates this manager's underlying widget(s) with any changes which
have been made to it or its items. |
void
|
update
(
String id)
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. |
protected
SubMenuManager
|
wrapMenu
(
IMenuManager menu)
Wraps a menu manager in a sub menu manager, and returns the new wrapper. |
Methods inherited from class org.eclipse.jface.action.
SubContributionManager
|
add,
add,
appendToGroup,
appendToGroup,
getItems,
getOverrides,
getParent,
insertAfter,
insertAfter,
insertBefore,
insertBefore,
isDirty,
isEmpty,
isVisible,
itemAdded,
itemRemoved,
items,
markDirty,
prependToGroup,
prependToGroup,
remove,
remove,
unwrap,
wrap
|
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,
getItems,
getOverrides,
insertAfter,
insertAfter,
insertBefore,
insertBefore,
isDirty,
isEmpty,
markDirty,
prependToGroup,
prependToGroup,
remove,
remove
|
SubMenuManager
public SubMenuManager(
IMenuManager mgr)
- Constructs a new manager.
-
Parameters:
-
mgr - the parent manager. All contributions made to the
SubMenuManager are forwarded and appear in the
parent manager.
addMenuListener
public void addMenuListener(
IMenuListener listener)
-
Description copied from interface:
IMenuManager
- Adds a menu listener to this menu.
Has no effect if an identical listener is already registered.
-
-
Specified by:
-
addMenuListener
in interface
IMenuManager
-
-
Parameters:
-
listener - a menu listener
dispose
public void dispose()
- The default implementation of this
IContributionItem
method does nothing. Subclasses may override.
-
-
Specified by:
-
dispose
in interface
IContributionItem
-
disposeManager
public void disposeManager()
-
Description copied from class:
SubContributionManager
- 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.
-
-
Overrides:
-
disposeManager
in class
SubContributionManager
-
fill
public void fill(
Composite parent)
-
Description copied from interface:
IContributionItem
- Fills the given composite control with controls representing this
contribution item. Used by
StatusLineManager .
-
-
Specified by:
-
fill
in interface
IContributionItem
-
-
Parameters:
-
parent - the parent control
fill
public void fill(
CoolBar parent,
int index)
-
Description copied from interface:
IContributionItem
- Fills the given cool bar with controls representing this contribution item.
Used by
CoolBarManager .
-
-
Specified by:
-
fill
in interface
IContributionItem
-
-
Parameters:
-
parent - the parent cool bar -
index - the index where the controls are inserted,
or -1 to insert at the end
fill
public void fill(
Menu parent,
int index)
-
Description copied from interface:
IContributionItem
- Fills the given menu with controls representing this contribution item.
Used by
MenuManager .
-
-
Specified by:
-
fill
in interface
IContributionItem
-
-
Parameters:
-
parent - the parent menu -
index - the index where the controls are inserted,
or -1 to insert at the end
fill
public void fill(
ToolBar parent,
int index)
-
Description copied from interface:
IContributionItem
- Fills the given tool bar with controls representing this contribution item.
Used by
ToolBarManager .
-
-
Specified by:
-
fill
in interface
IContributionItem
-
-
Parameters:
-
parent - the parent tool bar -
index - the index where the controls are inserted,
or -1 to insert at the end
find
public
IContributionItem find(
String id)
-
Description copied from interface:
IContributionManager
- Finds the contribution item with the given id.
-
-
Specified by:
-
find
in interface
IContributionManager
-
Overrides:
-
find
in class
SubContributionManager
-
-
Parameters:
-
id - the contribution item id
-
Returns:
- the contribution item, or
null if
no item with the given id can be found
findMenuUsingPath
public
IMenuManager findMenuUsingPath(
String path)
-
The menu returned is wrapped within a SubMenuManager to
monitor additions and removals. If the visibility of this menu is modified
the visibility of the submenus is also modified.
-
-
Specified by:
-
findMenuUsingPath
in interface
IMenuManager
-
-
Parameters:
-
path - the path string
-
Returns:
- the menu contribution item, or
null
if there is no such contribution item or if the item does
not have an associated menu manager
findUsingPath
public
IContributionItem findUsingPath(
String path)
-
Description copied from interface:
IMenuManager
- Finds the contribution item at the given path. A path
consists of contribution item ids separated by the separator
character. The path separator character is
'/' .
-
-
Specified by:
-
findUsingPath
in interface
IMenuManager
-
-
Parameters:
-
path - the path string
-
Returns:
- the contribution item, or
null if there is no
such contribution item
getId
public
String getId()
-
Description copied from interface:
IContributionItem
- Returns the identifier of this contribution item.
The id is used for retrieving an item from its manager.
-
-
Specified by:
-
getId
in interface
IContributionItem
-
-
Returns:
- the contribution item identifier, or
null
if none
getParentMenuManager
protected final
IMenuManager getParentMenuManager()
-
-
-
Returns:
- the parent menu manager that this sub-manager contributes to.
getRemoveAllWhenShown
public boolean getRemoveAllWhenShown()
-
Description copied from interface:
IMenuManager
- Returns whether all items should be removed when the menu is about to
show, but before notifying menu listeners. The default is
false .
-
-
Specified by:
-
getRemoveAllWhenShown
in interface
IMenuManager
-
-
Returns:
-
true if all items should be removed when shown,
false if not
getWrapper
protected
IMenuManager getWrapper(
IMenuManager mgr)
- Returns the menu wrapper for a menu manager.
The sub menus within this menu are wrapped within a SubMenuManager to
monitor additions and removals. If the visibility of this menu is modified
the visibility of the sub menus is also modified.
-
-
-
Parameters:
-
mgr - the menu manager to be wrapped
-
Returns:
- the menu wrapper
isDynamic
public boolean isDynamic()
-
Description copied from interface:
IContributionItem
- Returns whether this contribution item is dynamic. A dynamic contribution
item contributes items conditionally, dependent on some internal state.
-
-
Specified by:
-
isDynamic
in interface
IContributionItem
-
-
Returns:
-
true if this item is dynamic, and
false for normal items
isEnabled
public boolean isEnabled()
-
Description copied from interface:
IMenuManager
- Returns whether this menu should be enabled or not.
-
-
Specified by:
-
isEnabled
in interface
IContributionItem
-
Specified by:
-
isEnabled
in interface
IMenuManager
-
-
Returns:
-
true if enabled, and
false if disabled
isGroupMarker
public boolean isGroupMarker()
-
Description copied from interface:
IContributionItem
- Returns whether this contribution item is a group marker.
This information is used when adding items to a group.
-
-
Specified by:
-
isGroupMarker
in interface
IContributionItem
-
-
Returns:
-
true if this item is a group marker, and
false for normal items -
See Also:
-
GroupMarker ,
IContributionManager.appendToGroup(String, IContributionItem) ,
IContributionManager.prependToGroup(String, IContributionItem)
isSeparator
public boolean isSeparator()
-
Description copied from interface:
IContributionItem
- Returns whether this contribution item is a separator.
This information is used to enable hiding of unnecessary separators.
-
-
Specified by:
-
isSeparator
in interface
IContributionItem
-
-
Returns:
-
true if this item is a separator, and
false for normal items -
See Also:
-
Separator
removeAll
public void removeAll()
- Remove all contribution items.
-
-
Specified by:
-
removeAll
in interface
IContributionManager
-
Overrides:
-
removeAll
in class
SubContributionManager
-
removeMenuListener
public void removeMenuListener(
IMenuListener listener)
-
Description copied from interface:
IMenuManager
- Removes the given menu listener from this menu.
Has no effect if an identical listener is not registered.
-
-
Specified by:
-
removeMenuListener
in interface
IMenuManager
-
-
Parameters:
-
listener - the menu listener
saveWidgetState
public void saveWidgetState()
-
Description copied from interface:
IContributionItem
- Saves any state information of the control(s) owned by this contribution item.
The contribution manager calls this method before disposing of the controls.
-
-
Specified by:
-
saveWidgetState
in interface
IContributionItem
-
setParent
public void setParent(
IContributionManager parent)
-
Description copied from interface:
IContributionItem
- Sets the parent manager of this item
-
-
Specified by:
-
setParent
in interface
IContributionItem
-
-
Parameters:
-
parent - the parent contribution manager
setRemoveAllWhenShown
public void setRemoveAllWhenShown(boolean removeAll)
-
Description copied from interface:
IMenuManager
- Sets whether all items should be removed when the menu is about to show,
but before notifying menu listeners.
-
-
Specified by:
-
setRemoveAllWhenShown
in interface
IMenuManager
-
-
Parameters:
-
removeAll - true if all items should be removed when shown,
false if not
setVisible
public void setVisible(boolean visible)
-
Description copied from class:
SubContributionManager
- Sets the visibility of the manager. If the visibility is
true
then each item within the manager appears within the parent manager.
Otherwise, the items are not visible.
-
-
Specified by:
-
setVisible
in interface
IContributionItem
-
Overrides:
-
setVisible
in class
SubContributionManager
-
-
Parameters:
-
visible - the new visibility
update
public void update()
-
Description copied from interface:
IContributionItem
- Updates any SWT controls cached by this contribution item with any
changes which have been made to this contribution item since the last update.
Called by contribution manager update methods.
-
-
Specified by:
-
update
in interface
IContributionItem
-
update
public void update(boolean force)
-
Description copied from interface:
IContributionManager
- Updates this manager's underlying widget(s) with any changes which
have been made to it or its items. Normally changes to a contribution
manager merely mark it as dirty, without updating the underlying widgets.
This brings the underlying widgets up to date with any changes.
-
-
Specified by:
-
update
in interface
IContributionManager
-
-
Parameters:
-
force - true means update even if not dirty,
and false for normal incremental updating
update
public void update(
String id)
-
Description copied from interface:
IContributionItem
- Updates any SWT controls cached by this contribution item with changes
for the the given property.
-
-
Specified by:
-
update
in interface
IContributionItem
-
-
Parameters:
-
id - the id of the changed property
updateAll
public void updateAll(boolean force)
-
Description copied from interface:
IMenuManager
- Incrementally builds the menu from the contribution items, and
does so recursively for all submenus.
-
-
Specified by:
-
updateAll
in interface
IMenuManager
-
-
Parameters:
-
force - true means update even if not dirty,
and false for normal incremental updating
wrapMenu
protected
SubMenuManager wrapMenu(
IMenuManager menu)
- Wraps a menu manager in a sub menu manager, and returns the new wrapper.
-
-
-
Parameters:
-
menu - the menu manager to wrap
-
Returns:
- the new wrapped menu manager
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.
|
|
|