Eclipse Platform
2.0

org.eclipse.jface.action
Class ActionContributionItem

java.lang.Object
  |
  +--org.eclipse.jface.action.ContributionItem
        |
        +--org.eclipse.jface.action.ActionContributionItem
All Implemented Interfaces:
IContributionItem

public class ActionContributionItem
extends ContributionItem

A contribution item which delegates to an action.

This class may be instantiated; it is not intended to be subclassed.


Constructor Summary
ActionContributionItem(IAction action)
          Creates a new contribution item from the given action.
 
Method Summary
 boolean equals(Object o)
          Compares this action contribution item with another object.
 void fill(Composite parent)
          The ActionContributionItem implementation of this IContributionItem method creates a SWT Button for the action.
 void fill(Menu parent, int index)
          The ActionContributionItem implementation of this IContributionItem method creates a SWT MenuItem for the action.
 void fill(ToolBar parent, int index)
          The ActionContributionItem implementation of this IContributionItem method creates a SWT ToolItem for the action.
 IAction getAction()
          Returns the action associated with this contribution item.
 int hashCode()
           
 boolean isDynamic()
          The action item implementation of this IContributionItem method returns true for menu items and false for everything else.
protected  boolean isEnabledAllowed()
          Returns true if this item is allowed to enable, false otherwise.
 void update()
          The action item implementation of this IContributionItem method calls update(null).
 void update(String propertyName)
          Synchronizes the UI with the given property.
 
Methods inherited from class org.eclipse.jface.action.ContributionItem
getId, getParent, isGroupMarker, isSeparator, isVisible, setParent, setVisible, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActionContributionItem

public ActionContributionItem(IAction action)
Creates a new contribution item from the given action. The id of the action is used as the id of the item.

Parameters:
action - the action
Method Detail

equals

public boolean equals(Object o)
Compares this action contribution item with another object. Two action contribution items are equal if they refer to the identical Action.

Overrides:
equals in class Object

fill

public void fill(Composite parent)
The ActionContributionItem implementation of this IContributionItem method creates a SWT Button for the action. If the action's checked property has been set, a toggle button is created and primed to the value of the checked property.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem
Parameters:
parent - the parent control

fill

public void fill(Menu parent,
                 int index)
The ActionContributionItem implementation of this IContributionItem method creates a SWT MenuItem for the action. If the action's checked property has been set, a toggle button is created and primed to the value of the checked property. If the action's menu creator property has been set, a cascading submenu is created.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem
Parameters:
parent - the parent menu
index - the index where the controls are inserted, or -1 to insert at the end

fill

public void fill(ToolBar parent,
                 int index)
The ActionContributionItem implementation of this IContributionItem method creates a SWT ToolItem for the action. If the action's checked property has been set, a toggle button is created and primed to the value of the checked property. If the action's menu creator property has been set, a drop-down tool item is created.

Specified by:
fill in interface IContributionItem
Overrides:
fill in class ContributionItem
Parameters:
parent - the parent tool bar
index - the index where the controls are inserted, or -1 to insert at the end

getAction

public IAction getAction()
Returns the action associated with this contribution item.

Returns:
the action

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isDynamic

public boolean isDynamic()
The action item implementation of this IContributionItem method returns true for menu items and false for everything else.

Specified by:
isDynamic in interface IContributionItem
Overrides:
isDynamic in class ContributionItem
Returns:
true if this item is dynamic, and false for normal items

isEnabledAllowed

protected boolean isEnabledAllowed()
Returns true if this item is allowed to enable, false otherwise.

Returns:
if this item is allowed to be enabled
Since:
2.0

update

public final void update()
The action item implementation of this IContributionItem method calls update(null).

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

update

public void update(String propertyName)
Synchronizes the UI with the given property.

Specified by:
update in interface IContributionItem
Overrides:
update in class ContributionItem
Parameters:
propertyName - the name of the property, or null meaning all applicable properties

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.