Package org.eclipse.jface.action
Class ToolBarContributionItem
- java.lang.Object
-
- org.eclipse.jface.action.ContributionItem
-
- org.eclipse.jface.action.ToolBarContributionItem
-
- All Implemented Interfaces:
IContributionItem,org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
public class ToolBarContributionItem extends ContributionItem implements org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
TheToolBarContributionItemclass provides a wrapper for tool bar managers when used in cool bar managers. It extendsContributionItembut and provides some additional methods to customize the size of the cool item and to retrieve the underlying tool bar manager.This class may be instantiated; it is not intended to be subclassed.
- Since:
- 3.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static intSHOW_ALL_ITEMSA constant used bysetMinimumItemsToShowandgetMinimumItemsToShowto indicate that all tool items should be shown in the cool item.
-
Constructor Summary
Constructors Constructor Description ToolBarContributionItem()Convenience method equivalent toToolBarContributionItem(new ToolBarManager(), null).ToolBarContributionItem(IToolBarManager toolBarManager)Convenience method equivalent toToolBarContributionItem(toolBarManager, null).ToolBarContributionItem(IToolBarManager toolBarManager, String id)Creates a tool bar contribution item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()The default implementation of thisIContributionItemmethod does nothing.voidfill(CoolBar coolBar, int index)The default implementation of thisIContributionItemmethod does nothing.intgetCurrentHeight()Returns the current height of the corresponding cool item.intgetCurrentWidth()Returns the current width of the corresponding cool item.intgetMinimumItemsToShow()Returns the minimum number of tool items to show in the cool item.IToolBarManagergetToolBarManager()Returns the internal tool bar manager of the contribution item.booleangetUseChevron()Returns whether chevron support is enabled.booleanisVisible()A contribution item is visible iff its internal state is visible or the tool bar manager contains something other than group markers and separators.voidsaveWidgetState()The default implementation of thisIContributionItemmethod does nothing.voidsetCurrentHeight(int currentHeight)Sets the current height of the cool item.voidsetCurrentWidth(int currentWidth)Sets the current width of the cool item.voidsetMinimumItemsToShow(int minimumItemsToShow)Sets the minimum number of tool items to show in the cool item.voidsetUseChevron(boolean value)Enables or disables chevron support for the cool item.voidupdate(String propertyName)TheContributionItemimplementation of this method declared onIContributionItemdoes nothing.-
Methods inherited from class org.eclipse.jface.action.ContributionItem
fill, fill, fill, getId, getParent, isDirty, isDynamic, isEnabled, isGroupMarker, isSeparator, setId, setParent, setVisible, toString, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.jface.action.IContributionItem
fill, fill, fill, getId, isDirty, isDynamic, isEnabled, isGroupMarker, isSeparator, setParent, setVisible, update
-
-
-
-
Field Detail
-
SHOW_ALL_ITEMS
public static final int SHOW_ALL_ITEMS
A constant used bysetMinimumItemsToShowandgetMinimumItemsToShowto indicate that all tool items should be shown in the cool item.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ToolBarContributionItem
public ToolBarContributionItem()
Convenience method equivalent toToolBarContributionItem(new ToolBarManager(), null).
-
ToolBarContributionItem
public ToolBarContributionItem(IToolBarManager toolBarManager)
Convenience method equivalent toToolBarContributionItem(toolBarManager, null).- Parameters:
toolBarManager- the tool bar manager
-
ToolBarContributionItem
public ToolBarContributionItem(IToolBarManager toolBarManager, String id)
Creates a tool bar contribution item.- Parameters:
toolBarManager- the tool bar manager to wrapid- the contribution item id, ornullif none
-
-
Method Detail
-
dispose
public void dispose()
Description copied from class:ContributionItemThe default implementation of thisIContributionItemmethod does nothing. Subclasses may override.- Specified by:
disposein interfaceIContributionItem- Overrides:
disposein classContributionItem
-
fill
public void fill(CoolBar coolBar, int index)
Description copied from class:ContributionItemThe default implementation of thisIContributionItemmethod does nothing. Subclasses may override.- Specified by:
fillin interfaceIContributionItem- Overrides:
fillin classContributionItem- Parameters:
coolBar- the parent cool barindex- the index where the controls are inserted, or-1to insert at the end
-
getCurrentHeight
public int getCurrentHeight()
Returns the current height of the corresponding cool item.- Specified by:
getCurrentHeightin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Returns:
- the current height
-
getCurrentWidth
public int getCurrentWidth()
Returns the current width of the corresponding cool item.- Specified by:
getCurrentWidthin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Returns:
- the current size
-
getMinimumItemsToShow
public int getMinimumItemsToShow()
Returns the minimum number of tool items to show in the cool item.- Specified by:
getMinimumItemsToShowin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Returns:
- the minimum number of tool items to show, or
SHOW_ALL_ITEMSif a value was not set - See Also:
setMinimumItemsToShow(int)
-
getToolBarManager
public IToolBarManager getToolBarManager()
Returns the internal tool bar manager of the contribution item.- Specified by:
getToolBarManagerin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Returns:
- the tool bar manager, or
nullif one is not defined. - See Also:
IToolBarManager
-
getUseChevron
public boolean getUseChevron()
Returns whether chevron support is enabled.- Specified by:
getUseChevronin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Returns:
trueif chevron support is enabled,falseotherwise
-
isVisible
public boolean isVisible()
A contribution item is visible iff its internal state is visible or the tool bar manager contains something other than group markers and separators.- Specified by:
isVisiblein interfaceIContributionItem- Overrides:
isVisiblein classContributionItem- Returns:
trueif the tool bar manager contains something other than group marks and separators, and the internal state is set to be visible.
-
saveWidgetState
public void saveWidgetState()
Description copied from class:ContributionItemThe default implementation of thisIContributionItemmethod does nothing. Subclasses may override.- Specified by:
saveWidgetStatein interfaceIContributionItem- Overrides:
saveWidgetStatein classContributionItem
-
setCurrentHeight
public void setCurrentHeight(int currentHeight)
Sets the current height of the cool item. Update(SIZE) should be called to adjust the widget.- Specified by:
setCurrentHeightin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Parameters:
currentHeight- the current height to set
-
setCurrentWidth
public void setCurrentWidth(int currentWidth)
Sets the current width of the cool item. Update(SIZE) should be called to adjust the widget.- Specified by:
setCurrentWidthin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Parameters:
currentWidth- the current width to set
-
setMinimumItemsToShow
public void setMinimumItemsToShow(int minimumItemsToShow)
Sets the minimum number of tool items to show in the cool item. If this number is less than the total tool items, a chevron will appear and the hidden tool items appear in a drop down menu. By default, all the tool items are shown in the cool item.- Specified by:
setMinimumItemsToShowin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Parameters:
minimumItemsToShow- the minimum number of tool items to show.- See Also:
getMinimumItemsToShow(),setUseChevron(boolean)
-
setUseChevron
public void setUseChevron(boolean value)
Enables or disables chevron support for the cool item. By default, chevron support is enabled.- Specified by:
setUseChevronin interfaceorg.eclipse.jface.internal.provisional.action.IToolBarContributionItem- Parameters:
value-trueto enable chevron support,falseotherwise.
-
update
public void update(String propertyName)
Description copied from class:ContributionItemTheContributionItemimplementation of this method declared onIContributionItemdoes nothing. Subclasses should override to update their state.- Specified by:
updatein interfaceIContributionItem- Overrides:
updatein classContributionItem- Parameters:
propertyName- the id of the changed property
-
-