Eclipse Platform
Release 3.3

org.eclipse.ui.menus
Class CommandContributionItem

java.lang.Object
  extended byorg.eclipse.jface.action.ContributionItem
      extended byorg.eclipse.ui.menus.CommandContributionItem
All Implemented Interfaces:
IContributionItem

public final class CommandContributionItem
extends 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
static int STYLE_CHECK
          A checked tool item or menu item.
static int STYLE_PULLDOWN
          A ToolBar pulldown item.
static int STYLE_PUSH
          A push button tool item or menu item.
static int STYLE_RADIO
          A radio-button style menu item.
 
Constructor Summary
CommandContributionItem(IServiceLocator serviceLocator, String id, String commandId, Map parameters, ImageDescriptor icon, ImageDescriptor disabledIcon, ImageDescriptor hoverIcon, String label, String mnemonic, String tooltip, int style)
          Create a CommandContributionItem to place in a ContributionManager.
 
Method Summary
 void dispose()
          The default implementation of this IContributionItem method does nothing.
 void fill(Menu parent, int index)
          The default implementation of this IContributionItem method does nothing.
 void fill(ToolBar parent, int index)
          The default implementation of this IContributionItem method does nothing.
 boolean isEnabled()
          The default implementation of this IContributionItem method returns true.
 void update()
          The default implementation of this IContributionItem method does nothing.
 void update(String id)
          The ContributionItem implementation of this method declared on IContributionItem does nothing.
 
Methods inherited from class org.eclipse.jface.action.ContributionItem
fill, fill, getId, getParent, isDirty, isDynamic, isGroupMarker, isSeparator, isVisible, saveWidgetState, setParent, setVisible, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STYLE_PUSH

public static final int STYLE_PUSH
A push button tool item or menu item.

See Also:
Constant Field Values

STYLE_CHECK

public static final int STYLE_CHECK
A checked tool item or menu item.

See Also:
Constant Field Values

STYLE_RADIO

public static final int STYLE_RADIO
A radio-button style menu item.

See Also:
Constant Field Values

STYLE_PULLDOWN

public static final int STYLE_PULLDOWN
A ToolBar pulldown item.

See Also:
Constant Field Values
Constructor Detail

CommandContributionItem

public CommandContributionItem(IServiceLocator serviceLocator,
                               String id,
                               String commandId,
                               Map parameters,
                               ImageDescriptor icon,
                               ImageDescriptor disabledIcon,
                               ImageDescriptor hoverIcon,
                               String label,
                               String mnemonic,
                               String tooltip,
                               int style)
Create a CommandContributionItem to place in a ContributionManager.

Parameters:
serviceLocator - a service locator that is most appropriate for this contribution. Typically the local IWorkbenchWindow or IWorkbenchPartSite will be sufficient.
id - The id for this item. May be null. Items without an id cannot be referenced later.
commandId - A command id for a defined command. Must not be null.
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 be null.
disabledIcon - A disabled icon for this item. May be null.
hoverIcon - A hover icon for this item. May be null.
label - A label for this item. May be null.
mnemonic - A mnemonic for this item to be applied to the label. May be null.
tooltip - A tooltip for this item. May be null. Tooltips are currently only valid for toolbar contributions.
style - The style of this menu contribution. See the STYLE_* contants.
Method Detail

fill

public void fill(Menu parent,
                 int index)
Description copied from class: ContributionItem
The default implementation of this IContributionItem method does nothing. Subclasses may override.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem

fill

public void fill(ToolBar parent,
                 int index)
Description copied from class: ContributionItem
The default implementation of this IContributionItem method does nothing. Subclasses may override.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem

update

public void update()
Description copied from class: ContributionItem
The default implementation of this IContributionItem method does nothing. Subclasses may override.

Specified by:
update in interface IContributionItem
Overrides:
update in class ContributionItem

update

public void update(String id)
Description copied from class: ContributionItem
The ContributionItem implementation of this method declared on IContributionItem does nothing. Subclasses should override to update their state.

Specified by:
update in interface IContributionItem
Overrides:
update in class ContributionItem

dispose

public void dispose()
Description copied from class: ContributionItem
The default implementation of this IContributionItem method does nothing. Subclasses may override.

Specified by:
dispose in interface IContributionItem
Overrides:
dispose in class ContributionItem

isEnabled

public boolean isEnabled()
Description copied from class: ContributionItem
The default implementation of this IContributionItem method returns true. Subclasses may override.

Specified by:
isEnabled in interface IContributionItem
Overrides:
isEnabled in class ContributionItem

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.