Package org.eclipse.ui.internal

# Class CoolBarToTrimManager

java.lang.Object
org.eclipse.jface.action.ContributionManager
org.eclipse.ui.internal.CoolBarToTrimManager

All Implemented Interfaces:
  `IContributionManager`, `ICoolBarManager`, `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`

public class CoolBarToTrimManager extends ContributionManager implements org.eclipse.jface.internal.provisional.action.ICoolBarManager2

Since:
  3.5

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`OBJECT`

### Fields inherited from interface org.eclipse.jface.action.ICoolBarManager

`SIZE`

## Constructor Summary

Constructors
Constructor
Description
`CoolBarToTrimManager(MApplication app, MTrimmedWindow window, List<MTrimElement> workbenchTrimElements, IRendererFactory rf)`

## Method Summary

Modifier and Type
Method
Description
`void`
`add(IAction action)`
Adds an action as a contribution item to this manager.
`void`
`add(IContributionItem item)`
Adds a contribution item to this manager.
`void`
`add(IToolBarManager toolBarManager)`
A convenience method to add a tool bar as a contribution item to this cool bar manager.
`void`
`appendToGroup(String groupName, IAction action)`
Adds a contribution item for the given action at the end of the group with the given name.
`void`
`appendToGroup(String groupName, IContributionItem item)`
Adds a contribution item to this manager at the end of the group with the given name.
`Control`
`createControl2(Composite parent)`
Creates and returns this manager's control.
`void`
`dispose()`
Disposes the resources for this manager.
`IContributionItem`
`find(String id)`
Finds the contribution item with the given id.
`IMenuManager`
`getContextMenuManager()`
Returns the context menu manager used by this cool bar manager.
`Control`
`getControl2()`
Returns the bar control for this manager.
`IContributionItem[]`
`getItems()`
Returns all contribution items known to this manager.
`boolean`
`getLockLayout()`
Returns whether the layout of the underlying cool bar widget is locked.
`IContributionManagerOverrides`
`getOverrides()`
The `ContributionManager` implementation of this method declared on `IContributionManager` returns the current overrides.
`int`
`getStyle()`
Returns the style of the underlying cool bar widget.
`static String`
`getToolbarLabel(MApplication application, MUIElement elt)`
`MTrimBar`
`getTopTrim()`
`void`
`insertAfter(String id, IAction action)`
Inserts a contribution item for the given action after the item with the given id.
`void`
`insertAfter(String id, IContributionItem item)`
Inserts a contribution item after the item with the given id.
`void`
`insertBefore(String id, IAction action)`
Inserts a contribution item for the given action before the item with the given id.
`void`
`insertBefore(String id, IContributionItem item)`
Inserts a contribution item before the item with the given id.
`boolean`
`isDirty()`
Returns whether the list of contributions has recently changed and has yet to be reflected in the corresponding widgets.
`boolean`
`isEmpty()`
Returns whether this manager has any contribution items.
`void`
`markDirty()`
Marks this contribution manager as dirty.
`void`
`prependToGroup(String groupName, IAction action)`
Adds a contribution item for the given action at the beginning of the group with the given name.
`void`
`prependToGroup(String groupName, IContributionItem item)`
Adds a contribution item to this manager at the beginning of the group with the given name.
`void`
`refresh()`
Synchronizes the visual order of the cool items in the control with this manager's internal data structures.
`IContributionItem`
`remove(String id)`
Removes and returns the contribution item with the given id from this manager.
`IContributionItem`
`remove(IContributionItem item)`
Removes the given contribution item from the contribution items known to this manager.
`void`
`removeAll()`
Removes all contribution items from this manager.
`void`
`resetItemOrder()`
Restores the canonical order of this cool bar manager.
`void`
`setContextMenuManager(IMenuManager menuManager)`
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`
`setOverrides(IContributionManagerOverrides newOverrides)`
Sets the overrides for this contribution manager
`void`
`update(boolean force)`
Updates this manager's underlying widget(s) with any changes which have been made to it or its items.

### Methods inherited from class org.eclipse.jface.action.ContributionManager

`allowItem, dumpStatistics, getSize, hasDynamicItems, indexOf, indexOf, insert, internalSetItems, itemAdded, itemRemoved, replaceItem, setDirty`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### OBJECT

public static final String OBJECT

See Also:
  - Constant Field Values

## Constructor Details

### CoolBarToTrimManager

public CoolBarToTrimManager(MApplication app, MTrimmedWindow window, List<MTrimElement> workbenchTrimElements, IRendererFactory rf)

## Method Details

### add

public void add(IAction action)
Description copied from interface: `IContributionManager`
Adds an action as a contribution item to this manager. Equivalent to `add(new ActionContributionItem(action))`.

Specified by:
  `add` in interface `IContributionManager`
Overrides:
  `add` in class `ContributionManager`
Parameters:
  `action` - the action, this cannot be `null`

### add

public void add(IContributionItem item)
Description copied from interface: `IContributionManager`
Adds a contribution item to this manager.

Specified by:
  `add` in interface `IContributionManager`
Overrides:
  `add` in class `ContributionManager`
Parameters:
  `item` - the contribution item, this cannot be `null`

### getToolbarLabel

public static String getToolbarLabel(MApplication application, MUIElement elt)

### add

public void add(IToolBarManager toolBarManager)
Description copied from interface: `ICoolBarManager`
A convenience method to add a tool bar as a contribution item to this cool bar manager. Equivalent to `add(new ToolBarContributionManager(toolBarManager))`.

Specified by:
  `add` in interface `ICoolBarManager`
Parameters:
  `toolBarManager` - the tool bar manager to be added
See Also:
  - `ToolBarContributionItem`

### appendToGroup

public void appendToGroup(String groupName, IAction action)
Description copied from interface: `IContributionManager`
Adds a contribution item for the given action at the end of the group with the given name. Equivalent to `appendToGroup(groupName,new ActionContributionItem(action))`.

Specified by:
  `appendToGroup` in interface `IContributionManager`
Overrides:
  `appendToGroup` in class `ContributionManager`
Parameters:
  `groupName` - the name of the group
  `action` - the action

### appendToGroup

public void appendToGroup(String groupName, IContributionItem item)
Description copied from interface: `IContributionManager`
Adds a contribution item to this manager at the end of the group with the given name.

Specified by:
  `appendToGroup` in interface `IContributionManager`
Overrides:
  `appendToGroup` in class `ContributionManager`
Parameters:
  `groupName` - the name of the group
  `item` - the contribution item

### createControl2

public Control createControl2(Composite parent)
Description copied from interface: `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Creates and returns this manager's control. Does not create a new control if one already exists.

