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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()The default implementation of thisIContributionItemmethod does nothing.voidThe default implementation of thisIContributionItemmethod does nothing.protected ShowInContextgetContext(IWorkbenchPart sourcePart) Returns theShowInContextto show in the selected target, ornullif there is no valid context to show.protected IContributionItemgetContributionItem(IViewDescriptor viewDescriptor) Return the appropriate command contribution item for the parameter.protected IWorkbenchPartReturns the source part, ornullif there is no applicable source partprotected IWorkbenchWindowvoidinitialize(IServiceLocator serviceLocator) The service locator for this contribution.booleanisDirty()The default implementation of thisIContributionItemmethod returnsfalse.booleanOverridden 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:ContributionItemThe default implementation of thisIContributionItemmethod returnsfalse. Subclasses may override.- Specified by:
isDirtyin interfaceIContributionItem- Overrides:
isDirtyin classContributionItem- Returns:
trueif this item is dirty
-
isDynamic
public boolean isDynamic()Overridden to always return true and force dynamic menu building.- Specified by:
isDynamicin interfaceIContributionItem- Overrides:
isDynamicin classContributionItem- Returns:
trueif this item is dynamic, andfalsefor normal items
-
fill
Description copied from class:ContributionItemThe default implementation of thisIContributionItemmethod does nothing. Subclasses may override.- Specified by:
fillin interfaceIContributionItem- Overrides:
fillin classContributionItem- Parameters:
menu- the parent menuindex- the index where the controls are inserted, or-1to 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, ornullif 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 theShowInContextto show in the selected target, ornullif there is no valid context to show.This implementation obtains the context from the
IShowInSourceof 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
ShowInContextto show ornull
-
initialize
Description copied from interface:IWorkbenchContributionThe 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:
initializein interfaceIWorkbenchContribution- Parameters:
serviceLocator- the locator which services can be retrieved. Will not benull
-
getWindow
-
dispose
public void dispose()Description copied from class:ContributionItemThe default implementation of thisIContributionItemmethod does nothing. Subclasses may override.- Specified by:
disposein interfaceIContributionItem- Overrides:
disposein classContributionItem
-