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

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

Introduction

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

Prototype

IContributionItem remove(String id);

Source Link

Document

Removes and returns the contribution item with the given id from this manager.

Usage

From source file:com.sympedia.util.eclipse.ui.UiHelper.java

License:Open Source License

public static void removeNavigationActions(IToolBarManager manager) {
    for (IContributionItem contributionItem : manager.getItems()) {
        if (contributionItem instanceof ActionContributionItem) {
            IAction action = ((ActionContributionItem) contributionItem).getAction();
            if (action instanceof BackAction || action instanceof ForwardAction || action instanceof UpAction) {
                manager.remove(contributionItem);
            }/*from   w ww . j  a  v  a  2s.c  om*/
        }
    }
}

From source file:de.tud.cs.st.vespucci.vespucci_model.diagram.part.VespucciDiagramActionBarContributor.java

License:Open Source License

/**
 * remove the compartment icon from the menu-bar
 * /*  w  w w  . j a  v a  2 s .c o  m*/
 * @generated NOT
 * @author Artem Vovk
 * @author Alexander Weitzmann
 * @author Thomas Schulz
 */
@Override
public void init(final IActionBars bars, final IWorkbenchPage page) {
    super.init(bars, page);
    // print preview
    final IMenuManager fileMenu = bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_FILE);
    if (fileMenu == null) {
        throw new VespucciUnexpectedException(String.format("FileMenu [%s] must not be null.", fileMenu));
    }
    fileMenu.remove("pageSetupAction");
    final IMenuManager editMenu = bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
    if (editMenu == null) {
        throw new VespucciUnexpectedException(String.format("EditMenu [%s] must not be null.", editMenu));
    }
    if (editMenu.find("validationGroup") == null) {
        editMenu.add(new GroupMarker("validationGroup"));
    }
    final IAction validateAction = new de.tud.cs.st.vespucci.vespucci_model.diagram.part.ValidateAction(page);
    editMenu.appendToGroup("validationGroup", validateAction);

    // remove compartmentMenu
    final IToolBarManager toolBarManager = bars.getToolBarManager();
    toolBarManager.remove("compartmentMenu");
    toolBarManager.remove("diagramFilterActionMenu");
}

From source file:eu.numberfour.n4js.ui.navigator.internal.N4JSWorkingSetActionProvider.java

License:Open Source License

@Override
public void topLevelElementChanged(final boolean workingSetTopLevel) {
    if (actionBars != null) {
        final IToolBarManager toolBarManager = actionBars.getToolBarManager();
        toolBarManager.remove(selectWorkingSetDelegate);
        toolBarManager.remove(showHiddenWorkingSetsDelegate);
        if (workingSetManagerBroker.isWorkingSetTopLevel()) {
            toolBarManager.add(selectWorkingSetDelegate);
            final WorkingSetManager manager = workingSetManagerBroker.getActiveManager();
            if (manager != null) {
                WorkingSet[] allItems = manager.getAllWorkingSets();
                WorkingSet[] items = manager.getWorkingSets();
                updateShowHiddenAction(allItems, items);
            }/*w  w w  . java  2s  .c  om*/
        }
        selectTopLevelElementAction.fillActionBars(actionBars);
        actionBars.updateActionBars();
    }
}

From source file:eu.numberfour.n4js.ui.navigator.internal.N4JSWorkingSetActionProvider.java

License:Open Source License

private void updateShowHiddenAction(final WorkingSet[] allItems, final WorkingSet[] items) {
    final IToolBarManager toolBarManager = actionBars.getToolBarManager();
    toolBarManager.remove(showHiddenWorkingSetsDelegate);
    if (allItems.length > items.length) {
        toolBarManager.add(showHiddenWorkingSetsDelegate);
    }/*from  ww w .  j ava  2s .  co  m*/
}

From source file:ext.org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.java

License:Open Source License

public void updateToolBar(IToolBarManager toolBar) {

    boolean hasBeenFrameActionsShown = fFrameActionsShown;
    fFrameActionsShown = fBackAction.isEnabled() || fUpAction.isEnabled() || fForwardAction.isEnabled();
    if (fFrameActionsShown != hasBeenFrameActionsShown) {
        if (hasBeenFrameActionsShown) {
            toolBar.remove(fBackAction.getId());
            toolBar.remove(fForwardAction.getId());
            toolBar.remove(fUpAction.getId());
            toolBar.remove(FRAME_ACTION_SEPARATOR_ID);
        } else {// www. ja v a  2  s  .  c om
            toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, new Separator(FRAME_ACTION_SEPARATOR_ID));
            toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fUpAction);
            toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fForwardAction);
            toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fBackAction);
        }
        toolBar.update(true);
    }
}

From source file:msi.gama.gui.navigator.GamaNavigator.java

