Class PopupMenuExtender
- All Implemented Interfaces:
EventListener,IRegistryChangeListener,IMenuListener,IMenuListener2
-
Constructor Summary
ConstructorsConstructorDescriptionPopupMenuExtender(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 voidAdds another menu identifier to this extender.voiddispose()Dispose of the menu extender.Return the menu identifiers for this extender.final booleanmatches(MenuManager menuManager, ISelectionProvider selectionProvider, IWorkbenchPart part) Determines whether this extender would be the same as another extender created with the given values.final voidNotifies the listener that the menu is about to be hidden.voidNotifies the listener that the menu is about to be shown.voidNotifies 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
CompilationUnitEditorinstances, 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:
trueif 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:IRegistryChangeListenerNotifies 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:
registryChangedin interfaceIRegistryChangeListener- Parameters:
event- the registry change event- See Also:
-
getManager
-