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.cdt.examples.dsf.gdb.ui.console.GdbExtendedConsolePageParticipant.java

License:Open Source License

private void addButtons() {
    IToolBarManager toolBarManager = fPage.getSite().getActionBars().getToolBarManager();
    IAction action = null;/*  w  w w.  j  a v  a  2  s .  c  om*/
    if (fConsole instanceof GdbBasicCliConsole) {
        action = new GdbExtendedSpecialBackgroundToggle(fConsole);
    } else if (fPage instanceof GdbFullCliConsolePage) {
        ITerminalViewControl terminalControl = ((GdbFullCliConsolePage) fPage).getTerminalViewControl();
        action = new GdbExtendedInfoThreadsAction(terminalControl);
    }
    toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, action);
}

From source file:org.eclipse.cdt.internal.ui.buildconsole.BuildConsolePage.java

License:Open Source License

protected void configureToolBar(IToolBarManager mgr) {
    mgr.insertBefore(IConsoleConstants.OUTPUT_GROUP, new GroupMarker(BuildConsole.ERROR_GROUP));
    mgr.appendToGroup(BuildConsole.ERROR_GROUP, fNextErrorAction);
    mgr.appendToGroup(BuildConsole.ERROR_GROUP, fPreviousErrorAction);
    mgr.appendToGroup(BuildConsole.ERROR_GROUP, fShowErrorAction);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fSaveLogAction);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fScrollLockAction);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fWrapAction);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fClearOutputAction);
}

From source file:org.eclipse.compare.internal.CompareEditorContributor.java

License:Open Source License

public void contributeToToolBar(IToolBarManager tbm) {
    tbm.add(new Separator(FILTER_SEPARATOR));
    tbm.add(new Separator(BUILTIN_SEPARATOR));
    tbm.appendToGroup(BUILTIN_SEPARATOR, fIgnoreWhitespace);
    tbm.appendToGroup(BUILTIN_SEPARATOR, fToolbarNext);
    tbm.appendToGroup(BUILTIN_SEPARATOR, fToolbarPrevious);
}

From source file:org.eclipse.compare.internal.win32.WordMergeViewer.java

License:Open Source License

private void initializeToolbar(IToolBarManager toolBarManager) {
    toolBarManager.add(new Separator("modes")); //$NON-NLS-1$
    toolBarManager.add(new Separator("file")); //$NON-NLS-1$
    CompareConfiguration configuration = getConfiguration();
    // For now, only support saving if one side is editable
    if (configuration.isRightEditable() || configuration.isLeftEditable()
            && (configuration.isRightEditable() != configuration.isLeftEditable())) {
        saveAction = new Action() {
            public void run() {
                saveDocument();//from   www  .  j  a va2s. com
            }
        };
        initAction(saveAction, getResourceBundle(), "action.save."); //$NON-NLS-1$
        toolBarManager.appendToGroup("file", saveAction); //$NON-NLS-1$
    }

    inplaceAction = new Action(CompareWin32Messages.WordMergeViewer_2, Action.AS_CHECK_BOX) {
        public void run() {
            toggleInplaceExternalState();
        }
    };
    initAction(inplaceAction, getResourceBundle(), "action.inplace."); //$NON-NLS-1$
    toolBarManager.appendToGroup("modes", inplaceAction); //$NON-NLS-1$

    toolBarManager.update(true);
}

From source file:org.eclipse.datatools.enablement.rcp.ApplicationActionBarAdvisor.java

License:Open Source License

/**
 * Update the build actions on the toolbar and menu bar based on the current
 * state of autobuild. This method can be called from any thread.
 * //from   w w w . jav a  2s.  c o  m
 * @param immediately
 *            <code>true</code> to update the actions immediately,
 *            <code>false</code> to queue the update to be run in the
 *            event loop
 */
void updateBuildActions(boolean immediately) {
    // this can be triggered by property or resource change notifications
    Runnable update = new Runnable() {
        public void run() {
            if (isDisposed) {
                return;
            }
            IWorkspace workspace = ResourcesPlugin.getWorkspace();
            IProject[] projects = workspace.getRoot().getProjects();
            boolean enabled = BuildUtilities.isEnabled(projects, IncrementalProjectBuilder.INCREMENTAL_BUILD);
            //update menu bar actions in project menu
            buildAllAction.setEnabled(enabled);
            buildProjectAction.setEnabled(enabled);
            toggleAutoBuildAction.setChecked(workspace.isAutoBuilding());
            cleanAction.setEnabled(BuildUtilities.isEnabled(projects, IncrementalProjectBuilder.CLEAN_BUILD));

            //update the cool bar build button
            ICoolBarManager coolBarManager = getActionBarConfigurer().getCoolBarManager();
            IContributionItem cbItem = coolBarManager.find(IWorkbenchActionConstants.TOOLBAR_FILE);
            if (!(cbItem instanceof IToolBarContributionItem)) {
                // This should not happen
                IDEWorkbenchPlugin.log("File toolbar contribution item is missing"); //$NON-NLS-1$
                return;
            }
            IToolBarContributionItem toolBarItem = (IToolBarContributionItem) cbItem;
            IToolBarManager toolBarManager = toolBarItem.getToolBarManager();
            if (toolBarManager == null) {
                // error if this happens, file toolbar assumed to always exist
                IDEWorkbenchPlugin.log("File toolbar is missing"); //$NON-NLS-1$
                return;
            }
            //add the build button if build actions are enabled, and remove it otherwise
            boolean found = toolBarManager.find(buildAllAction.getId()) != null;
            if (enabled && !found) {
                toolBarManager.appendToGroup(IWorkbenchActionConstants.BUILD_GROUP, buildAllAction);
                toolBarManager.update(false);
                toolBarItem.update(ICoolBarManager.SIZE);
            } else if (buildAllAction != null && found && !enabled) {
                toolBarManager.remove(buildAllAction.getId());
                toolBarManager.update(false);
                toolBarItem.update(ICoolBarManager.SIZE);
            }
        }
    };
    if (immediately) {
        update.run();
    } else {
        // Dispatch the update to be run later in the UI thread.
        // This helps to reduce flicker if autobuild is being temporarily disabled programmatically.
        Shell shell = window.getShell();
        if (shell != null && !shell.isDisposed()) {
            shell.getDisplay().asyncExec(update);
        }
    }
}

