Package org.eclipse.ui.internal
Class ShowInMenu
java.lang.Object
org.eclipse.jface.action.ContributionItem
org.eclipse.ui.internal.ShowInMenu
- All Implemented Interfaces:
IContributionItem
,IWorkbenchContribution
A
ShowInMenu
is used to populate a menu manager with Show In
actions. The items to show are determined from the active perspective and
active part.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
The default implementation of thisIContributionItem
method does nothing.void
The default implementation of thisIContributionItem
method does nothing.protected ShowInContext
getContext
(IWorkbenchPart sourcePart) Returns theShowInContext
to show in the selected target, ornull
if there is no valid context to show.protected IContributionItem
getContributionItem
(IViewDescriptor viewDescriptor) Return the appropriate command contribution item for the parameter.protected IWorkbenchPart
Returns the source part, ornull
if there is no applicable source partprotected IWorkbenchWindow
void
initialize
(IServiceLocator serviceLocator) The service locator for this contribution.boolean
isDirty()
The default implementation of thisIContributionItem
method returnsfalse
.boolean
Overridden to always return true and force dynamic menu building.Methods inherited from class org.eclipse.jface.action.ContributionItem
fill, fill, fill, getId, getParent, isEnabled, isGroupMarker, isSeparator, isVisible, saveWidgetState, setId, setParent, setVisible, toString, update, update
-
Constructor Details
-
ShowInMenu
public ShowInMenu() -
ShowInMenu
Creates a Show In menu.- Parameters:
window
- the window containing the menuid
- The ID for this contribution
-
-
Method Details
-
isDirty
public boolean isDirty()Description copied from class:ContributionItem
The default implementation of thisIContributionItem
method returnsfalse
. Subclasses may override.- Specified by:
isDirty
in interfaceIContributionItem
- Overrides:
isDirty
in classContributionItem
- Returns:
true
if this item is dirty
-
isDynamic
public boolean isDynamic()Overridden to always return true and force dynamic menu building.- Specified by:
isDynamic
in interfaceIContributionItem
- Overrides:
isDynamic
in classContributionItem
- Returns:
true
if this item is dynamic, andfalse
for normal items
-
fill
Description copied from class:ContributionItem
The default implementation of thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
fill
in interfaceIContributionItem
- Overrides:
fill
in classContributionItem
- Parameters:
menu
- the parent menuindex
- the index where the controls are inserted, or-1
to insert at the end
-
getContributionItem
Return the appropriate command contribution item for the parameter.- Returns:
- the show in command contribution item
-
getSourcePart
Returns the source part, ornull
if there is no applicable source partThis implementation returns the current part in the window. Subclasses may extend or reimplement.
- Returns:
- the source part or
null
-
getContext
Returns theShowInContext
to show in the selected target, ornull
if there is no valid context to show.This implementation obtains the context from the
IShowInSource
of the source part (if provided), or, if the source part is an editor, it creates the context from the editor's input and selection.Subclasses may extend or reimplement.
- Returns:
- the
ShowInContext
to show ornull
-
initialize
Description copied from interface:IWorkbenchContribution
The service locator for this contribution. It will potentially exist longer than the lifecycle of this specific contribution, so ContributionItems should remove themselves from any listeners or services in their dispose() calls.- Specified by:
initialize
in interfaceIWorkbenchContribution
- Parameters:
serviceLocator
- the locator which services can be retrieved. Will not benull
-
getWindow
-
dispose
public void dispose()Description copied from class:ContributionItem
The default implementation of thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
dispose
in interfaceIContributionItem
- Overrides:
dispose
in classContributionItem
-