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.eclipse.dltk.internal.debug.ui.console.ScriptDebugConsolePageParticipant.java

License:Open Source License

/**
 * Contribute actions to the toolbar/*  w w  w  . j  a  va  2  s. c om*/
 */
protected void configureToolBar(IToolBarManager mgr) {
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTerminate);
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveTerminated);
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveAllTerminated);
    // mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdOut);
    // mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdErr);
}

From source file:org.eclipse.dltk.logconsole.ui.LogConsolePageParticipant.java

License:Open Source License

public void init(IPageBookViewPage page, IConsole console) {
    Assert.isLegal(console instanceof LogConsoleImpl);
    IActionBars bars = page.getSite().getActionBars();
    IToolBarManager toolbarManager = bars.getToolBarManager();
    toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, new CloseLogConsoleAction(console));
}

From source file:org.eclipse.dltk.mod.validators.internal.ui.ValidatorsConsolePageParticipant.java

License:Open Source License

public void init(IPageBookViewPage page, IConsole console) {
    Assert.isLegal(console instanceof ValidatorConsole);
    Assert.isLegal(ValidatorConsole.TYPE.equals(console.getType()));
    IActionBars bars = page.getSite().getActionBars();
    IToolBarManager toolbarManager = bars.getToolBarManager();
    toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP,
            new CloseValidatorsConsoleAction((ValidatorConsole) console));
    toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, new RemoveAllValidatorConsolesAction());
}

From source file:org.eclipse.dltk.validators.internal.ui.ValidatorsConsolePageParticipant.java

License:Open Source License

public void init(IPageBookViewPage page, IConsole console) {
    Assert.isLegal(console instanceof ValidatorConsole);
    Assert.isLegal(ValidatorConsole.TYPE.equals(console.getType()));
    IActionBars bars = page.getSite().getActionBars();
    IToolBarManager toolbarManager = bars.getToolBarManager();
    toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP,
            new CloseValidatorsConsoleAction((ValidatorConsole) console));
    toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, new RemoveAllValidatorConsolesAction());
    bars.getMenuManager().add(new ShowCommandLineValidatorsConsoleAction(page, (ValidatorConsole) console));
}

From source file:org.eclipse.ease.ui.console.ScriptConsolePageParticipant.java

License:Open Source License

/**
 * Contribute actions to the toolbar/*from  w w w  . java2  s . c o  m*/
 */
protected void configureToolBar(final IToolBarManager mgr) {
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTerminate);
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveTerminated);
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveAllTerminated);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdOut);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdErr);
}

From source file:org.eclipse.emf.ocl.examples.interpreter.console.OCLConsolePage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    // force left-to-right text direction in the console, because it
    //    works with OCL text and the OCL language is based on English
    page = new SashForm(parent, SWT.VERTICAL | SWT.LEFT_TO_RIGHT);

    output = new TextViewer(page, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    output.getTextWidget().setLayoutData(new GridData(GridData.FILL_BOTH));
    output.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    output.setEditable(false);/*from  w  w  w .j av a 2 s  . c om*/
    output.setDocument(new Document());

    colorManager = new ColorManager();
    document = new OCLDocument();
    document.setOCLFactory(oclFactory);
    document.setModelingLevel(modelingLevel);

    input = new OCLSourceViewer(page, colorManager, SWT.BORDER | SWT.MULTI);
    input.setDocument(document);
    input.getTextWidget().addKeyListener(new InputKeyListener());

    selectionListener = new ISelectionListener() {
        public void selectionChanged(IWorkbenchPart part, ISelection selection) {
            OCLConsolePage.this.selectionChanged(selection);
        }
    };
    selectionService = getSite().getWorkbenchWindow().getSelectionService();
    selectionService.addPostSelectionListener(selectionListener);

    // get current selection
    selectionChanged(selectionService.getSelection());

    ((SashForm) page).setWeights(new int[] { 2, 1 });

    ClearOutputAction clear = new ClearOutputAction(output);
    CloseAction close = new CloseAction();
    SaveAction save = new SaveAction();
    LoadAction load = new LoadAction();

    IMenuManager menu = getSite().getActionBars().getMenuManager();
    menu.add(load);
    menu.add(save);
    menu.add(clear);
    menu.add(close);

    IMenuManager metamodelMenu = new MenuManager(OCLInterpreterMessages.console_metamodelMenu,
            "org.eclipse.emf.ocl.examples.interpreter.metamodel"); //$NON-NLS-1$
    menu.add(metamodelMenu);
    DropDownAction metamodelAction = new DropDownAction();
    metamodelAction.setToolTipText(OCLInterpreterMessages.console_metamodelTip);
    addMetamodelActions(metamodelMenu, metamodelAction);

    IMenuManager levelMenu = new MenuManager(OCLInterpreterMessages.console_modelingLevel);
    menu.add(levelMenu);
    DropDownAction levelAction = new DropDownAction();
    levelAction.setToolTipText(OCLInterpreterMessages.console_modelingLevelTip);
    IAction m2 = new ModelingLevelAction(ModelingLevel.M2);
    m2.setChecked(true);
    levelMenu.add(m2);
    levelAction.addAction(m2);
    IAction m1 = new ModelingLevelAction(ModelingLevel.M1);
    levelMenu.add(m1);
    levelAction.addAction(m1);

    ActionContributionItem metamodelItem = new ActionContributionItem(metamodelAction);
    metamodelItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);

    IToolBarManager toolbar = getSite().getActionBars().getToolBarManager();
    toolbar.appendToGroup(IConsoleConstants.OUTPUT_GROUP, metamodelItem);
    toolbar.appendToGroup(IConsoleConstants.OUTPUT_GROUP, levelAction);
    toolbar.appendToGroup(IConsoleConstants.OUTPUT_GROUP, load);
    toolbar.appendToGroup(IConsoleConstants.OUTPUT_GROUP, save);
    toolbar.appendToGroup(IConsoleConstants.OUTPUT_GROUP, clear);
    toolbar.appendToGroup(IConsoleConstants.OUTPUT_GROUP, close);
}