From source file:org.eclipse.datatools.sqltools.plan.internal.ui.view.PlanView.java

License:Open Source License

private void initializeToolBar() {
    IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
    createStandardGroups(tbm);/*  w ww  . j a  va  2 s . c o  m*/
    tbm.appendToGroup(GROUP_REMOVE, _removePlanAction);
    tbm.appendToGroup(GROUP_REMOVE, _removeAllPlansAction);
    tbm.appendToGroup(GROUP_IO, _savePlanAction);
    tbm.appendToGroup(GROUP_IO, _loadPlanAction);
    tbm.appendToGroup(GROUP_HISTORY, _plansDropDownAction);
    tbm.appendToGroup(GROUP_MODE, _planModeDropDownAction);
    _preferenceAction = new Action(Messages.getString("PlanView.preference")) //$NON-NLS-1$
    {
        public void run() {
            String[] preferencePages = { PreferenceConstants.PLAN_PREFERENCE_PAGE_ID };
            PreferencesUtil.createPreferenceDialogOn(null, preferencePages[0], preferencePages, null).open();
        }
    };
    _vLayoutAction = new VerticalLayoutAction(_graphicsControl.getSash());
    _hLayoutAction = new HorizontalLayoutAction(_graphicsControl.getSash());

    configPlanLayout();

    getViewSite().getActionBars().updateActionBars();
}

From source file:org.eclipse.debug.internal.ui.views.console.ProcessConsolePageParticipant.java

License:Open Source License

/**
 * Contribute actions to the toolbar/*w w w  .  java  2 s  .  co m*/
 */
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.debug.internal.ui.views.launch.LaunchView.java

License:Open Source License

protected void addDebugToolbarActions(IToolBarManager tbm) {
    tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(RESUME));
    tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(SUSPEND));
    tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(TERMINATE));
    tbm.appendToGroup(IDebugUIConstants.THREAD_GROUP, getAction(DISCONNECT));

    tbm.appendToGroup(IDebugUIConstants.STEP_INTO_GROUP, getAction(STEP_INTO));
    tbm.appendToGroup(IDebugUIConstants.STEP_OVER_GROUP, getAction(STEP_OVER));
    tbm.appendToGroup(IDebugUIConstants.STEP_RETURN_GROUP, getAction(STEP_RETURN));

    tbm.appendToGroup(IDebugUIConstants.EMPTY_STEP_GROUP, getAction(DROP_TO_FRAME));

    tbm.appendToGroup(IDebugUIConstants.RENDER_GROUP, getAction(TOGGLE_STEP_FILTERS));
}

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

License:Open Source License

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

    proposalsAction = new ContentAssistProposalsAction(getViewer());
    proposalsAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    proposalsHandler = new ActionHandler(proposalsAction);
    handlerService.activateHandler(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, proposalsHandler);

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

    IAction closeConsoleAction = createTerminateConsoleAction();

    IActionBars bars = getSite().getActionBars();

    IToolBarManager toolbarManager = bars.getToolBarManager();

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

    if (closeConsoleAction != null) {
        toolbarManager.appendToGroup(ScriptConsoleConstants.SCRIPT_GROUP, closeConsoleAction);
    }//from  ww w  . j a  v  a 2 s.c o m

    toolbarManager.appendToGroup(ScriptConsoleConstants.SCRIPT_GROUP, saveSessionAction);

    bars.updateActionBars();
}

From source file:org.eclipse.dltk.debug.ui.display.DebugConsolePage.java

License:Open Source License

protected void createActions() {
    super.createActions();
    final IActionBars actionBars = getSite().getActionBars();
    final IToolBarManager tbManager = actionBars.getToolBarManager();
    tbManager.appendToGroup(ScriptConsoleConstants.SCRIPT_GROUP, new OpenInputFieldAction(this));
    runAction = new RunInputFieldAction(this);
    tbManager.appendToGroup(ScriptConsoleConstants.SCRIPT_GROUP, runAction);
    resetOnLaunchAction = new ResetOnLaunchAction(this);
    resetOnLaunchAction.setChecked(resetOnLaunch);
    actionBars.getMenuManager().add(resetOnLaunchAction);
    updateActions();//from  ww  w  .j a v a  2  s.  c o  m

    normalPasteAction = (IAction) fGlobalActions.get(ActionFactory.PASTE.getId());
    normalCopyAction = (IAction) fGlobalActions.get(ActionFactory.COPY.getId());
    normalCutAction = (IAction) fGlobalActions.get(ActionFactory.CUT.getId());
    normalSelectAllAction = (IAction) fGlobalActions.get(ActionFactory.SELECT_ALL.getId());

}