Java Code Examples for org.eclipse.jface.action.IToolBarManager#appendToGroup()

The following examples show how to use org.eclipse.jface.action.IToolBarManager#appendToGroup() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartExamplesView.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void createPartControl( Composite parent )
{
	ChartUIUtil.bindHelp( parent,
			ChartHelpContextIds.VIEW_CHART_EXAMPLE );
	
	instance = new ChartExamples( parent );

	final IActionBars actionBars = getViewSite( ).getActionBars( );
	IToolBarManager toolbarManager = actionBars.getToolBarManager( );
	Tools tools[] = ChartExamples.tools;
	String group = tools[0].group;
	toolbarManager.add( new GroupMarker( group ) );
	for ( int i = 0; i < tools.length; i++ )
	{
		Tools tool = tools[i];
		if ( !tool.group.equals( group ) )
		{
			toolbarManager.add( new Separator( ) );
			toolbarManager.add( new GroupMarker( tool.group ) );
		}
		group = tool.group;
		toolbarManager.appendToGroup( group, initActions( tool, parent ) );
	}
	actionBars.updateActionBars( );
}
 
Example 2
Source File: LocalAppEngineConsolePageParticipant.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
private void configureToolBar(IToolBarManager toolbarManager) {
  terminateAction = new Action(Messages.actionStop) {
    @Override
    public void run() {
      //code to execute when button is pressed
      LocalAppEngineServerBehaviour serverBehaviour = console.getServerBehaviourDelegate();
      if (serverBehaviour != null) {
        // try to initiate a nice shutdown
        boolean force = serverBehaviour.getServer().getServerState() == IServer.STATE_STOPPING;
        serverBehaviour.stop(force);
      }
      update();
    }
  };
  terminateAction.setToolTipText(Messages.actionStopToolTip);
  terminateAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP));
  terminateAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP));
  terminateAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP));

  toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);
}
 
Example 3
Source File: FlameChartView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @since 1.2
 */
@Override
protected void fillLocalToolBar(@Nullable IToolBarManager manager) {
    if (manager == null) {
        return;
    }
    makeActions();
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getConfigureSymbolsAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getShowFilterDialogAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getResetScaleAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getPreviousEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getNextEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getToggleBookmarkAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getPreviousMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getNextMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fPreviousItemAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fNextItemAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getZoomInAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getTimeGraphViewer().getZoomOutAction());
}
 
Example 4
Source File: AbstractTimeGraphView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Add contributions to the local tool bar manager. The contributions should be
 * appended to the {@link IWorkbenchActionConstants#MB_ADDITIONS} group.
 *
 * @param manager
 *            the tool bar manager
 */
protected void fillLocalToolBar(IToolBarManager manager) {
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, getHideEmptyRowsAction());
    if (fFilterColumns != null && fFilterLabelProvider != null && fFilterColumns.length > 0) {
        manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getShowFilterDialogAction());
    }
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getShowLegendAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getResetScaleAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getPreviousEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getNextEventAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getToggleBookmarkAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getPreviousMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getNextMarkerAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fPreviousResourceAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fNextResourceAction);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getZoomInAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, fTimeGraphViewer.getZoomOutAction());
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
}
 
Example 5
Source File: PydevConsole.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@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);
    }
}
 
Example 6
Source File: SocketConsolePageParticipant.java    From codewind-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
	if (console instanceof SocketConsole) {
		ShowOnContentChangeAction contentChange = new ShowOnContentChangeAction((SocketConsole)console);
		
		// Contribute to the toolbar
        IActionBars actionBars = page.getSite().getActionBars();
        IToolBarManager mgr = actionBars.getToolBarManager();
        mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, contentChange);
	}
}
 
Example 7
Source File: CppStyleConsolePage.java    From CppStyle with MIT License 5 votes vote down vote up
@Override
protected void configureToolBar(IToolBarManager mgr) {
	super.configureToolBar(mgr);
	fStdOut = new ShowStandardOutAction();
	fStdErr = new ShowStandardErrorAction();
	mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdOut);
	mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdErr);
}
 
Example 8
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addGroupActions(IToolBarManager mgr) {
	mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, new Separator(GROUP_GROUPING));
	mgr.appendToGroup(GROUP_GROUPING, fGroupProjectAction);
	mgr.appendToGroup(GROUP_GROUPING, fGroupPackageAction);
	mgr.appendToGroup(GROUP_GROUPING, fGroupFileAction);
	mgr.appendToGroup(GROUP_GROUPING, fGroupTypeAction);

	updateGroupingActions();
}
 
Example 9
Source File: ConsolePageParticipant.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
public void init(IPageBookViewPage myPage, IConsole console) {
       page = myPage;
       IToolBarManager toolBarManager = page.getSite().getActionBars()
       .getToolBarManager();
       toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Separator());
       toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Action(
       		LogViewerPlugin.getResourceString("logviewer.action.openwith.name"),
       		UIImages.getImageDescriptor(ILogViewerConstants.IMG_LOG_VIEWER)) {
           public void run() {
           	ConsolePageParticipant.this.run();
           }
       });
}
 
Example 10
Source File: ConsoleRestartLaunchPageParticipant.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
    try {
        if (!(console instanceof ProcessConsole)) {
            return;
        }
        ProcessConsole processConsole = (ProcessConsole) console;
        IProcess process = processConsole.getProcess();
        if (process == null) {
            return;
        }
        String attribute = process.getAttribute(IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR);
        if (!IMiscConstants.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();
    } catch (Exception e) {
        Log.log(e);
    }

}
 
