Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.jface.action
Class ToolBarManager  view ToolBarManager download ToolBarManager.java

java.lang.Object
  extended byorg.eclipse.jface.action.ContributionManager
      extended byorg.eclipse.jface.action.ToolBarManager
All Implemented Interfaces:
IContributionManager, IToolBarManager

public class ToolBarManager
extends ContributionManager
implements IToolBarManager

A tool bar manager is a contribution manager which realizes itself and its items in a tool bar control.

This class may be instantiated; it may also be subclassed if a more sophisticated layout is required.


Field Summary
private  MenuManager contextMenuManager
          The menu manager to the context menu associated with the toolbar.
private  int itemStyle
          The tool bar items style; SWT.NONE by default.
private  org.eclipse.swt.widgets.ToolBar toolBar
          The tool bat control; null before creation and after disposal.
 
Fields inherited from class org.eclipse.jface.action.ContributionManager
 
Constructor Summary
ToolBarManager()
          Creates a new tool bar manager with the default SWT button style.
ToolBarManager(int style)
          Creates a tool bar manager with the given SWT button style.
ToolBarManager(org.eclipse.swt.widgets.ToolBar toolbar)
          Creates a tool bar manager for an existing tool bar control.
 
Method Summary
 org.eclipse.swt.widgets.ToolBar createControl(org.eclipse.swt.widgets.Composite parent)
          Creates and returns this manager's tool bar control.
 void dispose()
          Disposes of this tool bar manager and frees all allocated SWT resources.
private  org.eclipse.swt.widgets.Menu getContextMenuControl()
          Returns the control of the Menu Manager.
 MenuManager getContextMenuManager()
          Returns the context menu manager for this tool bar manager.
 org.eclipse.swt.widgets.ToolBar getControl()
          Returns the tool bar control for this manager.
protected  void relayout(org.eclipse.swt.widgets.ToolBar toolBar, int oldCount, int newCount)
          Re-lays out the tool bar.
 void setContextMenuManager(MenuManager contextMenuManager)
          Sets the context menu manager for this tool bar manager to the given menu manager.
private  boolean toolBarExist()
          Returns whether the tool bar control is created and not disposed.
 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
add, add, allowItem, appendToGroup, appendToGroup, dumpStatistics, find, getItems, getOverrides, hasDynamicItems, indexOf, indexOf, insert, insertAfter, insertAfter, insertBefore, insertBefore, internalSetItems, isDirty, isEmpty, itemAdded, itemRemoved, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll, replaceItem, setDirty, setOverrides
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.action.IContributionManager
add, add, appendToGroup, appendToGroup, find, getItems, getOverrides, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll
 

Field Detail

itemStyle

private int itemStyle
The tool bar items style; SWT.NONE by default.


toolBar

private org.eclipse.swt.widgets.ToolBar toolBar
The tool bat control; null before creation and after disposal.


contextMenuManager

private MenuManager contextMenuManager
The menu manager to the context menu associated with the toolbar.

Since:
3.0
Constructor Detail

ToolBarManager

public ToolBarManager()
Creates a new tool bar manager with the default SWT button style. Use the createControl method to create the tool bar control.


ToolBarManager

public ToolBarManager(int style)
Creates a tool bar manager with the given SWT button style. Use the createControl method to create the tool bar control.


ToolBarManager

public ToolBarManager(org.eclipse.swt.widgets.ToolBar toolbar)
Creates a tool bar manager for an existing tool bar control. This manager becomes responsible for the control, and will dispose of it when the manager is disposed.

Method Detail

createControl

public org.eclipse.swt.widgets.ToolBar createControl(org.eclipse.swt.widgets.Composite parent)
Creates and returns this manager's tool bar control. Does not create a new control if one already exists.


dispose

public void dispose()
Disposes of this tool 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 tool bar manager and its associated contribution items. Use removeAll for that purpose.


getControl

public org.eclipse.swt.widgets.ToolBar getControl()
Returns the tool bar control for this manager.


relayout

protected void relayout(org.eclipse.swt.widgets.ToolBar toolBar,
                        int oldCount,
                        int newCount)
Re-lays out the tool bar.

The default implementation of this framework method re-lays out the parent when the number of items crosses the zero threshold. Subclasses should override this method to implement their own re-layout strategy


toolBarExist

private boolean toolBarExist()
Returns whether the tool bar control is created and not disposed.


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

getContextMenuControl

private org.eclipse.swt.widgets.Menu getContextMenuControl()
Returns the control of the Menu Manager. If the menu manager does not have a control then one is created.


getContextMenuManager

public MenuManager getContextMenuManager()
Returns the context menu manager for this tool bar manager.

Since:
3.0

setContextMenuManager

public void setContextMenuManager(MenuManager contextMenuManager)
Sets the context menu manager for this tool bar manager to the given menu manager. If the tool bar control exists, it also adds the menu control to the tool bar.

Since:
3.0