From source file:org.eclipse.emf.search.ui.pages.ModelSearchResultPage.java

License:Open Source License

private void addGroupActions(IToolBarManager mgr) {
    mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, new Separator("OpenEditorGroup"));
    mgr.appendToGroup("OpenEditorGroup", toggleOpenEditorButtonAction);
    updateGroupingActions();//from   w w w  .  java 2s  .c  o  m
}

From source file:org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceConsolePage.java

License:Open Source License

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

    IActionBars actionBars = getSite().getActionBars();
    fAutoFormat = new AutoFormatSettingAction(this);
    IToolBarManager toolBarManager = actionBars.getToolBarManager();
    toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fAutoFormat);
}

From source file:org.eclipse.jdt.internal.debug.ui.console.JavaStackTracePageParticipant.java

License:Open Source License

public void init(IPageBookViewPage page, IConsole console) {
    fCloseAction = new CloseConsoleAction(console);

    IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
    manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fCloseAction);

    fFormatAction = new FormatStackTraceActionDelegate((JavaStackTraceConsole) console);
}

From source file:org.eclipse.jetty.osgi.pde.launch.ui.console.JettyConsolePageParticipant.java

License:Open Source License

/**
 * Called during page initialization. Marks the start of this 
 * page participant's lifecycle./*from   www .j  av a  2  s.c om*/
 * 
 * @param page the page corresponding to the given console
 * @param console the console for which a page has been created
 */
public void init(IPageBookViewPage page, IConsole console) {
    if (!(console instanceof IOConsole)) {
        return;//we should not even be here as we are testing for the java property
        //in the plugin.xml so it is always an IOConsole
    }
    Object o = ((IOConsole) console).getAttribute("org.eclipse.debug.ui.ATTR_CONSOLE_PROCESS");
    if (o == null || !(o instanceof RuntimeProcess)) {
        return;
    }
    RuntimeProcess runProc = (RuntimeProcess) o;
    ILaunchConfiguration launchConfig = runProc.getLaunch().getLaunchConfiguration();
    if (launchConfig == null) {
        return;
    }
    try {
        ILaunchConfigurationType launchConfigType = launchConfig.getType();
        if (launchConfigType == null) {
            return;
        }
        boolean foundJetty = false;
        for (Object modes : launchConfigType.getSupportedModeCombinations()) {
            for (ILaunchDelegate del : launchConfigType.getDelegates((Set) modes)) {
                if (del.getDelegate() instanceof JettyEquinoxLaunchConfiguration) {
                    foundJetty = true;//oof
                    break;
                }
            }
            if (foundJetty) {
                break;
            }
        }
        if (!foundJetty) {
            return;
        }
    } catch (Exception e) {
        return;
    }

    _reloadWebapps = new ReloadDeployedWebappsAction(console, launchConfig);

    IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
    manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, _reloadWebapps);
}