Example 11
Source File: XtextBuildConsolePageParticipant.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
	fCloseAction = new CloseConsoleAction(console);
	
	IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
	manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fCloseAction);
}
 
Example 12
Source File: ReferenceSearchViewPage.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void fillToolbar(IToolBarManager tbm) {
	tbm.appendToGroup(IContextMenuConstants.GROUP_SHOW, showNextAction);
	tbm.appendToGroup(IContextMenuConstants.GROUP_SHOW, showPreviousAction);
	IActionBars actionBars = getSite().getActionBars();
	if (actionBars != null) {
		actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), showNextAction);
		actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), showPreviousAction);
	}
	tbm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, expandAllAction);
	tbm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, collapseAllAction);
}
 
Example 13
Source File: DeployConsolePageParticipant.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void configureToolBar(IToolBarManager toolbarManager) {
  terminateAction = createTerminateAction();
  toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);

  closeAction = createCloseAction();
  toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction);
}
 
Example 14
Source File: N4JSStackTracePageParticipant.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
	closeAction = new CloseConsoleAction(console);

	IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
	manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction);
}
 
Example 15
Source File: TypeScriptConsolePageParticipant.java    From typescript.java with MIT License 4 votes vote down vote up
protected void configureToolBar(IToolBarManager mgr) {
	mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, this.fTerminate);
}
 
Example 16
Source File: ToolsConsolePage.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void configureToolBar(IToolBarManager mgr) {
 super.configureToolBar(mgr);
 mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fScrollLockAction);
}
 
Example 17
Source File: XdsConsoleParticipant.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
	if (!(console instanceof IXdsConsole)) {
		return;
	}
	
       fPage = page;
       fConsole = (XdsConsole) console;

       IToolBarManager mgr = fPage.getSite().getActionBars().getToolBarManager();

       fTerminate = new XdsConsoleTerminateAction(page.getSite().getWorkbenchWindow(), fConsole);
	mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTerminate);
	
	String some_id = CONSOLE_DLG_ID + this.toString(); // unical, not used now to save state

	if (fTbaSync == null) {
	    // It is single action for all our consoles
           fTbaSync = new ToolbarActionButton(
                   "Link with editor", 
                   CONSOLE_DLG_ID + "_LinkWithEditor", true,    
                   ImageUtils.SYNC_WITH_EDITOR, false, getDialogSettings(),  
                   new IClosure<Boolean>(){   
                       @Override
                       public void execute(Boolean isChecked) {
                           XdsConsole.setLinkWithEditor(isChecked);
                       }
                   });
           XdsConsole.setLinkWithEditor(fTbaSync.isChecked()); // init from DialogSettings 
	}
	
       fTbaPrev = new ToolbarActionButton(
               "Previous message", 
               some_id + "_Prev", false,    
               ImageUtils.SEARCH_PREV, false, null,  
               new IClosure<Boolean>(){   
                   @Override
                   public void execute(Boolean isChecked) {
                       fConsole.goPrevNextMessage(true);
                   }
               });
       fTbaNext = new ToolbarActionButton(
               "Next message", 
               some_id + "_Next", false,    
               ImageUtils.SEARCH_NEXT, false, null,  
               new IClosure<Boolean>(){   
                   @Override
                   public void execute(Boolean isChecked) {
                       fConsole.goPrevNextMessage(false);
                   }
               });
       fTbaFilter = new ToolbarActionButton(
               "Filtered log", 
               CONSOLE_DLG_ID + "_FilteredLog", true,    
               ImageUtils.BTN_FILTER, false, getDialogSettings(),  
               new IClosure<Boolean>(){   
                   @Override
                   public void execute(Boolean isChecked) {
                       fConsole.setFilteredLog(isChecked);
                   }
               });
       if (console instanceof XdsConsole) {
           ((XdsConsole)console).setFilteredLogAction(fTbaFilter);
           ((XdsConsole)console).setFilteredLogInternal(fTbaFilter.isChecked(), false); // init from DialogSettings
       }

       mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTbaFilter);
       mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTbaPrev);
       mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTbaNext);
       mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTbaSync);
}
 
Example 18
Source File: XdsConsolePage.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
protected void configureToolBar(IToolBarManager mgr) {
    super.configureToolBar(mgr);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fScrollLockAction);
}
 
Example 19
Source File: ESBRuntimeConsolePageParticipant.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
private void configureToolBar(IToolBarManager mgr) {
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, startRuntimeAction);
    mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, haltRuntimeAction);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, openRuntimeInfoAction);
    mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, openRuntimePrefsAction);
}
 
Example 20
Source File: ScriptConsolePage.java    From Pydev with Eclipse Public License 1.0 2 votes vote down vote up
@Override
protected void createActions() {
    super.createActions();

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

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

    scrollLockAction = new ScrollLockAction((ScriptConsole) getConsole(),
            ScriptConsoleMessages.ScrollLockConsoleAction, ScriptConsoleMessages.ScrollLockConsoleTooltip);

    wordWrapAction = new WordWrapAction((ScriptConsole) getConsole(),
            ScriptConsoleMessages.WordWrapConsoleAction, ScriptConsoleMessages.WordWrapConsoleTooltip);

    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);

    toolbarManager.appendToGroup(SCRIPT_GROUP, scrollLockAction);

    toolbarManager.appendToGroup(SCRIPT_GROUP, wordWrapAction);

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

    bars.updateActionBars();
}