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:org.fusesource.tools.messaging.editors.MessagesMasterBlock.java

License:Open Source License

public void updateBlockOnSelectionChange(IMessageViewerExtension newViewerExt) {
    IToolBarManager toolBar = getToolBarManager();
    Collection<Action> actions = null;
    if (currentViewerExt != null) {
        actions = currentViewerExt.getActions();
        for (Action action : actions) {
            toolBar.remove(new ActionContributionItem(action));
        }//  w w w.  j  a  v a2s.  c  o m
    }
    currentViewerExt = newViewerExt;
    actions = currentViewerExt.getActions();
    for (Action action : actions) {
        toolBar.add(new ActionContributionItem(action));
    }
    toolBar.update(true);
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.cpu.CpuSection.java

License:Open Source License

@Override
protected void removeToolBarActions(IToolBarManager manager) {
    manager.remove(suspendCpuProfilingAction.getId());
    manager.remove(resumeCpuProfilingAction.getId());
    manager.remove(clearCpuProfilingDataAction.getId());
    manager.remove(dumpCpuProfilingDataAction.getId());
    manager.remove("separator"); //$NON-NLS-1$
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.mbean.MBeansSection.java

License:Open Source License

@Override
protected void removeToolBarActions(IToolBarManager manager) {
    manager.remove("separator"); //$NON-NLS-1$
    manager.remove(refreshAction.getId());
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.memory.HeapHistogramPage.java

License:Open Source License

/**
 * Removes the tool bar actions.//  w w  w  . j  a  v  a2 s. c  o m
 * 
 * @param manager
 *            The tool bar manager
 */
void removeToolBarActions(IToolBarManager manager) {
    manager.remove("separator"); //$NON-NLS-1$
    manager.remove(refreshAction.getId());
    manager.remove(garbageCollectorAction.getId());
    manager.remove(clearHeapDeltaAction.getId());
    manager.remove(dumpHeapAction.getId());
    manager.remove(dumpHprofAction.getId());
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.memory.SWTResourcesPage.java

License:Open Source License

/**
 * Removes the tool bar actions.//from w ww  . j  a v a2s . c om
 * 
 * @param manager
 *            The tool bar manager
 */
void removeToolBarActions(IToolBarManager manager) {
    manager.remove("separator2"); //$NON-NLS-1$
    manager.remove(refreshAction.getId());
    manager.remove(clearSWTResourceAction.getId());
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.thread.ThreadsSection.java

License:Open Source License

@Override
protected void removeToolBarActions(IToolBarManager manager) {
    manager.remove("separator"); //$NON-NLS-1$
    manager.remove(refreshAction.getId());
    manager.remove(dumpThreadsAction.getId());
}

From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.timeline.TimelineSection.java

License:Open Source License

@Override
protected void removeToolBarActions(IToolBarManager manager) {
    manager.remove("separator"); //$NON-NLS-1$
    manager.remove(refreshAction.getId());
    manager.remove(clearAction.getId());
    manager.remove(newChartAction.getId());
}

From source file:org.radrails.server.internal.ui.console.ServerConsolePageParticipant.java

License:Open Source License

private void removeTerminateAction(IToolBarManager toolbar) {
    if (toolbar == null)
        return;//w ww .  java 2 s . c  o m
    IContributionItem[] items = toolbar.getItems();
    for (int i = 0; i < items.length; i++) {
        if (!(items[i] instanceof ActionContributionItem))
            continue;
        ActionContributionItem item = (ActionContributionItem) items[i];
        IAction action = item.getAction();
        if (!(action instanceof ConsoleTerminateAction))
            continue;
        toolbar.remove(item);
        toolbar.update(false);
        break;
    }

}

From source file:org.rascalmpl.eclipse.console.internal.InteractiveInterpreterConsole.java

License:Open Source License

public void initializeConsole() {
    final Thread commandExecutorThread = new Thread(commandExecutor);
    commandExecutorThread.setDaemon(true);
    commandExecutorThread.setName("Console Command Executor");

    new Thread() {
        public void run() {
            do {//from w w w .  j av  a 2  s  .c o m
                Thread.yield();
            } while (page == null);

            disableEditing();
            emitPrompt();

            /**
             * <code>promptInitialized</code> is set after
             * <code>page</code> was initialized and the console is ready
             * for input (i.e. the prompt was printed). This are the
             * preconditions that commands from the
             * <code>delayedCommandQueue</code> might be processed.
             */
            promptInitialized = true;

            enableEditing();

            Display.getDefault().asyncExec(new Runnable() {
                public void run() {
                    IActionBars actionBars = page.getSite().getActionBars();
                    IToolBarManager toolBarManager = actionBars.getToolBarManager();

                    // Removed default stuff.
                    IContributionItem[] ci = toolBarManager.getItems();
                    for (int i = 0; i < ci.length; i++) {
                        toolBarManager.remove(ci[i]);
                    }

                    // Add custom stuff.
                    toolBarManager.add(new StoreHistoryAction(InteractiveInterpreterConsole.this));
                    toolBarManager.add(new TerminationAction(InteractiveInterpreterConsole.this));
                    toolBarManager.add(new InterruptAction(InteractiveInterpreterConsole.this));
                    toolBarManager.add(new TraceAction(InteractiveInterpreterConsole.this));

                    actionBars.updateActionBars();

                    commandExecutorThread.start();

                }
            });
        }
    }.start();
}

From source file:org.springframework.ide.eclipse.boot.launch.console.BootConsolePageParticipant.java

License:Open Source License

public void init(IPageBookViewPage page, IConsole console) {
    this.console = (ProcessConsole) console;

    //TODO: This code works assuming that our IConsolePageParticipant is called after the
    //  ProcessConsolePageParticipant (which creates the action we are replacing
    //When testing this that was always the case... but it may not be guaranteed.

    if (isDevtoolsClient(this.console) || isBootApp(this.console)) {
        terminateAction = new TerminateProcessAction();
        try {//from ww w.j av a 2s.  c  o m
            terminateAction.setImageDescriptor(BootUIImages.descriptor("icons/stop.gif"));
            terminateAction.setDisabledImageDescriptor(BootUIImages.descriptor("icons/stop_disabled.gif"));
        } catch (Exception e) {
            BootActivator.log(e);
        }
        IToolBarManager toolbar = page.getSite().getActionBars().getToolBarManager();
        IContributionItem replace = findReplacementItem(toolbar);
        if (replace != null) {
            toolbar.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);
            toolbar.remove(replace);
        }
        boolean enabled = getConsoleProcess().canTerminate();
        terminateAction.setEnabled(enabled);
        if (enabled) {
            this.processTracker = new ProcessTracker(new ProcessListenerAdapter() {
                @Override
                public void processTerminated(ProcessTracker tracker, IProcess terminated) {
                    if (getConsoleProcess().equals(terminated)) {
                        terminateAction.setEnabled(false);
                        //after process is terminated... it can't come back to life so... can stop listening now.
                        tracker.dispose();
                    }
                }
            });
        }
    }
}