List of usage examples for org.eclipse.jface.action IToolBarManager update
void update(boolean force);
From source file:org.eclipse.ui.internal.intro.impl.presentations.FormIntroPartImplementation.java
License:Open Source License
protected void addToolBarActions() { // Handle menus: IActionBars actionBars = getIntroPart().getIntroSite().getActionBars(); IToolBarManager toolBarManager = actionBars.getToolBarManager(); actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(), forwardAction); actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(), backAction); toolBarManager.add(new Separator(IntroConfigurer.TB_ADDITIONS)); toolBarManager.add(homeAction);/*w w w . j a v a2 s . c o m*/ toolBarManager.add(backAction); toolBarManager.add(forwardAction); if (IntroPlugin.DEBUG_TOOLBAR) { toolBarManager.add(viewIntroModelAction); } toolBarManager.update(true); actionBars.updateActionBars(); updateNavigationActionsState(); }
From source file:org.eclipse.ui.internal.navigator.CommonNavigatorActionGroup.java
License:Open Source License
private void updateToolBar(IToolBarManager toolBar) { boolean hasBeenFrameActionsShown = frameActionsShown; frameActionsShown = backAction.isEnabled() || upAction.isEnabled() || forwardAction.isEnabled(); if (frameActionsShown != hasBeenFrameActionsShown) { if (hasBeenFrameActionsShown) { toolBar.remove(backAction.getId()); toolBar.remove(forwardAction.getId()); toolBar.remove(upAction.getId()); toolBar.remove(FRAME_ACTION_SEPARATOR_ID); } else {//w w w . j a v a2 s .c om toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, new Separator(FRAME_ACTION_SEPARATOR_ID)); toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, upAction); toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, forwardAction); toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, backAction); } toolBar.update(true); } }
From source file:org.eclipse.ui.views.bookmarkexplorer.BookmarkNavigator.java
License:Open Source License
/** * Adds this views contributions to the workbench. *//*from ww w . j av a2s .c o m*/ void addContributions() { ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); // Create the actions. openAction = new OpenBookmarkAction(this); openAction.setImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("elcl16/gotoobj_tsk.gif"));//$NON-NLS-1$ copyAction = new CopyBookmarkAction(this); copyAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); pasteAction = new PasteBookmarkAction(this); pasteAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); removeAction = new RemoveBookmarkAction(this); removeAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); removeAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); editAction = new EditBookmarkAction(this); selectAllAction = new SelectAllAction(this); showInNavigatorAction = new ShowInNavigatorAction(getViewSite().getPage(), viewer); // initializes action enabled state handleSelectionChanged(StructuredSelection.EMPTY); // Create dynamic menu mgr. Dynamic is currently required to // support action contributions. MenuManager mgr = new MenuManager(); mgr.setRemoveAllWhenShown(true); mgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); } }); Menu menu = mgr.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(mgr, viewer); // Add actions to the local tool bar IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager(); tbm.add(removeAction); tbm.add(openAction); tbm.update(false); // Register with action service. IActionBars actionBars = getViewSite().getActionBars(); actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteAction); actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeAction); actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAllAction); // Set the double click action. viewer.addOpenListener(new IOpenListener() { public void open(OpenEvent event) { openAction.run(); } }); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { handleSelectionChanged((IStructuredSelection) event.getSelection()); } }); viewer.getControl().addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { handleKeyPressed(e); } }); }
From source file:org.eclipse.ui.views.markers.internal.MarkerView.java
License:Open Source License
protected void initToolBar(IToolBarManager tbm) { tbm.add(deleteAction); tbm.add(getFilterAction()); tbm.update(false); }
From source file:org.eclipse.ui.views.markers.internal.ProblemView.java
License:Open Source License
protected void initToolBar(IToolBarManager tbm) { tbm.add(getFilterAction()); tbm.update(false); }
From source file:org.eclipse.viatra.addon.viewers.runtime.zest.extensions.IncQueryViewersZestViewSupport.java
License:Open Source License
public void createToolbar() { refreshGraph.setImageDescriptor(//from w ww. j a v a2s . com ViewersZestPlugin.imageDescriptorFromPlugin(ViewersZestPlugin.PLUGIN_ID, "icons/refresh.gif")); clearGraph.setImageDescriptor( ViewersZestPlugin.imageDescriptorFromPlugin(ViewersZestPlugin.PLUGIN_ID, "icons/clear.gif")); IToolBarManager toolBarManager = getOwner().getViewSite().getActionBars().getToolBarManager(); toolBarManager.removeAll(); toolBarManager.add(refreshGraph); toolBarManager.add(clearGraph); if (owner instanceof IZoomableWorkbenchPart) { ZoomContributionViewItem toolbarZoomContributionViewItem = new ZoomContributionViewItem( (IZoomableWorkbenchPart) owner); toolBarManager.add(toolbarZoomContributionViewItem); toolBarManager.update(true); } IMenuManager menuManager = getOwner().getViewSite().getActionBars().getMenuManager(); menuManager.removeAll(); menuManager.add(createLayoutMenu()); }
From source file:org.eclipse.wb.internal.core.editor.structure.components.ComponentsTreePage.java
License:Open Source License
public void setToolBar(IToolBarManager toolBarManager) { {/*from ww w .ja va2 s . c o m*/ IAction action = new Action() { @Override public void run() { UiUtils.expandAll(m_viewer.getTree()); } }; toolBarManager.add(action); action.setImageDescriptor(DesignerPlugin.getImageDescriptor("expand_all.gif")); action.setToolTipText(Messages.ComponentsTreePage_expandAllAction); } { Action action = new Action() { @Override public void run() { UiUtils.collapseAll(m_viewer.getTree()); } }; toolBarManager.add(action); action.setImageDescriptor(DesignerPlugin.getImageDescriptor("collapse_all.gif")); action.setToolTipText(Messages.ComponentsTreePage_collapseAllAction); } toolBarManager.update(false); }
From source file:org.eclipse.wst.server.ui.internal.editor.ServerEditorActionBarContributor.java
License:Open Source License
/** * Sets the active editor for the contributor. * <p>// www . j a v a2s . c o m * The <code>EditorActionBarContributor</code> implementation of this method does * nothing. Subclasses may reimplement. This generally entails disconnecting * from the old editor, connecting to the new editor, and updating the actions * to reflect the new editor. * </p> * * @param targetEditor the new target editor */ public void setActiveEditor(IEditorPart targetEditor) { super.setActiveEditor(targetEditor); if (targetEditor != null && targetEditor.equals(editor)) return; IActionBars actionBars = getActionBars(); boolean actionBarsUpdated = false; if (editor != null) { editor.setStatus(null, null); IStatusLineManager status = actionBars.getStatusLineManager(); status.removeAll(); IToolBarManager tbm = actionBars.getToolBarManager(); tbm.removeAll(); actionBarsUpdated = true; } if (targetEditor instanceof ServerEditor) { editor = (ServerEditor) targetEditor; if (Trace.FINEST) { Trace.trace(Trace.STRING_FINEST, "Editor action bar contributor for: " + editor); } editor.updateUndoAction(); editor.updateRedoAction(); actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), editor.getUndoAction()); actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), editor.getRedoAction()); actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), editor.getCopyAction()); actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), editor.getCutAction()); actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), editor.getPasteAction()); IStatusLineManager status = actionBars.getStatusLineManager(); StatusLineContributionItem item = new StatusLineContributionItem("id"); status.add(item); editor.setStatus(status, item); editor.updateStatusLine(); IAction[] actions = editor.getEditorActions(); IToolBarManager tbm = actionBars.getToolBarManager(); tbm.add(new Separator(SERVER_EDITOR_SEPARATOR)); boolean modified = false; if (actions != null) { int size = actions.length; if (Trace.FINEST) { Trace.trace(Trace.STRING_FINEST, "Attempting to add editor actions: " + size); } for (int i = 0; i < size; i++) { if (Trace.FINEST) { Trace.trace(Trace.STRING_FINEST, "action: " + actions[i]); } tbm.appendToGroup(SERVER_EDITOR_SEPARATOR, actions[i]); modified = true; } } if (modified) tbm.update(false); actionBarsUpdated = true; } else editor = null; if (actionBarsUpdated) actionBars.updateActionBars(); }
From source file:org.eclipse.xtext.ui.editor.findrefs.ReferenceSearchViewPage.java
License:Open Source License
@Override public void createControl(Composite parent) { pagebook = new PageBook(parent, SWT.NULL); pagebook.setLayoutData(new GridData(GridData.FILL_BOTH)); busyLabel = new Table(pagebook, SWT.NONE); TableItem item = new TableItem(busyLabel, SWT.NONE); item.setText(Messages.ReferenceSearchViewPage_busyLabel); busyLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); control = new Composite(pagebook, SWT.NULL); control.setLayoutData(new GridData(GridData.FILL_BOTH)); control.setSize(100, 100);/*from www . ja v a 2s . co m*/ control.setLayout(new FillLayout()); viewer = new TreeViewer(control, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(labelProvider); viewer.setSorter(sorter); createOpenAndLinkWithEditorHandler(); IToolBarManager tbm = getSite().getActionBars().getToolBarManager(); fillToolbar(tbm); tbm.update(true); pagebook.showPage(control); isBusyShowing = false; queryListener = createQueryListener(); NewSearchUI.addQueryListener(queryListener); }
From source file:org.fusesource.ide.foundation.ui.views.ColumnViewSupport.java
License:Open Source License
protected void deactivateSection() { if (isSectionActivated) { isSectionActivated = false;/*from w w w . j a v a 2 s . com*/ // remove tool bar actions IToolBarManager toolBarManager = getToolBarManager(); if (toolBarManager != null) { removeToolBarActions(toolBarManager); toolBarManager.update(false); } // remove local menus IMenuManager menuManager = getMenuManager(); if (menuManager != null) { removeLocalMenus(menuManager); menuManager.update(false); } if (getActionBars() != null) { getActionBars().updateActionBars(); } // clear status line clearStatusLine(); } }