Eclipse Platform
2.0

org.eclipse.jface.action
Class ContributionItem

java.lang.Object
  |
  +--org.eclipse.jface.action.ContributionItem
All Implemented Interfaces:
IContributionItem
Direct Known Subclasses:
AbstractGroupMarker, ActionContributionItem, ControlContribution, OpenWithMenu, PerspectiveMenu, StatusLineContributionItem

public abstract class ContributionItem
extends Object
implements IContributionItem

An abstract base implementation for contribution items.


Constructor Summary
protected ContributionItem()
          Creates a contribution item with a null id.
protected ContributionItem(String id)
          Creates a contribution item with the given (optional) id.
 
Method Summary
 void fill(Composite parent)
          The default implementation of this IContributionItem method does nothing.
 void fill(Menu menu, 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.
 String getId()
          Returns the identifier of this contribution item.
 IContributionManager getParent()
          Returns the parent contribution manager.
 boolean isDynamic()
          The default implementation of this IContributionItem method returns false.
 boolean isGroupMarker()
          The default implementation of this IContributionItem method returns false.
 boolean isSeparator()
          The default implementation of this IContributionItem method returns false.
 boolean isVisible()
          The default implementation of this IContributionItem method returns the value recorded in an internal state variable, which is true by default.
 void setParent(IContributionManager parent)
          Sets the parent manager of this item
 void setVisible(boolean visible)
          The default implementation of this IContributionItem method stores the value in an internal state variable, which is true by default.
 String toString()
          Returns a string representation of this contribution item suitable only for debugging.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContributionItem

protected ContributionItem()
Creates a contribution item with a null id. Calls this(String) with null.


ContributionItem

protected ContributionItem(String id)
Creates a contribution item with the given (optional) id. The given id is used to find items in a contribution manager, and for positioning items relative to other items.

Parameters:
id - the contribution item identifier, or null
Method Detail

fill

public void fill(Composite parent)
The default implementation of this IContributionItem method does nothing. Subclasses may override.

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

fill

public void fill(Menu menu,
                 int index)
The default implementation of this IContributionItem method does nothing. Subclasses may override.

Specified by:
fill in interface IContributionItem
Parameters:
menu - 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 default implementation of this IContributionItem method does nothing. Subclasses may override.

Specified by:
fill in interface IContributionItem
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()
Description copied from interface: IContributionItem
Returns the identifier of this contribution item. The id is used for retrieving an item from its manager.

Specified by:
getId in interface IContributionItem
Returns:
the contribution item identifier, or null if none

getParent

public IContributionManager getParent()
Returns the parent contribution manager.

Returns:
the parent contribution manager
Since:
2.0

isDynamic

public boolean isDynamic()
The default implementation of this IContributionItem method returns false. Subclasses may override.

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

isGroupMarker

public boolean isGroupMarker()
The default implementation of this IContributionItem method returns false. Subclasses may override.

Specified by:
isGroupMarker in interface IContributionItem
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()
The default implementation of this IContributionItem method returns false. Subclasses may override.

Specified by:
isSeparator in interface IContributionItem
Returns:
true if this item is a separator, and false for normal items
See Also:
Separator

isVisible

public boolean isVisible()
The default implementation of this IContributionItem method returns the value recorded in an internal state variable, which is true by default. setVisible should be used to change this setting.

Specified by:
isVisible in interface IContributionItem
Returns:
true if this item is visible, and false otherwise

setVisible

public void setVisible(boolean visible)
The default implementation of this IContributionItem method stores the value in an internal state variable, which is true by default.

Specified by:
setVisible in interface IContributionItem
Parameters:
visible - true if this item should be visible, and false otherwise

toString

public String toString()
Returns a string representation of this contribution item suitable only for debugging.

Overrides:
toString in class Object

update

public void update()
The default implementation of this IContributionItem method does nothing. Subclasses may override.

Specified by:
update in interface IContributionItem

setParent

public void setParent(IContributionManager parent)
Description copied from interface: IContributionItem
Sets the parent manager of this item

Specified by:
setParent in interface IContributionItem
Parameters:
parent - the parent contribution manager

update

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

Specified by:
update in interface IContributionItem

Eclipse Platform
2.0

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