Class ContributionItem

java.lang.Object
org.eclipse.jface.action.ContributionItem
All Implemented Interfaces:
IContributionItem
Direct Known Subclasses:
AbstractContributionItem, AbstractGroupMarker, ActionContributionItem, ActionSetSeparator, CommandContributionItem, CompoundContributionItem, ControlContribution, OpenWithMenu, PerspectiveMenu, ReopenEditorMenu, ShowInMenu, ShowViewMenu, StatusLineContributionItem, StatusLineContributionItem, SwitchToWindowMenu, ToolBarContributionItem, WorkingSetMenuContributionItem

public abstract class ContributionItem extends Object implements IContributionItem
An abstract base implementation for contribution items.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a contribution item with a null id.
    protected
    Creates a contribution item with the given (optional) id.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The default implementation of this IContributionItem method does nothing.
    void
    fill(Composite parent)
    The default implementation of this IContributionItem method does nothing.
    void
    fill(CoolBar parent, int index)
    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.
    Returns the identifier of this contribution item.
    Returns the parent contribution manager, or null if this contribution item is not currently added to a contribution manager.
    boolean
    The default implementation of this IContributionItem method returns false.
    boolean
    The default implementation of this IContributionItem method returns false.
    boolean
    The default implementation of this IContributionItem method returns true.
    boolean
    The default implementation of this IContributionItem method returns false.
    boolean
    The default implementation of this IContributionItem method returns false.
    boolean
    The default implementation of this IContributionItem method returns the value recorded in an internal state variable, which is true by default.
    void
    The default implementation of this IContributionItem method does nothing.
    void
    setId(String itemId)
    The ID for this contribution item.
    void
    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.
    Returns a string representation of this contribution item suitable only for debugging.
    void
    The default implementation of this IContributionItem method does nothing.
    void
    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 Details

    • 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 Details

    • dispose

      public void dispose()
      The default implementation of this IContributionItem method does nothing. Subclasses may override.
      Specified by:
      dispose in interface IContributionItem
    • 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
    • fill

      public void fill(CoolBar 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 cool bar
      index - the index where the controls are inserted, or -1 to insert at the end
      Since:
      3.0
    • saveWidgetState

      public void saveWidgetState()
      The default implementation of this IContributionItem method does nothing. Subclasses may override.
      Specified by:
      saveWidgetState in interface IContributionItem
      Since:
      3.0
    • 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, or null if this contribution item is not currently added to a contribution manager.
      Returns:
      the parent contribution manager, or null
      Since:
      2.0
    • isDirty

      public boolean isDirty()
      The default implementation of this IContributionItem method returns false. Subclasses may override.
      Specified by:
      isDirty in interface IContributionItem
      Returns:
      true if this item is dirty
    • isEnabled

      public boolean isEnabled()
      The default implementation of this IContributionItem method returns true. Subclasses may override.
      Specified by:
      isEnabled in interface IContributionItem
      Returns:
      true if this item is enabled
    • 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:
    • 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:
    • 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
      Parameters:
      id - the id of the changed property
    • setId

      public void setId(String itemId)
      The ID for this contribution item. It should be set once either in the constructor or using this method.
      Parameters:
      itemId - new item id
      Since:
      3.4
      See Also: