Package org.eclipse.jface.action
Class CoolBarManager
java.lang.Object
org.eclipse.jface.action.ContributionManager
org.eclipse.jface.action.CoolBarManager
- All Implemented Interfaces:
- IContributionManager,- ICoolBarManager
A cool bar manager is a contribution manager which realizes itself and its
 items in a cool bar control.
 
This class may be instantiated; it may also be subclassed.
- Since:
- 3.0
- 
Field SummaryFieldsFields inherited from interface org.eclipse.jface.action.ICoolBarManagerSIZE
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a new cool bar manager with the default style.CoolBarManager(int style) Creates a cool bar manager with the given SWT style.CoolBarManager(CoolBar coolBar) Creates a cool bar manager for an existing cool bar control.
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd(IToolBarManager toolBarManager) A convenience method to add a tool bar as a contribution item to this cool bar manager.protected booleanallowItem(IContributionItem itemToAdd) This method allows subclasses ofContributionManagerto prevent certain items in the contributions list.createControl(Composite parent) Creates and returns this manager's cool bar control.voiddispose()Disposes of this cool bar manager and frees all allocated SWT resources.Returns the context menu manager used by this cool bar manager.Returns the cool bar control for this manager.booleanReturns whether the layout of the underlying cool bar widget is locked.intgetStyle()Returns the style of the underlying cool bar widget.protected voiditemAdded(IContributionItem item) Subclasses may extend thisContributionManagermethod, but must callsuper.itemAdded.protected voiditemRemoved(IContributionItem item) Subclasses may extend thisContributionManagermethod, but must callsuper.itemRemoved.voidrefresh()Synchronizes the visual order of the cool items in the control with this manager's internal data structures.voidRestores the canonical order of this cool bar manager.voidsetContextMenuManager(IMenuManager contextMenuManager) Sets the context menu of this cool bar manager to the given menu manager.voidsetItems(IContributionItem[] newItems) Replaces the current items with the given items.voidsetLockLayout(boolean value) Locks or unlocks the layout of the underlying cool bar widget.voidupdate(boolean force) Subclasses may extend thisIContributionManagermethod, but must callsuper.update.Methods inherited from class org.eclipse.jface.action.ContributionManageradd, add, appendToGroup, appendToGroup, dumpStatistics, find, getItems, getOverrides, getSize, hasDynamicItems, indexOf, indexOf, insert, insertAfter, insertAfter, insertBefore, insertBefore, internalSetItems, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll, replaceItem, setDirty, setOverridesMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.action.IContributionManageradd, add, appendToGroup, appendToGroup, find, getItems, getOverrides, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll
- 
Field Details- 
USER_SEPARATORA separator created by the end user.- See Also:
 
 
- 
- 
Constructor Details- 
CoolBarManagerpublic CoolBarManager()Creates a new cool bar manager with the default style. Equivalent toCoolBarManager(SWT.NONE).
- 
CoolBarManagerCreates a cool bar manager for an existing cool bar control. This manager becomes responsible for the control, and will dispose of it when the manager is disposed.- Parameters:
- coolBar- the cool bar control
 
- 
CoolBarManagerpublic CoolBarManager(int style) Creates a cool bar manager with the given SWT style. CallingcreateControlwill create the cool bar control.- Parameters:
- style- the cool bar item style; see- CoolBarfor for valid style bits
 
 
- 
- 
Method Details- 
addDescription copied from interface:ICoolBarManagerA convenience method to add a tool bar as a contribution item to this cool bar manager. Equivalent toadd(new ToolBarContributionManager(toolBarManager)).- Specified by:
- addin interface- ICoolBarManager
- Parameters:
- toolBarManager- the tool bar manager to be added
- See Also:
 
- 
allowItemDescription copied from class:ContributionManagerThis method allows subclasses ofContributionManagerto prevent certain items in the contributions list.ContributionManagerwill either block or allow an addition based on the result of this method call. This can be used to prevent duplication, for example.- Overrides:
- allowItemin class- ContributionManager
- Parameters:
- itemToAdd- The contribution item to be added; may be- null.
- Returns:
- trueif the addition should be allowed;- falseotherwise. The default implementation allows all items.
 
- 
createControlCreates and returns this manager's cool bar control. Does not create a new control if one already exists.- Parameters:
- parent- the parent control
- Returns:
- the cool bar control
 
- 
disposepublic void dispose()Disposes of this cool bar manager and frees all allocated SWT resources. Notifies all contribution items of the dispose. Note that this method does not clean up references between this cool bar manager and its associated contribution items. UseremoveAllfor that purpose.
- 
getContextMenuManagerDescription copied from interface:ICoolBarManagerReturns the context menu manager used by this cool bar manager. This context menu manager is used by the cool bar manager except for cool items that provide their own.- Specified by:
- getContextMenuManagerin interface- ICoolBarManager
- Returns:
- the context menu manager, or nullif none
- See Also:
 
- 
getControlReturns the cool bar control for this manager.- Returns:
- the cool bar control, or nullif none
 
- 
getLockLayoutpublic boolean getLockLayout()Description copied from interface:ICoolBarManagerReturns whether the layout of the underlying cool bar widget is locked.- Specified by:
- getLockLayoutin interface- ICoolBarManager
- Returns:
- trueif cool bar layout is locked,- falseotherwise
 
- 
getStylepublic int getStyle()Description copied from interface:ICoolBarManagerReturns the style of the underlying cool bar widget.- Specified by:
- getStylein interface- ICoolBarManager
- Returns:
- the style of the cool bar
 
- 
itemAddedSubclasses may extend thisContributionManagermethod, but must callsuper.itemAdded.- Overrides:
- itemAddedin class- ContributionManager
- Parameters:
- item- the item to be added
- See Also:
 
- 
itemRemovedSubclasses may extend thisContributionManagermethod, but must callsuper.itemRemoved.- Overrides:
- itemRemovedin class- ContributionManager
- Parameters:
- item- remove given parent from list of contributions
- See Also:
 
- 
refreshpublic void refresh()Synchronizes the visual order of the cool items in the control with this manager's internal data structures. This method should be called before requesting the order of the contribution items to ensure that the order is accurate.Note that update()andrefresh()are converses:update()changes the visual order to match the internal structures, andrefreshchanges the internal structures to match the visual order.
- 
resetItemOrderpublic void resetItemOrder()Restores the canonical order of this cool bar manager. The canonical order is the order in which the contribution items where added.
- 
setContextMenuManagerDescription copied from interface:ICoolBarManagerSets the context menu of this cool bar manager to the given menu manager.- Specified by:
- setContextMenuManagerin interface- ICoolBarManager
- Parameters:
- contextMenuManager- the context menu manager, or- nullif none
- See Also:
 
- 
setItemsReplaces the current items with the given items. Forces an update.- Parameters:
- newItems- the items with which to replace the current items
 
- 
setLockLayoutpublic void setLockLayout(boolean value) Description copied from interface:ICoolBarManagerLocks or unlocks the layout of the underlying cool bar widget. Once the cool bar is locked, cool items cannot be repositioned by the user.Note that items can be added or removed programmatically even while the cool bar is locked. - Specified by:
- setLockLayoutin interface- ICoolBarManager
- Parameters:
- value-- trueto lock the cool bar,- falseto unlock
 
- 
updatepublic void update(boolean force) Subclasses may extend thisIContributionManagermethod, but must callsuper.update.- Specified by:
- updatein interface- IContributionManager
- Parameters:
- force-- truemeans update even if not dirty, and- falsefor normal incremental updating
- See Also:
 
 
-