Package org.eclipse.jface.action
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
An abstract base implementation for contribution items.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a contribution item with anull
id.protected
Creates a contribution item with the given (optional) id. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
The default implementation of thisIContributionItem
method does nothing.void
The default implementation of thisIContributionItem
method does nothing.void
The default implementation of thisIContributionItem
method does nothing.void
The default implementation of thisIContributionItem
method does nothing.void
The default implementation of thisIContributionItem
method does nothing.getId()
Returns the identifier of this contribution item.Returns the parent contribution manager, ornull
if this contribution item is not currently added to a contribution manager.boolean
isDirty()
The default implementation of thisIContributionItem
method returnsfalse
.boolean
The default implementation of thisIContributionItem
method returnsfalse
.boolean
The default implementation of thisIContributionItem
method returnstrue
.boolean
The default implementation of thisIContributionItem
method returnsfalse
.boolean
The default implementation of thisIContributionItem
method returnsfalse
.boolean
The default implementation of thisIContributionItem
method returns the value recorded in an internal state variable, which istrue
by default.void
The default implementation of thisIContributionItem
method does nothing.void
The ID for this contribution item.void
setParent
(IContributionManager parent) Sets the parent manager of this itemvoid
setVisible
(boolean visible) The default implementation of thisIContributionItem
method stores the value in an internal state variable, which istrue
by default.toString()
Returns a string representation of this contribution item suitable only for debugging.void
update()
The default implementation of thisIContributionItem
method does nothing.void
TheContributionItem
implementation of this method declared onIContributionItem
does nothing.
-
Constructor Details
-
ContributionItem
protected ContributionItem()Creates a contribution item with anull
id. Callsthis(String)
withnull
. -
ContributionItem
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, ornull
-
-
Method Details
-
dispose
public void dispose()The default implementation of thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
dispose
in interfaceIContributionItem
-
fill
The default implementation of thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
fill
in interfaceIContributionItem
- Parameters:
parent
- the parent control
-
fill
The default implementation of thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
fill
in interfaceIContributionItem
- Parameters:
menu
- the parent menuindex
- the index where the controls are inserted, or-1
to insert at the end
-
fill
The default implementation of thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
fill
in interfaceIContributionItem
- Parameters:
parent
- the parent tool barindex
- the index where the controls are inserted, or-1
to insert at the end
-
fill
The default implementation of thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
fill
in interfaceIContributionItem
- Parameters:
parent
- the parent cool barindex
- 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 thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
saveWidgetState
in interfaceIContributionItem
- Since:
- 3.0
-
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 interfaceIContributionItem
- Returns:
- the contribution item identifier, or
null
if none
-
getParent
Returns the parent contribution manager, ornull
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 thisIContributionItem
method returnsfalse
. Subclasses may override.- Specified by:
isDirty
in interfaceIContributionItem
- Returns:
true
if this item is dirty
-
isEnabled
public boolean isEnabled()The default implementation of thisIContributionItem
method returnstrue
. Subclasses may override.- Specified by:
isEnabled
in interfaceIContributionItem
- Returns:
true
if this item is enabled
-
isDynamic
public boolean isDynamic()The default implementation of thisIContributionItem
method returnsfalse
. Subclasses may override.- Specified by:
isDynamic
in interfaceIContributionItem
- Returns:
true
if this item is dynamic, andfalse
for normal items
-
isGroupMarker
public boolean isGroupMarker()The default implementation of thisIContributionItem
method returnsfalse
. Subclasses may override.- Specified by:
isGroupMarker
in interfaceIContributionItem
- Returns:
true
if this item is a group marker, andfalse
for normal items- See Also:
-
isSeparator
public boolean isSeparator()The default implementation of thisIContributionItem
method returnsfalse
. Subclasses may override.- Specified by:
isSeparator
in interfaceIContributionItem
- Returns:
true
if this item is a separator, andfalse
for normal items- See Also:
-
isVisible
public boolean isVisible()The default implementation of thisIContributionItem
method returns the value recorded in an internal state variable, which istrue
by default.setVisible
should be used to change this setting.- Specified by:
isVisible
in interfaceIContributionItem
- Returns:
true
if this item is visible, andfalse
otherwise
-
setVisible
public void setVisible(boolean visible) The default implementation of thisIContributionItem
method stores the value in an internal state variable, which istrue
by default.- Specified by:
setVisible
in interfaceIContributionItem
- Parameters:
visible
-true
if this item should be visible, andfalse
otherwise
-
toString
Returns a string representation of this contribution item suitable only for debugging. -
update
public void update()The default implementation of thisIContributionItem
method does nothing. Subclasses may override.- Specified by:
update
in interfaceIContributionItem
-
setParent
Description copied from interface:IContributionItem
Sets the parent manager of this item- Specified by:
setParent
in interfaceIContributionItem
- Parameters:
parent
- the parent contribution manager
-
update
TheContributionItem
implementation of this method declared onIContributionItem
does nothing. Subclasses should override to update their state.- Specified by:
update
in interfaceIContributionItem
- Parameters:
id
- the id of the changed property
-
setId
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:
-