List of usage examples for org.eclipse.jface.action IToolBarManager insertAfter
void insertAfter(String id, IAction action);
From source file:org.eclipse.tm.te.ui.views.actions.NewActionProvider.java
License:Open Source License
@Override public void fillActionBars(IActionBars actionBars) { // If none of the actions got created, there is nothing to do here if (newWizardCommandActionToolbar == null) { return;//from w w w . ja v a2 s .c o m } // Get the toolbar manager IToolBarManager toolbar = actionBars.getToolBarManager(); // Check for the newWizard action in the toolbar. If found, // drop out immediately to avoid adding the items to the toolbar // again and again if (toolbar.find("org.eclipse.tm.te.ui.command.newWizards") != null) { //$NON-NLS-1$ return; } // Add the items to the toolbar toolbar.insertAfter(ICommonMenuConstants.GROUP_NEW, newWizardCommandActionToolbar); }
From source file:org.eclipse.tm.terminal.view.ui.tabs.TabFolderToolbarHandler.java
License:Open Source License
/** * Fill in the context menu content within the given manager. * * @param manager The menu manager. Must not be <code>null</code>. *//*from ww w .ja v a 2s . c o m*/ protected void doFillToolbar(IToolBarManager manager) { Assert.isNotNull(manager); // Note: For the toolbar, the actions are added from left to right! // So we start with the additions marker here which is the most // left contribution item. manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); manager.add(new Separator("anchor")); //$NON-NLS-1$ // we want that at the end NewTerminalViewAction newTerminalAction = null; // Loop all actions and add them to the menu manager for (AbstractTerminalAction action : toolbarActions) { // Add a separator before the clear all action or if the action is a separator if (action instanceof TabScrollLockAction || (action instanceof AbstractAction && ((AbstractAction) action).isSeparator())) { manager.insertAfter("anchor", new Separator()); //$NON-NLS-1$ } // skip new terminal view action for now if (action instanceof NewTerminalViewAction) { newTerminalAction = (NewTerminalViewAction) action; continue; } // Add the action itself manager.insertAfter("anchor", action); //$NON-NLS-1$ } // now add to the end if (newTerminalAction != null) { manager.add(newTerminalAction); } }
From source file:org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder.java
License:Open Source License
/** * Contributes action from the action descriptor into the provided tool * bar manager./* w w w .ja v a2s . com*/ */ protected boolean contributeToolbarAction(ActionDescriptor ad, IToolBarManager toolbar, boolean appendIfMissing) { if (ad.getContributionItem() == null || ad.getAction() == null) return false; // Get config data. String tpath = ad.getToolbarPath(); String tgroup = ad.getToolbarGroup(); if (tpath == null && tgroup == null) return false; // First remove existing toolbar item IContributionItem item = toolbar.find(ad.getId()); if (item != null) { toolbar.remove(ad.getId()); } // Find reference group. if (tgroup == null) tgroup = IWorkbenchActionConstants.MB_ADDITIONS; IContributionItem sep = toolbar.find(tgroup); if (sep == null) { if (appendIfMissing) toolbar.add(new Separator(tgroup)); else { Logger.log(Logger.ERROR, "Invalid Toolbar Extension (Group is invalid): " + ad.getId()); //$NON-NLS-1$ return false; } } // Add action to tool bar. try { if (sep != null && sep.isGroupMarker()) toolbar.appendToGroup(sep.getId(), ad.getAction()); else toolbar.insertAfter(tgroup, ad.getAction()); } catch (IllegalArgumentException e) { Logger.log(Logger.ERROR, "Invalid Toolbar Extension (Group is missing): " + ad.getId()); //$NON-NLS-1$ return false; } return true; }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.cpu.CpuSection.java
License:Open Source License
@Override protected void addToolBarActions(IToolBarManager manager) { suspendCpuProfilingAction.setEnabled(false); resumeCpuProfilingAction.setEnabled(false); clearCpuProfilingDataAction.setEnabled(false); manager.insertAfter("defaults", separator); //$NON-NLS-1$ if (manager.find(clearCpuProfilingDataAction.getId()) == null) { manager.insertAfter("defaults", clearCpuProfilingDataAction); //$NON-NLS-1$ }//from ww w . ja v a 2 s .co m if (manager.find(suspendCpuProfilingAction.getId()) == null) { manager.insertAfter("defaults", suspendCpuProfilingAction); //$NON-NLS-1$ } if (manager.find(resumeCpuProfilingAction.getId()) == null) { manager.insertAfter("defaults", resumeCpuProfilingAction); //$NON-NLS-1$ } if (manager.find(dumpCpuProfilingDataAction.getId()) == null) { manager.insertAfter("defaults", dumpCpuProfilingDataAction); //$NON-NLS-1$ } }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.mbean.MBeansSection.java
License:Open Source License
@Override protected void addToolBarActions(IToolBarManager manager) { manager.insertAfter("defaults", separator); //$NON-NLS-1$ if (manager.find(refreshAction.getId()) == null) { manager.insertAfter("defaults", refreshAction); //$NON-NLS-1$ }// ww w .j av a2 s . c o m }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.memory.HeapHistogramPage.java
License:Open Source License
/** * Adds the tool bar actions./*from w ww.j av a2 s .c om*/ * * @param manager * The tool bar manager */ void addToolBarActions(IToolBarManager manager) { manager.insertAfter("defaults", separator); //$NON-NLS-1$ if (manager.find(refreshAction.getId()) == null) { manager.insertAfter("defaults", refreshAction); //$NON-NLS-1$ } if (manager.find(garbageCollectorAction.getId()) == null) { manager.insertAfter("defaults", garbageCollectorAction); //$NON-NLS-1$ } if (manager.find(clearHeapDeltaAction.getId()) == null) { manager.insertAfter("defaults", clearHeapDeltaAction); //$NON-NLS-1$ } if (manager.find(dumpHeapAction.getId()) == null) { manager.insertAfter("defaults", dumpHeapAction); //$NON-NLS-1$ } if (manager.find(dumpHprofAction.getId()) == null) { manager.insertAfter("defaults", dumpHprofAction); //$NON-NLS-1$ } manager.update(true); }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.memory.SWTResourcesPage.java
License:Open Source License
/** * Adds the tool bar actions.//ww w .ja v a2s . c om * * @param manager * The tool bar manager */ void addToolBarActions(IToolBarManager manager) { manager.insertAfter("defaults", separator); //$NON-NLS-1$ if (manager.find(refreshAction.getId()) == null) { manager.insertAfter("defaults", refreshAction); //$NON-NLS-1$ } if (manager.find(clearSWTResourceAction.getId()) == null) { manager.insertAfter("defaults", clearSWTResourceAction); //$NON-NLS-1$ } manager.update(true); }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.thread.ThreadsSection.java
License:Open Source License
@Override protected void addToolBarActions(IToolBarManager manager) { manager.insertAfter("defaults", separator); //$NON-NLS-1$ if (manager.find(refreshAction.getId()) == null) { manager.insertAfter("defaults", refreshAction); //$NON-NLS-1$ }/* w w w. jav a2 s. c o m*/ if (manager.find(dumpThreadsAction.getId()) == null) { manager.insertAfter("defaults", dumpThreadsAction); //$NON-NLS-1$ } }
From source file:org.fusesource.ide.jvmmonitor.internal.ui.properties.timeline.TimelineSection.java
License:Open Source License
@Override protected void addToolBarActions(IToolBarManager manager) { manager.insertAfter("defaults", separator); //$NON-NLS-1$ if (manager.find(refreshAction.getId()) == null) { manager.insertAfter("defaults", refreshAction); //$NON-NLS-1$ }/*from w ww . j a v a2 s . c o m*/ if (manager.find(clearAction.getId()) == null) { manager.insertAfter("defaults", clearAction); //$NON-NLS-1$ } if (manager.find(newChartAction.getId()) == null) { manager.insertAfter("defaults", newChartAction); //$NON-NLS-1$ } }
From source file:org.jboss.tools.jmx.jvmmonitor.internal.ui.properties.cpu.CpuSection.java
License:Open Source License
@Override protected void addToolBarActions(IToolBarManager manager) { suspendCpuProfilingAction.setEnabled(false); resumeCpuProfilingAction.setEnabled(false); clearCpuProfilingDataAction.setEnabled(false); if (manager.find("separator") == null) { //$NON-NLS-1$ manager.insertAfter("defaults", new Separator("separator")); //$NON-NLS-1$ //$NON-NLS-2$ }//w w w. ja v a 2 s .c o m if (manager.find(clearCpuProfilingDataAction.getId()) == null) { manager.insertAfter("defaults", clearCpuProfilingDataAction); //$NON-NLS-1$ } if (manager.find(suspendCpuProfilingAction.getId()) == null) { manager.insertAfter("defaults", suspendCpuProfilingAction); //$NON-NLS-1$ } if (manager.find(resumeCpuProfilingAction.getId()) == null) { manager.insertAfter("defaults", resumeCpuProfilingAction); //$NON-NLS-1$ } if (manager.find(dumpCpuProfilingDataAction.getId()) == null) { manager.insertAfter("defaults", dumpCpuProfilingDataAction); //$NON-NLS-1$ } }