License:Open Source License

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

    super.createPartControl(parent);
    // getCommonViewer().getControl().setLayoutData(GamaToolbarFactory.getLayoutDataForChild());
    IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
    for (IContributionItem item : toolbar.getItems()) {
        if (item instanceof ActionContributionItem) {
            ActionContributionItem aci = (ActionContributionItem) item;
            IAction action = aci.getAction();
            if (action instanceof LinkEditorAction) {
                link = action;// ww w. j a  va 2  s  .c om
                toolbar.remove(aci);
            } else if (action instanceof org.eclipse.ui.internal.navigator.actions.CollapseAllAction) {
                collapse = action;
                toolbar.remove(aci);
            }

        }
    }
    // toolbar.removeAll();
    linkItem.setSelection(link.isChecked());
    try {
        IDecoratorManager mgr = PlatformUI.getWorkbench().getDecoratorManager();
        mgr.setEnabled("msi.gama.application.date.decorator", false);
    } catch (CoreException e) {
        e.printStackTrace();
    }
}

From source file:msi.gama.lang.gaml.ui.editor.GamlMarkOccurrenceActionContributor.java

@Override
public void contributeActions(final XtextEditor editor) {
    super.contributeActions(editor);
    final IToolBarManager toolBarManager = editor.getEditorSite().getActionBars().getToolBarManager();
    final IContributionItem item = toolBarManager.find(getAction().getId());
    if (item != null) {
        toolBarManager.remove(item);
    }/*w  ww  .  j  a v a  2  s .  c o  m*/

}

From source file:net.openchrom.xxd.processor.supplier.rscripting.ui.code.ConsolePageParticipant.java

License:Open Source License

public void setRDebugToolbarActions() {

    Starter utils = Starter.getConsoleInstance();
    /* Add the debug actions dynamically! */
    IToolBarManager tm = toolBarManager;
    /* Remove the distance label! */
    tm.remove("PlaceholderLabel");
    IContributionItem[] its = toolBarManager.getItems();
    boolean exist = false;
    for (int i = 0; i < its.length; i++) {
        if (its[i].getId() != null) {
            /* Control if the items exists already! */
            if (its[i].getId().equals("Stop")) {
                tm.add(item);//from ww w .  j a  v a  2s .  co  m
                exist = true;
            }
        }
    }
    /*
     * if(exist == false) {
     * tm.add(new DebugRScript());
     * tm.add(new DebugStopAction());
     * tm.add(new DebugNextAction());
     * tm.add(new DebugContinueAction());
     * tm.add(new DebugStepIntoAction());
     * tm.add(new DebugStepFinishAction());
     * tm.add(new DebugInfoAction());
     * Add the distance label again!
     * tm.add(item);
     * actionBars.updateActionBars();
     * }
     */
    /* Remove all toolbar actions from the console view! */
    /*
     * if (utils != null) { utils.cons.clear(); }
     */
}

From source file:org.csstudio.scan.ui.plot.ScanPlotView.java

License:Open Source License

/** Update toolbar to display selectors for the devices shown in the plot */
void updateToolbar() {
    final String[] devices = model.getYDevices();
    final IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
    // Add/update Y axis selectors
    for (int i = 0; i < devices.length; ++i) {
        final ActionContributionItem item = (ActionContributionItem) toolbar
                .find(DeviceSelectorAction.ID_Y + i);
        final DeviceSelectorAction selector;
        if (item != null)
            selector = (DeviceSelectorAction) item.getAction();
        else {/*from   w w w. ja v  a 2 s.c  om*/
            selector = DeviceSelectorAction.forYAxis(model, i, plot);
            toolbar.insertBefore(DeviceSelectorAction.ID_ADD, selector);
            toolbar.update(true);
        }
        selector.setSelection(devices[i]);
    }
    // Remove extra Y selectors, if there are any
    int i = devices.length;
    ActionContributionItem item = (ActionContributionItem) toolbar.find(DeviceSelectorAction.ID_Y + i);
    while (item != null) {
        final DeviceSelectorAction selector = (DeviceSelectorAction) item.getAction();
        if (devices.length <= 0)
            selector.setSelection(""); //$NON-NLS-1$
        else {
            toolbar.remove(item);
            toolbar.update(true);
        }
        ++i;
        item = (ActionContributionItem) toolbar.find(DeviceSelectorAction.ID_Y + i);
    }

    y_removal.setEnabled(devices.length > 1);
}

From source file:org.dawnsci.slicing.tools.hyper.HyperComponent.java

License:Open Source License

private void cleanUpActions(IPlottingSystem system, List<IAction> cached) {
    IActionBars actionBars = system.getActionBars();
    IToolBarManager toolBarManager = actionBars.getToolBarManager();
    IMenuManager menuManager = actionBars.getMenuManager();

    for (IAction action : cached) {
        toolBarManager.remove(action.getId());
        menuManager.remove(action.getId());
    }//  w ww  .  j ava2s .c o  m

    toolBarManager.remove(SS1);
    toolBarManager.remove(SS2);
    menuManager.remove(SS1);
    menuManager.remove(SS2);
    cached.clear();
    toolBarManager.update(true);
}