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

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

Introduction

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

Prototype

void appendToGroup(String groupName, IAction action);

Source Link

Document

Adds a contribution item for the given action at the end of the group with the given name.

Usage

From source file:org.python.pydev.debug.console.ConsoleRestartLaunchPageParticipant.java

License:Open Source License

public void init(IPageBookViewPage page, IConsole console) {
    if (!(console instanceof ProcessConsole)) {
        return;/*w ww  .j av a 2 s .co  m*/
    }
    ProcessConsole processConsole = (ProcessConsole) console;
    IProcess process = processConsole.getProcess();
    if (process == null) {
        return;
    }
    String attribute = process.getAttribute(Constants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR);
    if (!Constants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR_TRUE.equals(attribute)) {
        //Only provide relaunch if specified
        return;
    }
    this.fConsole = processConsole;
    DebugPlugin.getDefault().addDebugEventListener(this);

    IActionBars bars = page.getSite().getActionBars();

    IToolBarManager toolbarManager = bars.getToolBarManager();

    restartLaunchAction = new RestartLaunchAction(page, processConsole);
    terminateAllLaunchesAction = new TerminateAllLaunchesAction();

    toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, restartLaunchAction);
    toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAllLaunchesAction);

    bars.updateActionBars();

}

From source file:org.python.pydev.debug.newconsole.PydevConsole.java

License:Open Source License

@Override
public void createActions(IToolBarManager toolbarManager) {
    if (getType().contains(ScriptConsoleUIConstants.DEBUG_CONSOLE_TYPE)) {
        // initialize LinkWithFrameAction only for Debug Console
        linkWithDebugSelectionAction = new LinkWithDebugSelectionAction(this,
                ScriptConsoleMessages.LinkWithDebugAction, ScriptConsoleMessages.LinkWithDebugToolTip);
        toolbarManager.appendToGroup(ScriptConsolePage.SCRIPT_GROUP, linkWithDebugSelectionAction);
    }/*from ww  w  .j  a v a 2  s . c  om*/
}

From source file:org.python.pydev.dltk.console.ui.internal.ScriptConsolePage.java

License:Open Source License

protected void createActions() {
    super.createActions();

    proposalsAction = new ContentAssistProposalsAction(getViewer());
    quickAssistAction = new QuickAssistProposalsAction(getViewer());

    saveSessionAction = new SaveConsoleSessionAction((ScriptConsole) getConsole(),
            ScriptConsoleMessages.SaveSessionAction, ScriptConsoleMessages.SaveSessionTooltip);

    closeConsoleAction = new CloseScriptConsoleAction((ScriptConsole) getConsole(),
            ScriptConsoleMessages.TerminateConsoleAction, ScriptConsoleMessages.TerminateConsoleTooltip);

    IActionBars bars = getSite().getActionBars();

    IToolBarManager toolbarManager = bars.getToolBarManager();

    toolbarManager.prependToGroup(IConsoleConstants.LAUNCH_GROUP, new GroupMarker(SCRIPT_GROUP));
    toolbarManager.appendToGroup(SCRIPT_GROUP, new Separator());

    toolbarManager.appendToGroup(SCRIPT_GROUP, closeConsoleAction);

    toolbarManager.appendToGroup(SCRIPT_GROUP, saveSessionAction);

    bars.updateActionBars();//  w  ww.j  a v  a2  s  .c  om
}

From source file:org.python.pydev.shared_interactive_console.console.ui.internal.ScriptConsolePage.java

License:Open Source License

@Override
protected void createActions() {
    super.createActions();

    proposalsAction = new ContentAssistProposalsAction(getViewer());
    quickAssistAction = new QuickAssistProposalsAction(getViewer());

    saveSessionAction = new SaveConsoleSessionAction((ScriptConsole) getConsole(),
            ScriptConsoleMessages.SaveSessionAction, ScriptConsoleMessages.SaveSessionTooltip);

    closeConsoleAction = new CloseScriptConsoleAction((ScriptConsole) getConsole(),
            ScriptConsoleMessages.TerminateConsoleAction, ScriptConsoleMessages.TerminateConsoleTooltip);

    interruptConsoleAction = new InterruptScriptConsoleAction((ScriptConsole) getConsole(),
            ScriptConsoleMessages.InterruptConsoleAction, ScriptConsoleMessages.InterruptConsoleTooltip);

    IActionBars bars = getSite().getActionBars();

    IToolBarManager toolbarManager = bars.getToolBarManager();

    toolbarManager.prependToGroup(IConsoleConstants.LAUNCH_GROUP, new GroupMarker(SCRIPT_GROUP));
    toolbarManager.appendToGroup(SCRIPT_GROUP, new Separator());

    toolbarManager.appendToGroup(SCRIPT_GROUP, closeConsoleAction);

    toolbarManager.appendToGroup(SCRIPT_GROUP, saveSessionAction);

    toolbarManager.appendToGroup(SCRIPT_GROUP, interruptConsoleAction);

    ScriptConsole console = (ScriptConsole) getConsole();
    console.createActions(toolbarManager);

    bars.updateActionBars();//from www .j  a v a2 s .  c  o m
}

From source file:org.robotframework.ide.eclipse.main.plugin.console.RedSessionConsoleParticipant.java

License:Apache License

private void configureToolBar(final IToolBarManager mgr) {
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, removeTerminatedAction);
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, removeAllTerminatedAction);
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, saveSessionAction);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, activateOnStdOutChangeAction);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, activateOnStdErrChangeAction);
}

From source file:org.sonar.ide.eclipse.internal.ui.console.SonarConsolePageParticipant.java

License:Open Source License

private void configureToolBar(IToolBarManager manager) {
    manager.prependToGroup(IConsoleConstants.OUTPUT_GROUP, debugAction);
    manager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, showOnOutputAction);
}

From source file:org.sonar.ide.eclipse.ui.internal.console.SonarConsolePageParticipant.java

License:Open Source License

private void configureToolBar(IToolBarManager manager) {
    manager.prependToGroup(IConsoleConstants.LAUNCH_GROUP, consoleRemoveAction);
    manager.prependToGroup(IConsoleConstants.OUTPUT_GROUP, debugAction);
    manager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, showOnOutputAction);
}

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  w w w. jav  a2s. 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();
                    }
                }
            });
        }
    }
}

From source file:org.springframework.ide.eclipse.config.ui.editors.SpringConfigEditorContributor.java

License:Open Source License

@Override
public void contributeToToolBar(IToolBarManager toolBarManager) {
    occurrencesAction = new ToggleMarkOccurrencesAction();
    layoutAction = new ToggleLayoutAction();
    zoomCombo = new MultiPageZoomComboContributionItem(getPage());
    toolBarManager.add(new GroupMarker(ID_GROUP));
    toolBarManager.appendToGroup(ID_GROUP, occurrencesAction);
    toolBarManager.appendToGroup(ID_GROUP, layoutAction);
    toolBarManager.appendToGroup(ID_GROUP, zoomCombo);
    setActionEnablement();/*from w  w w . ja va  2 s.com*/
}

From source file:org.springframework.tooling.ls.eclipse.commons.console.LanguageServerConsolePageParticipant.java

License:Open Source License

/**
 * Contribute actions to the toolbar//from ww  w.  j  a  va 2  s  . c om
 */
protected void configureToolBar(IToolBarManager mgr) {
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fClose);

    //      mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveTerminated);
    //      mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveAllTerminated);
    //      mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdOut);
    //      mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdErr);
}