Example usage for org.eclipse.jface.action IToolBarManager insertBefore

List of usage examples for org.eclipse.jface.action IToolBarManager insertBefore

Introduction

In this page you can find the example usage for org.eclipse.jface.action IToolBarManager insertBefore.

Prototype

void insertBefore(String id, IAction action);

Source Link

Document

Inserts a contribution item for the given action before the item with the given id.

Usage

From source file:ummisco.gama.ui.navigator.GamaNavigator.java

@Override
public void createPartControl(final Composite compo) {
    this.parent = GamaToolbarFactory.createToolbars(this, compo);

    super.createPartControl(parent);
    restoreState();//from  w ww.j av a2  s  .c o  m
    final IToolBarManager tb = getViewSite().getActionBars().getToolBarManager();
    for (final IContributionItem item : tb.getItems()) {
        if (item instanceof ActionContributionItem) {
            final ActionContributionItem aci = (ActionContributionItem) item;
            final IAction action = aci.getAction();
            if (action instanceof LinkEditorAction) {
                link = action;
                tb.remove(aci);
            } else if (action instanceof org.eclipse.ui.internal.navigator.actions.CollapseAllAction) {
                tb.remove(aci);
            }

        }
    }
    linkItem.setSelection(link.isChecked());
    tb.update(true);
    tb.insertBefore("toolbar.toggle", byDate.toCheckAction());
    tb.insertBefore("toolbar.toggle", expandAll.toAction());
    tb.insertBefore(expandAll.getId(), collapseAll.toAction());

    try {
        final IDecoratorManager mgr = PlatformUI.getWorkbench().getDecoratorManager();
        mgr.setEnabled("msi.gama.application.date.decorator", false);
    } catch (final CoreException e) {
        e.printStackTrace();
    }
    properties = new PropertyDialogAction(new SameShellProvider(getSite().getShell()),
            getSite().getSelectionProvider());
    findControl.initialize();

}