List of usage examples for org.eclipse.jface.action IToolBarManager appendToGroup
void appendToGroup(String groupName, IAction action);
From source file:com.siteview.mde.internal.ui.util.OSGiConsolePageParticipant.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); }
From source file:com.siteview.mde.internal.ui.views.dependencies.DependenciesView.java
License:Open Source License
private void contributeToLocalToolBar(IToolBarManager manager) { manager.add(new Separator(TREE_ACTION_GROUP)); manager.add(new Separator("type")); //$NON-NLS-1$ manager.appendToGroup("type", fShowCallees); //$NON-NLS-1$ manager.appendToGroup("type", fShowCallers); //$NON-NLS-1$ manager.add(new Separator("presentation")); //$NON-NLS-1$ manager.appendToGroup("presentation", fShowTree); //$NON-NLS-1$ manager.appendToGroup("presentation", fShowList); //$NON-NLS-1$ manager.add(new Separator("history")); //$NON-NLS-1$ manager.appendToGroup("history", fShowLoops); //$NON-NLS-1$ manager.appendToGroup("history", fHistoryDropDownAction); //$NON-NLS-1$ }
From source file:com.sonatype.buildserver.eclipse.console.HudsonPageParticipant.java
License:Open Source License
private void configureToolBar(IToolBarManager mgr, final IConsole page) { getAllAction = new GetConsoleContent(console); getAllAction.setToolTipText(Messages.consoleView_getCompleteContent); getAllAction.setImageDescriptor(HudsonImages.getImageDescriptor(HudsonImages.SHOW_FULL_CONSOLE)); refreshAction = new Action("Refresh") { @Override//from w ww . j a v a 2 s. c o m public void run() { console.checkForUpdates(); } }; refreshAction.setToolTipText("Check for updates in remote Hudson build output"); refreshAction.setImageDescriptor(HudsonImages.getImageDescriptor(HudsonImages.REFRESH)); refreshAction.setEnabled(console.isRunning()); removeAction = new Action("Remove") { @Override public void run() { IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); consoleManager.removeConsoles(new IConsole[] { console }); } }; removeAction.setToolTipText("Remove remote Hudson build output"); removeAction.setImageDescriptor( PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_REMOVE)); removeAllAction = new Action("Remove All") { @Override public void run() { IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); List<IConsole> consoles = new ArrayList<IConsole>(); for (IConsole console : consoleManager.getConsoles()) { if (HudsonConsole.HUDSON_TYPE.equals(console.getType())) { consoles.add(console); } } if (!consoles.isEmpty()) { consoleManager.removeConsoles(consoles.toArray(new IConsole[0])); } } }; removeAllAction.setToolTipText("Remove all remote Hudson build outputs"); removeAllAction.setImageDescriptor( PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_REMOVEALL)); mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, getAllAction); mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, refreshAction); mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, removeAction); mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, removeAllAction); }
From source file:de.anbos.eclipse.logviewer.plugin.ConsolePageParticipant.java
License:Apache License
public void init(IPageBookViewPage myPage, IConsole console) { page = myPage;/*from ww w . j a v a 2s. c o m*/ 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(); } }); }
From source file:de.loskutov.anyedit.actions.SaveToFileParticipant.java
License:Open Source License
@Override public void init(IPageBookViewPage myPage, IConsole console) { page = myPage;/*from www .jav a2 s. c o m*/ IToolBarManager toolBarManager = page.getSite().getActionBars().getToolBarManager(); toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Separator()); toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Action("Save to file", getImageDescriptor()) { @Override public void run() { SaveToFileParticipant.this.run(this); } }); }
From source file:de.walware.ecommons.ui.mpbv.ManagedPageBookView.java
License:Open Source License
protected void contributeToActionBars(final IServiceLocator serviceLocator, final IActionBars actionBars, final HandlerCollection handlers) { final IToolBarManager toolBarManager = actionBars.getToolBarManager(); toolBarManager.add(new Separator(SharedUIResources.ADDITIONS_MENU_ID)); toolBarManager.add(new Separator(PAGE_CONTROL_MENU_ID)); {//from w ww.j a v a2 s .co m final IHandler2 handler = handlers.get(SharedUIResources.NEW_PAGE_COMMAND_ID); if (handler != null) { toolBarManager.appendToGroup(PAGE_CONTROL_MENU_ID, new HandlerContributionItem( new CommandContributionItemParameter(serviceLocator, null, SharedUIResources.NEW_PAGE_COMMAND_ID, HandlerContributionItem.STYLE_PUSH), handler)); } } toolBarManager.appendToGroup(PAGE_CONTROL_MENU_ID, new SimpleContributionItem( SharedUIResources.getImages().getDescriptor(SharedUIResources.LOCTOOL_CHANGE_PAGE_IMAGE_ID), null, "Pages", null, SimpleContributionItem.STYLE_PULLDOWN) { { setId("page_control.change_page"); //$NON-NLS-1$ } @Override protected void dropDownMenuAboutToShow(final IMenuManager manager) { manager.add(new ShowPageDropdownContribution<S>(ManagedPageBookView.this)); } @Override protected void execute() throws ExecutionException { if (fSessionHistory.size() >= 2) { showPage(fSessionHistory.get(1)); } } }); { final IHandler2 handler = handlers.get(SharedUIResources.CLOSE_PAGE_COMMAND_ID); if (handler != null) { toolBarManager.appendToGroup(PAGE_CONTROL_MENU_ID, new HandlerContributionItem(new CommandContributionItemParameter(serviceLocator, null, SharedUIResources.CLOSE_PAGE_COMMAND_ID, HandlerContributionItem.STYLE_PUSH), handler)); } } { final IHandler2 handler = handlers.get(SharedUIResources.CLOSE_ALL_PAGES_COMMAND_ID); if (handler != null) { toolBarManager.appendToGroup(PAGE_CONTROL_MENU_ID, new HandlerContributionItem(new CommandContributionItemParameter(serviceLocator, null, SharedUIResources.CLOSE_ALL_PAGES_COMMAND_ID, HandlerContributionItem.STYLE_PUSH), handler)); } } }
From source file:de.walware.ecommons.ui.mpbv.PageBookBrowserView.java
License:Open Source License
@Override protected void contributeToActionBars(final IServiceLocator serviceLocator, final IActionBars actionBars, final HandlerCollection handlers) { super.contributeToActionBars(serviceLocator, actionBars, handlers); final IMenuManager menuManager = actionBars.getMenuManager(); menuManager.add(new HandlerContributionItem(new CommandContributionItemParameter(serviceLocator, null, HandlerContributionItem.NO_COMMAND_ID, null, null, null, null, "Open in &external browser", null, null, HandlerContributionItem.STYLE_PUSH, null, false), handlers.get(OPEN_EXTERNAL_ID))); menuManager.add(new Separator("settings")); //$NON-NLS-1$ menuManager.appendToGroup("settings", //$NON-NLS-1$ new SimpleContributionItem("Preferences...", "P") { @Override//from w w w.j a va2s. co m protected void execute() throws ExecutionException { final Shell shell = getSite().getShell(); final List<String> pageIds = new ArrayList<String>(); PageBookBrowserView.this.collectContextMenuPreferencePages(pageIds); if (!pageIds.isEmpty() && (shell == null || !shell.isDisposed())) { org.eclipse.ui.dialogs.PreferencesUtil.createPreferenceDialogOn(shell, pageIds.get(0), pageIds.toArray(new String[pageIds.size()]), null).open(); } } }); final IToolBarManager toolBarManager = actionBars.getToolBarManager(); toolBarManager.insertBefore(SharedUIResources.ADDITIONS_MENU_ID, new Separator(BROWSERCONTROL_MENU_ID)); toolBarManager .appendToGroup(BROWSERCONTROL_MENU_ID, new HandlerContributionItem(new CommandContributionItemParameter(serviceLocator, null, NAVIGATE_BACK_ID, HandlerContributionItem.STYLE_PUSH), handlers.get(NAVIGATE_BACK_ID))); toolBarManager.appendToGroup(BROWSERCONTROL_MENU_ID, new HandlerContributionItem(new CommandContributionItemParameter(serviceLocator, null, NAVIGATE_FORWARD_ID, HandlerContributionItem.STYLE_PUSH), handlers.get(NAVIGATE_FORWARD_ID))); toolBarManager.insertAfter(BROWSERCONTROL_MENU_ID, new Separator(BOOKMARKS_MENU_ID)); toolBarManager.appendToGroup(BOOKMARKS_MENU_ID, new SimpleContributionItem( SharedUIResources.getImages().getDescriptor(SharedUIResources.LOCTOOL_FAVORITES_IMAGE_ID), null, "Manage Bookmarks", null, SimpleContributionItem.STYLE_PULLDOWN) { @Override protected void execute() throws ExecutionException { final ManageBookmarksDialog dialog = new ManageBookmarksDialog(PageBookBrowserView.this); dialog.open(); fBookmarks.save(); } @Override protected void dropDownMenuAboutToShow(final IMenuManager manager) { manager.add(new HandlerContributionItem(new CommandContributionItemParameter(serviceLocator, null, HandlerContributionItem.NO_COMMAND_ID, null, null, null, null, "Create Bookmark", "C", null, HandlerContributionItem.STYLE_PUSH, null, false), handlers.get(CREATE_BOOKMARK_ID))); manager.add(new Separator()); manager.add(new ShowBookmarksDropdownContribution.OpenBookmarkContributionItem( PageBookBrowserView.this, new BrowserBookmark("Home Page", getHomePageUrl()), null, "H")); manager.add(new Separator()); manager.add(new ShowBookmarksDropdownContribution(PageBookBrowserView.this)); } }); }
From source file:de.walware.ecommons.ui.workbench.AbstractEditorOutlinePage.java
License:Open Source License
protected void contributeToActionBars(final IServiceLocator serviceLocator, final IActionBars actionBars, final HandlerCollection handlers) { final IToolBarManager toolBarManager = actionBars.getToolBarManager(); toolBarManager.add(new Separator(SharedUIResources.VIEW_EXPAND_MENU_ID)); toolBarManager.appendToGroup(SharedUIResources.VIEW_EXPAND_MENU_ID, new HandlerContributionItem(new CommandContributionItemParameter(serviceLocator, null, NAVIGATE_COLLAPSE_ALL, HandlerContributionItem.STYLE_PUSH), handlers.get(NAVIGATE_COLLAPSE_ALL))); toolBarManager.add(new Separator(SharedUIResources.VIEW_SORT_MENU_ID)); final Separator viewFilter = new Separator(SharedUIResources.VIEW_FILTER_MENU_ID); viewFilter.setVisible(false);//from ww w. j a v a 2 s . c o m toolBarManager.add(viewFilter); }
From source file:de.walware.rj.eclient.graphics.RGraphicCompositeActionSet.java
License:Open Source License
public void contributeToActionsBars(final IServiceLocator serviceLocator, final IActionBars actionBars) { fActionBars.add(actionBars);// w w w .j a v a 2 s. c o m final IToolBarManager toolBar = actionBars.getToolBarManager(); if (toolBar.find(CONTEXT_MENU_GROUP_ID) == null) { toolBar.insertBefore(SharedUIResources.ADDITIONS_MENU_ID, new Separator(CONTEXT_MENU_GROUP_ID)); } if (toolBar.find(SIZE_MENU_GROUP_ID) == null) { toolBar.insertBefore(SharedUIResources.ADDITIONS_MENU_ID, new Separator(SIZE_MENU_GROUP_ID)); } final ImageRegistry rGraphicsImageRegistry = RGraphicsPlugin.getDefault().getImageRegistry(); toolBar.appendToGroup(CONTEXT_MENU_GROUP_ID, new HandlerContributionItem( new CommandContributionItemParameter(serviceLocator, null, HandlerContributionItem.NO_COMMAND_ID, null, rGraphicsImageRegistry.getDescriptor(RGraphicsPlugin.IMG_LOCTOOL_LOCATOR_DONE), null, null, "Stop Locator", null, null, HandlerContributionItem.STYLE_PUSH, null, true), fHandlerCollection.get(LOCATOR_DONE_COMMAND_ID))); toolBar.appendToGroup(CONTEXT_MENU_GROUP_ID, new HandlerContributionItem( new CommandContributionItemParameter(serviceLocator, null, HandlerContributionItem.NO_COMMAND_ID, null, rGraphicsImageRegistry.getDescriptor(RGraphicsPlugin.IMG_LOCTOOL_LOCATOR_CANCEL), null, null, "Cancel Locator", null, null, HandlerContributionItem.STYLE_PUSH, null, true), fHandlerCollection.get(LOCATOR_CANCEL_COMMAND_ID))); }
From source file:de.walware.rj.eclient.graphics.RGraphicCompositeActionSet.java
License:Open Source License
protected void addTestLocator(final IServiceLocator serviceLocator, final IActionBars actionBars) { final IToolBarManager toolBar = actionBars.getToolBarManager(); final IHandler2 handler = new AbstractHandler() { @Override/*from ww w. j a va 2 s. c o m*/ public void setEnabled(final Object evaluationContext) { setBaseEnabled(fGraphic != null && !fGraphic.isLocatorStarted()); } @Override public Object execute(final ExecutionEvent event) throws ExecutionException { if (fGraphic == null || fGraphic.isLocatorStarted()) { return null; } final AbstractLocalLocator locator = new AbstractLocalLocator(fGraphic) { @Override protected void finished(final List<double[]> graphic, final List<double[]> user) { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < user.size(); i++) { sb.append(Arrays.toString(user.get(i))).append("\n"); } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { MessageDialog.openInformation(null, "Locator Result", sb.toString()); } }); }; @Override protected void canceled() { }; }; locator.start(); return null; } }; fHandlerCollection.add(".locator.startTest", handler); toolBar.appendToGroup(CONTEXT_MENU_GROUP_ID, new HandlerContributionItem( new CommandContributionItemParameter(serviceLocator, null, HandlerContributionItem.NO_COMMAND_ID, null, SharedUIResources.getImages() .getDescriptor(SharedUIResources.LOCTOOL_SORT_SCORE_IMAGE_ID), null, null, "Test Locator", null, null, HandlerContributionItem.STYLE_PUSH, null, false), handler)); }