List of usage examples for org.eclipse.jface.action IToolBarManager insertBefore
void insertBefore(String id, IAction action);
From source file:org.eclipse.help.ui.internal.views.HyperlinkTreePart.java
License:Open Source License
protected void contributeToToolBar(IToolBarManager tbm) { Action collapseAllAction = new Action() { public void run() { BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { doCollapseAll();//w w w. j a v a2s . c o m } }); } }; collapseAllAction .setImageDescriptor(HelpUIResources.getImageDescriptor(IHelpUIConstants.IMAGE_COLLAPSE_ALL)); collapseAllAction.setToolTipText(Messages.AllTopicsPart_collapseAll_tooltip); tbm.insertBefore("back", collapseAllAction); //$NON-NLS-1$ tbm.insertBefore("back", new Separator()); //$NON-NLS-1$ }
From source file:org.eclipse.help.ui.internal.views.SearchResultsPart.java
License:Open Source License
private void contributeToToolBar(IToolBarManager tbm) { /*/* www . j av a2s .c o m*/ * removeAllAction = new Action() { public void run() { clearResults(); } }; * removeAllAction.setImageDescriptor(HelpUIResources * .getImageDescriptor(IHelpUIConstants.IMAGE_REMOVE_ALL)); * removeAllAction.setToolTipText("Remove all hits"); * removeAllAction.setId("removeAll"); tbm.insertBefore("back", * removeAllAction); tbm.insertAfter("removeAll", new Separator()); */ boolean descOn = Platform.getPreferencesService().getBoolean(HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, false, null); boolean showCategories = Platform.getPreferencesService().getBoolean(HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_CATEGORIES, false, null); showCategoriesAction = new Action() { public void run() { updateResultSections(); IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID); pref.putBoolean(IHelpBaseConstants.P_KEY_SHOW_SEARCH_CATEGORIES, showCategoriesAction.isChecked()); try { pref.flush(); } catch (BackingStoreException e) { } } }; showCategoriesAction .setImageDescriptor(HelpUIResources.getImageDescriptor(IHelpUIConstants.IMAGE_SHOW_CATEGORIES)); showCategoriesAction.setChecked(showCategories); showCategoriesAction.setToolTipText(Messages.SearchResultsPart_showCategoriesAction_tooltip); showCategoriesAction.setId("categories"); //$NON-NLS-1$ tbm.insertBefore("back", showCategoriesAction); //$NON-NLS-1$ showDescriptionAction = new Action() { public void run() { updateResultSections(); IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID); pref.putBoolean(IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, showDescriptionAction.isChecked()); try { pref.flush(); } catch (BackingStoreException e) { } } }; showDescriptionAction .setImageDescriptor(HelpUIResources.getImageDescriptor(IHelpUIConstants.IMAGE_SHOW_DESC)); showDescriptionAction.setChecked(descOn); showDescriptionAction.setToolTipText(Messages.SearchResultsPart_showDescriptionAction_tooltip); showDescriptionAction.setId("description"); //$NON-NLS-1$ tbm.insertAfter("categories", showDescriptionAction); //$NON-NLS-1$ tbm.insertAfter("description", new Separator()); //$NON-NLS-1$ }
From source file:org.eclipse.osee.framework.ui.skynet.widgets.xmerge.MergeXWidget.java
License:Open Source License
private void setCompleteCommitItemVisible(boolean isVisible) { IToolBarManager manager = getToolBarManager(); boolean wasFound = manager.find(COMPLETE_COMMIT_ACTION_ID) != null; if (isVisible) { if (!wasFound) { manager.insertBefore(REFRESH_ACTION_ID, getCompleteCommitAction()); }//ww w. j ava 2 s. c o m } else if (wasFound) { manager.remove(COMPLETE_COMMIT_ACTION_ID); } manager.update(true); }
From source file:org.eclipse.php.composer.ui.console.TerminalConsolePage.java
License:Open Source License
@Override public void init(IPageSite pageSite) { super.init(pageSite); IToolBarManager toolBarManager = pageSite.getActionBars().getToolBarManager(); toolBarManager.insertBefore(IConsoleConstants.OUTPUT_GROUP, new GroupMarker(TOOLBAR_GROUP_ID)); toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, stopAction); toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, removeInactiveAction); }
From source file:org.eclipse.remote.internal.console.TerminalConsolePage.java
License:Open Source License
@Override public void init(IPageSite pageSite) { super.init(pageSite); IToolBarManager toolBarManager = pageSite.getActionBars().getToolBarManager(); toolBarManager.insertBefore(IConsoleConstants.OUTPUT_GROUP, new GroupMarker(TOOLBAR_GROUP_ID)); toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, connectAction); toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, disconnectAction); toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new ConsoleActionScrollLock(this)); toolBarManager.appendToGroup(TOOLBAR_GROUP_ID, new CloseConsoleAction(terminalConsole)); toolBarManager.insertAfter(TOOLBAR_GROUP_ID, new GroupMarker(CONTRIBUTIONS_GROUP_ID)); addToolbarContributions(toolBarManager); }
From source file:org.eclipse.sirius.diagram.ui.part.SiriusDiagramActionBarContributor.java
License:Open Source License
@Override public void init(IActionBars bars) { disableActionBarUIUpdates();/* www. j a va2 s . c o m*/ try { super.init(bars); IToolBarManager toolBarManager = bars.getToolBarManager(); toolBarManager.remove(ActionIds.MENU_COMPARTMENT); toolBarManager.remove(ActionIds.ACTION_COMPARTMENT_ALL); toolBarManager.remove(ActionIds.ACTION_COMPARTMENT_NONE); toolBarManager.remove(ActionIds.ACTION_HIDE_CONNECTION_LABELS); toolBarManager.remove(ActionIds.ACTION_SHOW_CONNECTION_LABELS); toolBarManager.remove(ActionIds.ACTION_SHOW_COMPARTMENT_TITLE); if (!isOldUIEnabled()) { // The actions create for the default GMF toolbar are no longer // useful. They must be removed from the toolbarManager and // disposed. This avoids unnecessary notifications and // calculations // on these actions. cleanOldToolBarGMFAction(toolBarManager, ActionIds.CUSTOM_FONT_NAME); cleanOldToolBarGMFAction(toolBarManager, ActionIds.CUSTOM_FONT_COLOR); cleanOldToolBarGMFAction(toolBarManager, ActionIds.CUSTOM_FONT_SIZE); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_FONT_ITALIC); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_FONT_BOLD); cleanOldToolBarGMFAction(toolBarManager, ActionIds.CUSTOM_FILL_COLOR); cleanOldToolBarGMFAction(toolBarManager, ActionIds.CUSTOM_LINE_COLOR); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_MAKE_SAME_SIZE_BOTH); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_AUTOSIZE); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_COPY_APPEARANCE_PROPERTIES); cleanOldToolBarGMFAction(toolBarManager, ActionIds.CUSTOM_ZOOM); cleanOldToolBarGMFAction(toolBarManager, ActionIds.MENU_ARRANGE); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ARRANGE_ALL); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ARRANGE_SELECTION); cleanOldToolBarGMFAction(toolBarManager, ActionIds.MENU_ARRANGE_TOOLBAR); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_TOOLBAR_ARRANGE_ALL); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_TOOLBAR_ARRANGE_SELECTION); cleanOldToolBarGMFAction(toolBarManager, ActionIds.MENU_SELECT); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_SELECT_ALL_CONNECTIONS); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_SELECT_ALL_SHAPES); cleanOldToolBarGMFAction(toolBarManager, ActionIds.MENU_SELECT_TOOLBAR); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_TOOLBAR_SELECT_ALL_SHAPES); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_TOOLBAR_SELECT_ALL_CONNECTIONS); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_TOOLBAR_SELECT_ALL); cleanOldToolBarGMFAction(toolBarManager, ActionIds.MENU_ALIGN); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ALIGN_BOTTOM); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ALIGN_CENTER); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ALIGN_LEFT); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ALIGN_MIDDLE); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ALIGN_RIGHT); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ALIGN_TOP); cleanOldToolBarGMFAction(toolBarManager, ActionIds.MENU_ROUTER); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ROUTER_OBLIQUE); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ROUTER_RECTILINEAR); cleanOldToolBarGMFAction(toolBarManager, ActionIds.ACTION_ROUTER_TREE); } else { Bundle uiWorkbenchBundle = Platform.getBundle("org.eclipse.ui.workbench"); //$NON-NLS-1$ Version junoStart = Version.parseVersion("3.103"); // Version keplerStart = Version.parseVersion("3.105"); if (uiWorkbenchBundle != null && uiWorkbenchBundle.getVersion().compareTo(junoStart) < 0) { // Do not reorder old ui toolbar for 4.x. IContributionItem arrange = toolBarManager.find(ActionIds.MENU_ARRANGE); IContributionItem diagram = toolBarManager.find(REFRESH_DIAGRAM); if (arrange != null && diagram != null) { toolBarManager.remove(arrange); toolBarManager.insertBefore(REFRESH_DIAGRAM, arrange); IContributionItem select = toolBarManager.find(ActionIds.MENU_SELECT); if (select != null) { toolBarManager.remove(select); toolBarManager.insertAfter(ActionIds.MENU_ARRANGE, select); IContributionItem align = toolBarManager.find(ActionIds.MENU_ALIGN); if (align != null) { toolBarManager.remove(align); toolBarManager.insertAfter(ActionIds.MENU_SELECT, align); toolBarManager.insertAfter(ActionIds.MENU_ALIGN, new Separator()); } } } IContributionItem setStyleItem = toolBarManager .find(SetStyleToWorkspaceImageAction.SET_STYLE_TO_WORKSPACE_IMAGE_ACTION_ID); IContributionItem copyApparenceItem = toolBarManager .find(ActionIds.ACTION_COPY_APPEARANCE_PROPERTIES); if (setStyleItem != null && copyApparenceItem != null) { toolBarManager.remove(setStyleItem); toolBarManager.insertBefore(ActionIds.ACTION_COPY_APPEARANCE_PROPERTIES, setStyleItem); } IContributionItem zoom = toolBarManager.find(ActionIds.CUSTOM_ZOOM); IContributionItem launchBehavior = toolBarManager.find(LAUNCH_BEHAVIOR); if (zoom != null && launchBehavior != null) { toolBarManager.remove(zoom); toolBarManager.insertAfter(LAUNCH_BEHAVIOR, zoom); } } } } finally { reenableActionBarUIUpdates(); } }
From source file:org.eclipse.tcf.te.ui.views.internal.View.java
License:Open Source License
/** * Adds the custom toolbar groups to the view toolbar. *///from w w w . ja v a 2s .c o m protected void addCustomToolbarGroups() { if (getViewSite() != null && getViewSite().getActionBars() != null) { IToolBarManager tbManager = getViewSite().getActionBars().getToolBarManager(); if (tbManager != null) { tbManager.insertBefore("FRAME_ACTION_GROUP_ID", new GroupMarker("group.new")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.new", new Separator("group.configure")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.configure", new Separator("group.connect")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.connect", new Separator("group.symbols.rd")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.symbols.rd", new GroupMarker("group.symbols")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.symbols", new Separator("group.launch")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.launch", new GroupMarker("group.launch.rundebug")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.launch.rundebug", new GroupMarker("group.launch.modes")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.launch.modes", new GroupMarker("group.launch.additions")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.launch.additions", new Separator("group.refresh")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.refresh", new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); //$NON-NLS-1$ } } }
From source file:org.eclipse.tm.te.ui.views.internal.View.java
License:Open Source License
/** * Adds the custom Target Explorer toolbar groups to the view toolbar. *///ww w .j a v a 2 s. com protected void addCustomToolbarGroups() { if (getViewSite() != null && getViewSite().getActionBars() != null) { IToolBarManager tbManager = getViewSite().getActionBars().getToolBarManager(); if (tbManager != null) { tbManager.insertBefore("FRAME_ACTION_GROUP_ID", new GroupMarker("group.new")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.new", new Separator("group.configure")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.configure", new Separator("group.connect")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.connect", new Separator("group.symbols.rd")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.symbols.rd", new GroupMarker("group.symbols")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.symbols", new Separator("group.refresh")); //$NON-NLS-1$ //$NON-NLS-2$ tbManager.appendToGroup("group.refresh", new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); //$NON-NLS-1$ } } }
From source file:org.eclipse.ui.internal.cheatsheets.views.CheatSheetHelpPart.java
License:Open Source License
/** * Contributes any actions we have to the toolbar. * * @param tbm the toolbar to contribute to *//*from w ww . j av a 2 s. com*/ private void contributeToToolBar(IToolBarManager tbm) { IPath path = CheatSheetPlugin.ICONS_PATH.append(CheatSheetPlugin.T_ELCL).append("collapseall.gif");//$NON-NLS-1$ ImageDescriptor collapseImage = CheatSheetPlugin .createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path); CheatSheetExpandRestoreAction expandRestoreAction = new CheatSheetExpandRestoreAction( Messages.get().COLLAPSE_ALL_BUT_CURRENT_TOOLTIP, false, viewer); expandRestoreAction.setToolTipText(Messages.get().COLLAPSE_ALL_BUT_CURRENT_TOOLTIP); expandRestoreAction.setImageDescriptor(collapseImage); tbm.insertBefore("back", expandRestoreAction); //$NON-NLS-1$ tbm.insertBefore("back", new Separator()); //$NON-NLS-1$ viewer.setExpandRestoreAction(expandRestoreAction); }
From source file:org.splevo.ui.vpexplorer.explorer.VPExplorer.java
License:Open Source License
@Override public void createPartControl(Composite parent) { Composite intermediateParent = new Composite(parent, SWT.NONE); intermediateParent.setLayoutData(new GridData(GridData.FILL_BOTH)); final StackLayout layout = new StackLayout(); intermediateParent.setLayout(layout); Composite vpmLoadingComposite = loadVPMCompositeHandler.createControl(intermediateParent); layout.topControl = vpmLoadingComposite; displayedCompositeSwitcher = new DisplayedCompositeSwitcher(layout, intermediateParent); super.createPartControl(intermediateParent); new CustomizableDescriptionHavingTreeViewerToolTip(getCommonViewer()); IActionBars actionBars = getViewSite().getActionBars(); IToolBarManager toolBar = actionBars.getToolBarManager(); if (toolBar.getItems().length > 0) { toolBar.insertBefore(toolBar.getItems()[0].getId(), new ExpandAllAction(this)); toolBar.insertBefore(toolBar.getItems()[0].getId(), new ExpandAllAction(this, MODE.VARIATIONPOINT)); toolBar.insertBefore(toolBar.getItems()[0].getId(), new SelectVisibleAction(this)); toolBar.insertBefore(toolBar.getItems()[0].getId(), new SwitchBackVPM(this)); } else {// ww w . jav a 2 s. c o m toolBar.add(new ExpandAllAction(this)); toolBar.add(new ExpandAllAction(this, MODE.VARIATIONPOINT)); toolBar.add(new SelectVisibleAction(this)); toolBar.add(new SwitchBackVPM(this)); } getCommonViewer().addSelectionChangedListener(mediator); getCommonViewer().addTreeListener(new ITreeViewerListener() { @Override public void treeCollapsed(TreeExpansionEvent event) { } @Override public void treeExpanded(TreeExpansionEvent event) { if (this != null && event.getSource() == getCommonViewer()) { expandTree(event.getElement()); } } }); getCommonViewer().addOpenListener(new IOpenListener() { @Override public void open(OpenEvent event) { if (!(event.getSelection() instanceof IStructuredSelection)) { return; } Object[] selection = ((IStructuredSelection) event.getSelection()).toArray(); if (!(selection.length > 0)) { return; } if (!getCommonViewer().getExpandedState(selection[0])) { return; } if (this != null && event.getSource() == getCommonViewer()) { expandTree(selection[0]); } } }); this.getCommonViewer().getTree().addFocusListener(new KeyFocusListener(CONTEXT_ID)); }