public class CoolBarManager extends ContributionManager implements ICoolBarManager
This class may be instantiated; it may also be subclassed.
Modifier and Type | Field and Description |
---|---|
static String |
USER_SEPARATOR
A separator created by the end user.
|
SIZE
Constructor and Description |
---|
CoolBarManager()
Creates a new cool bar manager with the default style.
|
CoolBarManager(CoolBar coolBar)
Creates a cool bar manager for an existing cool bar control.
|
CoolBarManager(int style)
Creates a cool bar manager with the given SWT style.
|
Modifier and Type | Method and Description |
---|---|
void |
add(IToolBarManager toolBarManager)
A convenience method to add a tool bar as a contribution item to this
cool bar manager.
|
protected boolean |
allowItem(IContributionItem itemToAdd)
This method allows subclasses of
ContributionManager to
prevent certain items in the contributions list. |
CoolBar |
createControl(Composite parent)
Creates and returns this manager's cool bar control.
|
void |
dispose()
Disposes of this cool bar manager and frees all allocated SWT resources.
|
IMenuManager |
getContextMenuManager()
Returns the context menu manager used by this cool bar manager.
|
CoolBar |
getControl()
Returns the cool bar control for this manager.
|
boolean |
getLockLayout()
Returns whether the layout of the underlying cool bar widget is locked.
|
int |
getStyle()
Returns the style of the underlying cool bar widget.
|
protected void |
itemAdded(IContributionItem item)
Subclasses may extend this
ContributionManager method,
but must call super.itemAdded . |
protected void |
itemRemoved(IContributionItem item)
Subclasses may extend this
ContributionManager method,
but must call super.itemRemoved . |
void |
refresh()
Synchronizes the visual order of the cool items in the control with this
manager's internal data structures.
|
void |
resetItemOrder()
Restores the canonical order of this cool bar manager.
|
void |
setContextMenuManager(IMenuManager contextMenuManager)
Sets the context menu of this cool bar manager to the given menu
manager.
|
void |
setItems(IContributionItem[] newItems)
Replaces the current items with the given items.
|
void |
setLockLayout(boolean value)
Locks or unlocks the layout of the underlying cool bar widget.
|
void |
update(boolean force)
Subclasses may extend this
IContributionManager method,
but must call super.update . |
add, 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, setOverrides
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, appendToGroup, appendToGroup, find, getItems, getOverrides, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll
public static final String USER_SEPARATOR
public CoolBarManager()
CoolBarManager(SWT.NONE)
.public CoolBarManager(CoolBar coolBar)
coolBar
- the cool bar controlpublic CoolBarManager(int style)
createControl
will create the cool bar control.style
- the cool bar item style; see
CoolBar
for for valid
style bitspublic void add(IToolBarManager toolBarManager)
ICoolBarManager
add(new ToolBarContributionManager(toolBarManager))
.add
in interface ICoolBarManager
toolBarManager
- the tool bar manager to be addedToolBarContributionItem
protected boolean allowItem(IContributionItem itemToAdd)
ContributionManager
ContributionManager
to
prevent certain items in the contributions list.
ContributionManager
will either block or allow an addition
based on the result of this method call. This can be used to prevent
duplication, for example.allowItem
in class ContributionManager
itemToAdd
- The contribution item to be added; may be null
.true
if the addition should be allowed;
false
otherwise. The default implementation allows
all items.public CoolBar createControl(Composite parent)
parent
- the parent controlpublic void dispose()
removeAll
for that
purpose.public IMenuManager getContextMenuManager()
ICoolBarManager
getContextMenuManager
in interface ICoolBarManager
null
if noneICoolBarManager.setContextMenuManager(org.eclipse.jface.action.IMenuManager)
public CoolBar getControl()
null
if nonepublic boolean getLockLayout()
ICoolBarManager
getLockLayout
in interface ICoolBarManager
true
if cool bar layout is locked, false
otherwisepublic int getStyle()
ICoolBarManager
getStyle
in interface ICoolBarManager
protected void itemAdded(IContributionItem item)
ContributionManager
method,
but must call super.itemAdded
.itemAdded
in class ContributionManager
item
- the item to be addedContributionManager.itemAdded(org.eclipse.jface.action.IContributionItem)
protected void itemRemoved(IContributionItem item)
ContributionManager
method,
but must call super.itemRemoved
.itemRemoved
in class ContributionManager
item
- remove given parent from list of contributionsContributionManager.itemRemoved(org.eclipse.jface.action.IContributionItem)
public void refresh()
Note that update()
and refresh()
are
converses: update()
changes the visual order to match the
internal structures, and refresh
changes the internal
structures to match the visual order.
public void resetItemOrder()
public void setContextMenuManager(IMenuManager contextMenuManager)
ICoolBarManager
setContextMenuManager
in interface ICoolBarManager
contextMenuManager
- the context menu manager, or null
if noneICoolBarManager.getContextMenuManager()
public void setItems(IContributionItem[] newItems)
newItems
- the items with which to replace the current itemspublic void setLockLayout(boolean value)
ICoolBarManager
Note that items can be added or removed programmatically even while the cool bar is locked.
setLockLayout
in interface ICoolBarManager
value
- true
to lock the cool bar, false
to unlockpublic void update(boolean force)
IContributionManager
method,
but must call super.update
.update
in interface IContributionManager
force
- true
means update even if not dirty,
and false
for normal incremental updatingIContributionManager.update(boolean)
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.