Eclipse Platform
2.0

org.eclipse.jface.action
Interface IContributionItem

All Known Subinterfaces:
IMenuManager
All Known Implementing Classes:
ContributionItem, MenuManager, SubContributionItem, SubMenuManager

public interface IContributionItem

A contribution item represents a contribution to a shared UI resource such as a menu or tool bar. More generally, contribution items are managed by a contribution manager. For instance, in a tool bar a contribution item is a tool bar button or a separator. In a menu bar a contribution item is a menu, and in a menu a contribution item is a menu item or separator.

A contribution item can realize itself in different SWT widgets, using the different fill methods. The same type of contribution item can be used with a MenuBarManager, ToolBarManager, or a StatusLineManager.

This interface is internal to the framework; it should not be implemented outside the framework.

See Also:
IContributionManager

Method Summary
 void fill(Composite parent)
          Fills the given composite control with controls representing this contribution item.
 void fill(Menu parent, int index)
          Fills the given menu with controls representing this contribution item.
 void fill(ToolBar parent, int index)
          Fills the given tool bar with controls representing this contribution item.
 String getId()
          Returns the identifier of this contribution item.
 boolean isDynamic()
          Returns whether this contribution item is dynamic.
 boolean isGroupMarker()
          Returns whether this contribution item is a group marker.
 boolean isSeparator()
          Returns whether this contribution item is a separator.
 boolean isVisible()
          Returns whether this contribution item is visibile within its manager.
 void setParent(IContributionManager parent)
          Sets the parent manager of this item
 void setVisible(boolean visible)
          Sets whether this contribution item is visibile within its manager.
 void update()
          Updates any SWT controls cached by this contribution item with any changes which have been made to this contribution item since the last update.
 void update(String id)
          Updates any SWT controls cached by this contribution item with changes for the the given property.
 

Method Detail

fill

public void fill(Composite parent)
Fills the given composite control with controls representing this contribution item. Used by StatusLineManager.

Parameters:
parent - the parent control

fill

public void fill(Menu parent,
                 int index)
Fills the given menu with controls representing this contribution item. Used by MenuManager.

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)
Fills the given tool bar with controls representing this contribution item. Used by ToolBarManager.

Parameters:
parent - the parent tool bar
index - the index where the controls are inserted, or -1 to insert at the end

getId

public String getId()
Returns the identifier of this contribution item. The id is used for retrieving an item from its manager.

Returns:
the contribution item identifier, or null if none

isDynamic

public boolean isDynamic()
Returns whether this contribution item is dynamic. A dynamic contribution item contributes items conditionally, dependent on some internal state.

Returns:
true if this item is dynamic, and false for normal items

isGroupMarker

public boolean isGroupMarker()
Returns whether this contribution item is a group marker. This information is used when adding items to a group.

Returns:
true if this item is a group marker, and false for normal items
See Also:
GroupMarker, IContributionManager.appendToGroup(java.lang.String, org.eclipse.jface.action.IAction), IContributionManager.prependToGroup(java.lang.String, org.eclipse.jface.action.IAction)

isSeparator

public boolean isSeparator()
Returns whether this contribution item is a separator. This information is used to enable hiding of unnecessary separators.

Returns:
true if this item is a separator, and false for normal items
See Also:
Separator

isVisible

public boolean isVisible()
Returns whether this contribution item is visibile within its manager.

Returns:
true if this item is visible, and false otherwise

setParent

public void setParent(IContributionManager parent)
Sets the parent manager of this item

Parameters:
parent - the parent contribution manager
Since:
2.0

setVisible

public void setVisible(boolean visible)
Sets whether this contribution item is visibile within its manager.

Parameters:
visible - true if this item should be visible, and false otherwise

update

public void update()
Updates any SWT controls cached by this contribution item with any changes which have been made to this contribution item since the last update. Called by contribution manager update methods.


update

public void update(String id)
Updates any SWT controls cached by this contribution item with changes for the the given property.

Since:
2.0

Eclipse Platform
2.0

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