Specified by:
  `createControl2` in interface `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Parameters:
  `parent` - the parent control
Returns:
  the control

### dispose

public void dispose()
Description copied from interface: `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Disposes the resources for this manager.

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/UI team.

Specified by:
  `dispose` in interface `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`

### find

public IContributionItem find(String id)
Description copied from interface: `IContributionManager`
Finds the contribution item with the given id.

Specified by:
  `find` in interface `IContributionManager`
Overrides:
  `find` in class `ContributionManager`
Parameters:
  `id` - the contribution item id
Returns:
  the contribution item, or `null` if no item with the given id can be found

### getContextMenuManager

public IMenuManager getContextMenuManager()
Description copied from interface: `ICoolBarManager`
Returns 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:
  `getContextMenuManager` in interface `ICoolBarManager`
Returns:
  the context menu manager, or `null` if none
See Also:
  - `ICoolBarManager.setContextMenuManager(org.eclipse.jface.action.IMenuManager)`

### getControl2

public Control getControl2()
Description copied from interface: `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Returns the bar control for this manager.

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/UI team.

Specified by:
  `getControl2` in interface `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Returns:
  the bar control, or `null` if none

### getItems

public IContributionItem[] getItems()
Description copied from interface: `IContributionManager`
Returns all contribution items known to this manager.

