Class PopupMenuExtender
- All Implemented Interfaces:
EventListener
,IRegistryChangeListener
,IMenuListener
,IMenuListener2
-
Constructor Summary
ConstructorDescriptionPopupMenuExtender
(String id, MenuManager menu, ISelectionProvider prov, IWorkbenchPart part, IEclipseContext context) Construct a new menu extender.PopupMenuExtender
(String id, MenuManager menu, ISelectionProvider prov, IWorkbenchPart part, IEclipseContext context, boolean includeEditorInput) Construct a new menu extender. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Adds another menu identifier to this extender.void
dispose()
Dispose of the menu extender.Return the menu identifiers for this extender.final boolean
matches
(MenuManager menuManager, ISelectionProvider selectionProvider, IWorkbenchPart part) Determines whether this extender would be the same as another extender created with the given values.final void
Notifies the listener that the menu is about to be hidden.void
Notifies the listener that the menu is about to be shown.void
Notifies this listener that some registry changes are happening, or have already happened.
-
Constructor Details
-
PopupMenuExtender
public PopupMenuExtender(String id, MenuManager menu, ISelectionProvider prov, IWorkbenchPart part, IEclipseContext context) Construct a new menu extender.- Parameters:
id
- the menu idmenu
- the menu to extendprov
- the selection providerpart
- the part to extendcontext
- the context to create the child popup menu context under
-
PopupMenuExtender
public PopupMenuExtender(String id, MenuManager menu, ISelectionProvider prov, IWorkbenchPart part, IEclipseContext context, boolean includeEditorInput) Construct a new menu extender.- Parameters:
id
- the menu idmenu
- the menu to extendprov
- the selection providerpart
- the part to extendcontext
- the context to create the child popup menu context underincludeEditorInput
- Whether the editor input should be included when adding object contributions to this context menu.
-
-
Method Details
-
getMenuIds
Return the menu identifiers for this extender.- Returns:
- The set of all identifiers that represent this extender.
-
addMenuId
Adds another menu identifier to this extender. An extender can represent many menu identifiers. These identifiers should represent the same menu manager, selection provider and part. Duplicate identifiers are automatically ignored.
For example, it is necessary to filter out duplicate identifiers for
CompilationUnitEditor
instances, as these define both"#CompilationUnitEditorContext"
and"org.eclipse.jdt.ui.CompilationUnitEditor.EditorContext"
as menu identifier for the same pop-up menu. We don't want to contribute duplicate items in this case.- Parameters:
menuId
- The menu identifier to add to this extender; should not benull
.
-
matches
public final boolean matches(MenuManager menuManager, ISelectionProvider selectionProvider, IWorkbenchPart part) Determines whether this extender would be the same as another extender created with the given values. Two extenders are equivalent if they have the same menu manager, selection provider and part (i.e., if the menu they represent is about to show, they would populate it with duplicate values).- Parameters:
menuManager
- The menu manager with which to compare; may benull
.selectionProvider
- The selection provider with which to compare; may benull
.part
- The part with which to compare; may benull
.- Returns:
true
if the menu manager, selection provider and part are all the same.
-
dispose
public void dispose()Dispose of the menu extender. Should only be called when the part is disposed. -
registryChanged
Description copied from interface:IRegistryChangeListener
Notifies this listener that some registry changes are happening, or have already happened.The supplied event gives details. This event object (and the deltas in it) is valid only for the duration of the invocation of this method.
Note: This method is called by the platform; it is not intended to be called directly by clients.
- Specified by:
registryChanged
in interfaceIRegistryChangeListener
- Parameters:
event
- the registry change event- See Also:
-
getManager
-