public class ToolBarContributionItem extends ContributionItem implements org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
ToolBarContributionItem
class provides a wrapper for tool
bar managers when used in cool bar managers. It extends ContributionItem
but 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.
Modifier and Type | Field and Description |
---|---|
static int |
SHOW_ALL_ITEMS
A constant used by
setMinimumItemsToShow and getMinimumItemsToShow
to indicate that all tool items should be shown in the cool item. |
Constructor and Description |
---|
ToolBarContributionItem()
Convenience method equivalent to
ToolBarContributionItem(new ToolBarManager(), null) . |
ToolBarContributionItem(IToolBarManager toolBarManager)
Convenience method equivalent to
ToolBarContributionItem(toolBarManager, null) . |
ToolBarContributionItem(IToolBarManager toolBarManager,
String id)
Creates a tool bar contribution item.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
The default implementation of this
IContributionItem
method does nothing. |
void |
fill(CoolBar coolBar,
int index)
The default implementation of this
IContributionItem
method does nothing. |
int |
getCurrentHeight()
Returns the current height of the corresponding cool item.
|
int |
getCurrentWidth()
Returns the current width of the corresponding cool item.
|
int |
getMinimumItemsToShow()
Returns the minimum number of tool items to show in the cool item.
|
IToolBarManager |
getToolBarManager()
Returns the internal tool bar manager of the contribution item.
|
boolean |
getUseChevron()
Returns whether chevron support is enabled.
|
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.
|
void |
saveWidgetState()
The default implementation of this
IContributionItem
method does nothing. |
void |
setCurrentHeight(int currentHeight)
Sets the current height of the cool item.
|
void |
setCurrentWidth(int currentWidth)
Sets the current width of the cool item.
|
void |
setMinimumItemsToShow(int minimumItemsToShow)
Sets the minimum number of tool items to show in the cool item.
|
void |
setUseChevron(boolean value)
Enables or disables chevron support for the cool item.
|
void |
update(String propertyName)
The
ContributionItem implementation of this
method declared on IContributionItem does nothing. |
fill, fill, fill, getId, getParent, isDirty, isDynamic, isEnabled, isGroupMarker, isSeparator, setId, setParent, setVisible, toString, update
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getParent
fill, fill, fill, getId, isDirty, isDynamic, isEnabled, isGroupMarker, isSeparator, setParent, setVisible, update
public static final int SHOW_ALL_ITEMS
setMinimumItemsToShow
and getMinimumItemsToShow
to indicate that all tool items should be shown in the cool item.public ToolBarContributionItem()
ToolBarContributionItem(new ToolBarManager(), null)
.public ToolBarContributionItem(IToolBarManager toolBarManager)
ToolBarContributionItem(toolBarManager, null)
.toolBarManager
- the tool bar managerpublic ToolBarContributionItem(IToolBarManager toolBarManager, String id)
toolBarManager
- the tool bar manager to wrapid
- the contribution item id, or null
if nonepublic void dispose()
ContributionItem
IContributionItem
method does nothing. Subclasses may override.dispose
in interface IContributionItem
dispose
in class ContributionItem
public void fill(CoolBar coolBar, int index)
ContributionItem
IContributionItem
method does nothing. Subclasses may override.fill
in interface IContributionItem
fill
in class ContributionItem
coolBar
- the parent cool barindex
- the index where the controls are inserted,
or -1
to insert at the endpublic int getCurrentHeight()
getCurrentHeight
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
public int getCurrentWidth()
getCurrentWidth
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
public int getMinimumItemsToShow()
getMinimumItemsToShow
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
SHOW_ALL_ITEMS
if a value was not setsetMinimumItemsToShow(int)
public IToolBarManager getToolBarManager()
getToolBarManager
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
null
if one is not
defined.IToolBarManager
public boolean getUseChevron()
getUseChevron
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
true
if chevron support is enabled, false
otherwisepublic boolean isVisible()
isVisible
in interface IContributionItem
isVisible
in class ContributionItem
true
if the tool bar manager contains something
other than group marks and separators, and the internal state is
set to be visible.public void saveWidgetState()
ContributionItem
IContributionItem
method does nothing. Subclasses may override.saveWidgetState
in interface IContributionItem
saveWidgetState
in class ContributionItem
public void setCurrentHeight(int currentHeight)
setCurrentHeight
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
currentHeight
- the current height to setpublic void setCurrentWidth(int currentWidth)
setCurrentWidth
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
currentWidth
- the current width to setpublic void setMinimumItemsToShow(int minimumItemsToShow)
setMinimumItemsToShow
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
minimumItemsToShow
- the minimum number of tool items to show.getMinimumItemsToShow()
,
setUseChevron(boolean)
public void setUseChevron(boolean value)
setUseChevron
in interface org.eclipse.jface.internal.provisional.action.IToolBarContributionItem
value
- true
to enable chevron support, false
otherwise.public void update(String propertyName)
ContributionItem
ContributionItem
implementation of this
method declared on IContributionItem
does nothing.
Subclasses should override to update their state.update
in interface IContributionItem
update
in class ContributionItem
propertyName
- the id of the changed property
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.