Specified by:
  `getItems` in interface `IContributionManager`
Overrides:
  `getItems` in class `ContributionManager`
Returns:
  a list of contribution items

### getLockLayout

public boolean getLockLayout()
Description copied from interface: `ICoolBarManager`
Returns whether the layout of the underlying cool bar widget is locked.

Specified by:
  `getLockLayout` in interface `ICoolBarManager`
Returns:
  `true` if cool bar layout is locked, `false` otherwise

### getOverrides

public IContributionManagerOverrides getOverrides()
Description copied from class: `ContributionManager`
The `ContributionManager` implementation of this method declared on `IContributionManager` returns the current overrides. If there is no overrides it lazily creates one which overrides no item state.

Specified by:
  `getOverrides` in interface `IContributionManager`
Overrides:
  `getOverrides` in class `ContributionManager`
Returns:
  the overrides for the items of this manager

### getStyle

public int getStyle()
Description copied from interface: `ICoolBarManager`
Returns the style of the underlying cool bar widget.

Specified by:
  `getStyle` in interface `ICoolBarManager`
Returns:
  the style of the cool bar

### insertAfter

public void insertAfter(String id, IAction action)
Description copied from interface: `IContributionManager`
Inserts a contribution item for the given action after the item with the given id. Equivalent to `insertAfter(id,new ActionContributionItem(action))`.

Specified by:
  `insertAfter` in interface `IContributionManager`
Overrides:
  `insertAfter` in class `ContributionManager`
Parameters:
  `id` - the contribution item id
  `action` - the action to insert

### insertAfter

public void insertAfter(String id, IContributionItem item)
Description copied from interface: `IContributionManager`
Inserts a contribution item after the item with the given id.

Specified by:
  `insertAfter` in interface `IContributionManager`
Overrides:
  `insertAfter` in class `ContributionManager`
Parameters:
  `id` - the contribution item id
  `item` - the contribution item to insert

### insertBefore

public void insertBefore(String id, IAction action)
Description copied from interface: `IContributionManager`
Inserts a contribution item for the given action before the item with the given id. Equivalent to `insertBefore(id,new ActionContributionItem(action))`.

Specified by:
  `insertBefore` in interface `IContributionManager`
Overrides:
  `insertBefore` in class `ContributionManager`
Parameters:
  `id` - the contribution item id
  `action` - the action to insert

### insertBefore

public void insertBefore(String id, IContributionItem item)
Description copied from interface: `IContributionManager`
Inserts a contribution item before the item with the given id.

Specified by:
  `insertBefore` in interface `IContributionManager`
Overrides:
  `insertBefore` in class `ContributionManager`
Parameters:
  `id` - the contribution item id
  `item` - the contribution item to insert

### isDirty

public boolean isDirty()
Description copied from interface: `IContributionManager`
Returns whether the list of contributions has recently changed and has yet to be reflected in the corresponding widgets.

Specified by:
  `isDirty` in interface `IContributionManager`
Overrides:
  `isDirty` in class `ContributionManager`
Returns:
  `true` if this manager is dirty, and `false` if it is up-to-date

### isEmpty

public boolean isEmpty()
Description copied from interface: `IContributionManager`
Returns whether this manager has any contribution items.

Specified by:
  `isEmpty` in interface `IContributionManager`
Overrides:
  `isEmpty` in class `ContributionManager`
Returns:
  `true` if there are no items, and `false` otherwise

### markDirty

public void markDirty()
Description copied from interface: `IContributionManager`
Marks this contribution manager as dirty.

Specified by:
  `markDirty` in interface `IContributionManager`
Overrides:
  `markDirty` in class `ContributionManager`

### prependToGroup

public void prependToGroup(String groupName, IAction action)
Description copied from interface: `IContributionManager`
Adds a contribution item for the given action at the beginning of the group with the given name. Equivalent to `prependToGroup(groupName,new ActionContributionItem(action))`.

