Class CommandContributionItem
java.lang.Object
org.eclipse.jface.action.ContributionItem
org.eclipse.ease.ui.scripts.keywordhandler.CommandContributionItem
- All Implemented Interfaces:
org.eclipse.jface.action.IContributionItem
- Direct Known Subclasses:
ScriptContributionItem
public class CommandContributionItem
extends org.eclipse.jface.action.ContributionItem
A contribution item which delegates to a command. It can be used in
AbstractContributionFactory.createContributionItems(IServiceLocator, IContributionRoot).
It currently supports placement in menus and toolbars.
This class may be instantiated; it is not intended to be subclassed.
- Since:
- 3.3
-
Field Summary
Fields Modifier and Type Field Description static intMODE_FORCE_TEXTMode bit: Show text on tool items or buttons, even if an image is present.static intSTYLE_CHECKA checked tool item or menu item.static intSTYLE_PULLDOWNA ToolBar pulldown item.static intSTYLE_PUSHA push button tool item or menu item.static intSTYLE_RADIOA radio-button style menu item. -
Constructor Summary
Constructors Constructor Description CommandContributionItem(org.eclipse.ui.menus.CommandContributionItemParameter contributionParameters)Create a CommandContributionItem to place in a ContributionManager.CommandContributionItem(org.eclipse.ui.services.IServiceLocator serviceLocator, String id, String commandId, Map parameters, org.eclipse.jface.resource.ImageDescriptor icon, org.eclipse.jface.resource.ImageDescriptor disabledIcon, org.eclipse.jface.resource.ImageDescriptor hoverIcon, String label, String mnemonic, String tooltip, int style)Deprecated. -
Method Summary
Modifier and Type Method Description voiddispose()voidfill(org.eclipse.swt.widgets.Composite parent)voidfill(org.eclipse.swt.widgets.Menu parent, int index)voidfill(org.eclipse.swt.widgets.ToolBar parent, int index)org.eclipse.core.commands.ParameterizedCommandgetCommand()Returns the ParameterizedCommand for this contribution.org.eclipse.ui.menus.CommandContributionItemParametergetData()Provide info on the rendering data contained in this item.booleanisEnabled()booleanisVisible()voidsetIcon(org.eclipse.jface.resource.ImageDescriptor desc)voidsetLabel(String label)voidsetParent(org.eclipse.jface.action.IContributionManager parent)voidupdate()voidupdate(String id)Methods inherited from class org.eclipse.jface.action.ContributionItem
fill, getId, getParent, isDirty, isDynamic, isGroupMarker, isSeparator, saveWidgetState, setId, setVisible, toString
-
Field Details
-
STYLE_PUSH
public static final int STYLE_PUSHA push button tool item or menu item.- See Also:
- Constant Field Values
-
STYLE_CHECK
public static final int STYLE_CHECKA checked tool item or menu item.- See Also:
- Constant Field Values
-
STYLE_RADIO
public static final int STYLE_RADIOA radio-button style menu item.- See Also:
- Constant Field Values
-
STYLE_PULLDOWN
public static final int STYLE_PULLDOWNA ToolBar pulldown item.- See Also:
- Constant Field Values
-
MODE_FORCE_TEXT
public static int MODE_FORCE_TEXTMode bit: Show text on tool items or buttons, even if an image is present. If this mode bit is not set, text is only shown on tool items if there is no image present.- Since:
- 3.4
-
-
Constructor Details
-
CommandContributionItem
@Deprecated public CommandContributionItem(org.eclipse.ui.services.IServiceLocator serviceLocator, String id, String commandId, Map parameters, org.eclipse.jface.resource.ImageDescriptor icon, org.eclipse.jface.resource.ImageDescriptor disabledIcon, org.eclipse.jface.resource.ImageDescriptor hoverIcon, String label, String mnemonic, String tooltip, int style)Deprecated.create theCommandContributionItemParameterCreate a CommandContributionItem to place in a ContributionManager.- Parameters:
serviceLocator- a service locator that is most appropriate for this contribution. Typically the localIWorkbenchWindoworIWorkbenchPartSitewill be sufficient.id- The id for this item. May benull. Items without an id cannot be referenced later.commandId- A command id for a defined command. Must not benull.parameters- A map of strings to strings which represent parameter names to values. The parameter names must match those in the command definition.icon- An icon for this item. May benull.disabledIcon- A disabled icon for this item. May benull.hoverIcon- A hover icon for this item. May benull.label- A label for this item. May benull.mnemonic- A mnemonic for this item to be applied to the label. May benull.tooltip- A tooltip for this item. May benull. Tooltips are currently only valid for toolbar contributions.style- The style of this menu contribution. See the STYLE_* constants.
-
Method Details
-
getCommand
public org.eclipse.core.commands.ParameterizedCommand getCommand()Returns the ParameterizedCommand for this contribution.NOTE: The returned object should be treated as 'read-only', do not execute this instance or attempt to modify its state.
- Returns:
- The parameterized command for this contribution.
- Since:
- 3.5
-
fill
public void fill(org.eclipse.swt.widgets.Menu parent, int index)- Specified by:
fillin interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
fillin classorg.eclipse.jface.action.ContributionItem
-
fill
public void fill(org.eclipse.swt.widgets.Composite parent)- Specified by:
fillin interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
fillin classorg.eclipse.jface.action.ContributionItem
-
fill
public void fill(org.eclipse.swt.widgets.ToolBar parent, int index)- Specified by:
fillin interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
fillin classorg.eclipse.jface.action.ContributionItem
-
update
public void update()- Specified by:
updatein interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
updatein classorg.eclipse.jface.action.ContributionItem
-
update
- Specified by:
updatein interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
updatein classorg.eclipse.jface.action.ContributionItem
-
setParent
public void setParent(org.eclipse.jface.action.IContributionManager parent)- Specified by:
setParentin interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
setParentin classorg.eclipse.jface.action.ContributionItem
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
disposein classorg.eclipse.jface.action.ContributionItem
-
setIcon
public void setIcon(org.eclipse.jface.resource.ImageDescriptor desc) -
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
isEnabledin classorg.eclipse.jface.action.ContributionItem
-
isVisible
public boolean isVisible()- Specified by:
isVisiblein interfaceorg.eclipse.jface.action.IContributionItem- Overrides:
isVisiblein classorg.eclipse.jface.action.ContributionItem- Since:
- 3.4
-
getData
public org.eclipse.ui.menus.CommandContributionItemParameter getData()Provide info on the rendering data contained in this item.- Returns:
- a
CommandContributionItemParameter. Valid fields are serviceLocator, id, style, icon, disabledIcon, hoverIcon, label, helpContextId, mnemonic, tooltip. The Object will never benull, although any of the fields may benull. - Since:
- 3.100
-
setLabel
-
CommandContributionItemParameter