Specified by:
  `prependToGroup` in interface `IContributionManager`
Overrides:
  `prependToGroup` in class `ContributionManager`
Parameters:
  `groupName` - the name of the group
  `action` - the action

### prependToGroup

public void prependToGroup(String groupName, IContributionItem item)
Description copied from interface: `IContributionManager`
Adds a contribution item to this manager at the beginning of the group with the given name.

Specified by:
  `prependToGroup` in interface `IContributionManager`
Overrides:
  `prependToGroup` in class `ContributionManager`
Parameters:
  `groupName` - the name of the group
  `item` - the contribution item

### refresh

public void refresh()
Description copied from interface: `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
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()` 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.

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/UI team.

Specified by:
  `refresh` in interface `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`

### remove

public IContributionItem remove(IContributionItem item)
Description copied from interface: `IContributionManager`
Removes the given contribution item from the contribution items known to this manager.

Specified by:
  `remove` in interface `IContributionManager`
Overrides:
  `remove` in class `ContributionManager`
Parameters:
  `item` - the contribution item
Returns:
  the `item` parameter if the item was removed, and `null` if it was not found

### remove

public IContributionItem remove(String id)
Description copied from interface: `IContributionManager`
Removes and returns the contribution item with the given id from this manager. Returns `null` if this manager has no contribution items with the given id.

Specified by:
  `remove` in interface `IContributionManager`
Overrides:
  `remove` in class `ContributionManager`
Parameters:
  `id` - the contribution item id
Returns:
  the item that was found and removed, or `null` if none

### removeAll

public void removeAll()
Description copied from interface: `IContributionManager`
Removes all contribution items from this manager.

Note: The items will not get disposed.

Specified by:
  `removeAll` in interface `IContributionManager`
Overrides:
  `removeAll` in class `ContributionManager`

### resetItemOrder

public void resetItemOrder()
Description copied from interface: `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Restores the canonical order of this cool bar manager. The canonical order is the order in which the contribution items where added.

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/UI team.

Specified by:
  `resetItemOrder` in interface `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`

### setContextMenuManager

public void setContextMenuManager(IMenuManager menuManager)
Description copied from interface: `ICoolBarManager`
Sets the context menu of this cool bar manager to the given menu manager.

Specified by:
  `setContextMenuManager` in interface `ICoolBarManager`
Parameters:
  `menuManager` - the context menu manager, or `null` if none
See Also:
  - `ICoolBarManager.getContextMenuManager()`

### setItems

public void setItems(IContributionItem[] newItems)
Description copied from interface: `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Replaces the current items with the given items. Forces an update.

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/UI team.

Specified by:
  `setItems` in interface `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Parameters:
  `newItems` - the items with which to replace the current items

### setLockLayout

public void setLockLayout(boolean value)
Description copied from interface: `ICoolBarManager`
Locks 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:
  `setLockLayout` in interface `ICoolBarManager`
Parameters:
  `value` - `true` to lock the cool bar, `false` to unlock

### setOverrides

public void setOverrides(IContributionManagerOverrides newOverrides)
Description copied from class: `ContributionManager`
Sets the overrides for this contribution manager

Specified by:
  `setOverrides` in interface `org.eclipse.jface.internal.provisional.action.ICoolBarManager2`
Overrides:
  `setOverrides` in class `ContributionManager`
Parameters:
  `newOverrides` - the overrides for the items of this manager

### update

public void update(boolean force)
Description copied from interface: `IContributionManager`
Updates this manager's underlying widget(s) with any changes which have been made to it or its items. Normally changes to a contribution manager merely mark it as dirty, without updating the underlying widgets. This brings the underlying widgets up to date with any changes.

Specified by:
  `update` in interface `IContributionManager`
Parameters:
  `force` - `true` means update even if not dirty, and `false` for normal incremental updating

### getTopTrim

public MTrimBar getTopTrim()