List of usage examples for org.eclipse.jface.action ToolBarManager removeAll
@Override
public void removeAll()
From source file:com.android.ide.eclipse.adt.internal.editors.ui.tree.UiTreeBlock.java
License:Open Source License
private void createSectionActions(Section section, FormToolkit toolkit) { ToolBarManager manager = new ToolBarManager(SWT.FLAT); manager.removeAll(); ToolBar toolbar = manager.createControl(section); section.setTextClient(toolbar);/*from www .j av a 2 s. c o m*/ ElementDescriptor[] descs = mDescriptorFilters; if (descs == null && mUiRootNode != null) { descs = mUiRootNode.getDescriptor().getChildren(); } if (descs != null && descs.length > 1) { for (ElementDescriptor desc : descs) { manager.add(new DescriptorFilterAction(desc)); } } manager.add(new TreeSortAction()); manager.update(true /*force*/); }
From source file:com.atlassian.connector.eclipse.internal.crucible.ui.editor.parts.ExpandablePart.java
License:Open Source License
private void fillToolBar(ToolBarManager toolbarManager, boolean expanded) { if (!enableToolbar) { return;/*w ww .j av a 2s. c o m*/ } List<IReviewAction> toolbarActions = getToolbarActions(expanded); // for (Control control : actionsComposite.getChildren()) { // if (control instanceof ImageHyperlink) { // control.setMenu(null); // control.dispose(); // } // } toolbarManager.removeAll(); if (toolbarActions != null) { for (final IReviewAction action : toolbarActions) { action.setActionListener(actionListener); toolbarManager.add(action); // ImageHyperlink link = createActionHyperlink(actionsComposite, toolkit, action); // if (!action.isEnabled()) { // link.setEnabled(false); // } } } toolbarManager.markDirty(); toolbarManager.update(true); // actionsComposite.getParent().layout(); }
From source file:com.drgarbage.controlflowgraphfactory.compare.GraphMergeViewer.java
License:Apache License
protected void createToolItems(ToolBarManager toolBarManager) { /* remove not needed standard components*/ toolBarManager.removeAll(); /* graph compare algorithms actions */ //toolBarManager.add(new TopDownAlgAction(this)); toolBarManager.add(new TopDownMaxCommonAlgAction(this)); //toolBarManager.add(new BottomUpSubtreeAlgAction(this)); toolBarManager.add(new BottomUpMaxCommonAlgAction(this)); toolBarManager.add(new Separator()); toolBarManager.add(new ResetCompareGraphsViewAction(this)); toolBarManager.add(new SwapGraphsAction(this)); /* zoom actions */ toolBarManager.add(new Separator()); ScalableFreeformRootEditPart rootLeft = (ScalableFreeformRootEditPart) fLeft.getRootEditPart(); ScalableFreeformRootEditPart rootRight = (ScalableFreeformRootEditPart) fRight.getRootEditPart(); CompareZoomInAction zoomIn = new CompareZoomInAction(rootLeft.getZoomManager(), rootRight.getZoomManager()); zoomIn.setAccelerator(SWT.CTRL | 'I'); toolBarManager.add(zoomIn);/*w w w . j a va2s. c om*/ CompareZoomOutAction zoomOut = new CompareZoomOutAction(rootLeft.getZoomManager(), rootRight.getZoomManager()); zoomOut.setAccelerator(SWT.CTRL | 'O'); toolBarManager.add(zoomOut); }
From source file:com.liferay.ide.xml.search.ui.editor.LiferayCustomXmlHoverControl.java
License:Open Source License
protected void disposeDeferredCreatedContent() { Control[] children = parent.getChildren(); for (Control child : children) { child.dispose();//from w w w. j a va 2 s.c o m } ToolBarManager toolBarManager = getToolBarManager(); if (toolBarManager != null) { toolBarManager.removeAll(); } }
From source file:org.eclipse.acceleo.ui.interpreter.view.InterpreterView.java
License:Open Source License
/** * Populates the {@link #expressionSection}'s toolbar. * /*from w ww . j ava 2 s . c o m*/ * @param section * the expresssion section. */ protected void populateExpressionSectionToolbar(Section section) { ToolBarManager toolBarManager = getSectionToolBar(section); if (toolBarManager != null) { toolBarManager.removeAll(); toolBarManager.add(new EvaluateAction(this)); toolBarManager.add(new ClearExpressionViewerAction(getSourceViewer())); toolBarManager.update(true); } }
From source file:org.eclipse.acceleo.ui.interpreter.view.InterpreterView.java
License:Open Source License
/** * Populates the {@link #resultSection}'s toolbar. * /*from ww w . ja va 2s . co m*/ * @param section * the result section. */ protected void populateResultSectionToolbar(Section section) { ToolBarManager toolBarManager = getSectionToolBar(section); if (toolBarManager != null) { toolBarManager.removeAll(); toolBarManager.add(new ClearResultViewerAction(resultViewer)); toolBarManager.update(true); } }
From source file:org.eclipse.compare.codereview.compareEditor.RefacContentMergeViewer.java
License:Open Source License
private void initializeToolbars(Composite parent) { ToolBarManager tbm = (ToolBarManager) getToolBarManager(parent); if (tbm != null) { tbm.removeAll(); // define groups tbm.add(new Separator("modes")); //$NON-NLS-1$ tbm.add(new Separator("merge")); //$NON-NLS-1$ tbm.add(new Separator("navigation")); //$NON-NLS-1$ CompareConfiguration cc = getCompareConfiguration(); if (cc.isRightEditable()) { fCopyLeftToRightAction = new Action() { public void run() { copy(true);//from w ww .j a v a 2s . c o m } }; Utilities.initAction(fCopyLeftToRightAction, getResourceBundle(), "action.CopyLeftToRight."); //$NON-NLS-1$ tbm.appendToGroup("merge", fCopyLeftToRightAction); //$NON-NLS-1$ fHandlerService.registerAction(fCopyLeftToRightAction, "org.eclipse.compare.copyAllLeftToRight"); //$NON-NLS-1$ } if (cc.isLeftEditable()) { fCopyRightToLeftAction = new Action() { public void run() { copy(false); } }; Utilities.initAction(fCopyRightToLeftAction, getResourceBundle(), "action.CopyRightToLeft."); //$NON-NLS-1$ tbm.appendToGroup("merge", fCopyRightToLeftAction); //$NON-NLS-1$ fHandlerService.registerAction(fCopyRightToLeftAction, "org.eclipse.compare.copyAllRightToLeft"); //$NON-NLS-1$ } final ChangePropertyAction a = new ChangePropertyAction(fBundle, getCompareConfiguration(), "action.EnableAncestor.", ICompareUIConstants.PROP_ANCESTOR_VISIBLE); //$NON-NLS-1$ a.setChecked(fAncestorVisible); fAncestorItem = new ActionContributionItem(a); fAncestorItem.setVisible(false); tbm.appendToGroup("modes", fAncestorItem); //$NON-NLS-1$ tbm.getControl().addDisposeListener(a); createToolItems(tbm); updateToolItems(); tbm.update(true); } }
From source file:org.eclipse.compare.CompareViewerPane.java
License:Open Source License
/** * Clears tool items in the <code>CompareViewerPane</code>'s control bar. * // www .jav a 2 s . c o m * @param parent a <code>Composite</code> or <code>null</code> */ public static void clearToolBar(Composite parent) { ToolBarManager tbm = getToolBarManager(parent); if (tbm != null) { tbm.removeAll(); tbm.update(true); } }
From source file:org.eclipse.compare.internal.patch.PatchCompareEditorInput.java
License:Open Source License
public void contributeDiffViewerToolbarItems(Action[] actions, boolean workspacePatch) { ToolBarManager tbm = CompareViewerPane.getToolBarManager(viewer.getControl().getParent()); if (tbm != null) { tbm.removeAll(); tbm.add(new Separator("contributed")); //$NON-NLS-1$ for (int i = 0; i < actions.length; i++) { tbm.appendToGroup("contributed", actions[i]); //$NON-NLS-1$ }/*from w w w. ja v a2 s . c om*/ tbm.update(true); } }
From source file:org.eclipse.compare.structuremergeviewer.DiffTreeViewer.java
License:Open Source License
private void initialize(CompareConfiguration configuration) { Control tree = getControl();/*from www. ja v a 2 s . c o m*/ INavigatable nav = new INavigatable() { public boolean selectChange(int flag) { if (flag == INavigatable.FIRST_CHANGE) { setSelection(StructuredSelection.EMPTY); flag = INavigatable.NEXT_CHANGE; } else if (flag == INavigatable.LAST_CHANGE) { setSelection(StructuredSelection.EMPTY); flag = INavigatable.PREVIOUS_CHANGE; } // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 return internalNavigate(flag == INavigatable.NEXT_CHANGE, true); } public Object getInput() { return DiffTreeViewer.this.getInput(); } public boolean openSelectedChange() { return internalOpen(); } public boolean hasChange(int changeFlag) { return getNextItem(changeFlag == INavigatable.NEXT_CHANGE, false) != null; } }; tree.setData(INavigatable.NAVIGATOR_PROPERTY, nav); fLeftIsLocal = Utilities.getBoolean(configuration, "LEFT_IS_LOCAL", false); //$NON-NLS-1$ tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle()); Composite parent = tree.getParent(); fBundle = ResourceBundle.getBundle("org.eclipse.compare.structuremergeviewer.DiffTreeViewerResources"); //$NON-NLS-1$ // register for notification with the CompareConfiguration fCompareConfiguration = configuration; if (fCompareConfiguration != null) { fPropertyChangeListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { DiffTreeViewer.this.propertyChange(event); } }; fCompareConfiguration.addPropertyChangeListener(fPropertyChangeListener); } setContentProvider(new DiffViewerContentProvider()); setLabelProvider(new DiffViewerLabelProvider()); addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent se) { updateActions(); } }); setComparator(new DiffViewerComparator()); ToolBarManager tbm = CompareViewerPane.getToolBarManager(parent); if (tbm != null) { tbm.removeAll(); tbm.add(new Separator("merge")); //$NON-NLS-1$ tbm.add(new Separator("modes")); //$NON-NLS-1$ tbm.add(new Separator("navigation")); //$NON-NLS-1$ createToolItems(tbm); updateActions(); tbm.update(true); } MenuManager mm = new MenuManager(); mm.setRemoveAllWhenShown(true); mm.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager mm2) { fillContextMenu(mm2); if (mm2.isEmpty()) { if (fEmptyMenuAction == null) { fEmptyMenuAction = new Action(Utilities.getString(fBundle, "emptyMenuItem")) { //$NON-NLS-1$ // left empty }; fEmptyMenuAction.setEnabled(false); } mm2.add(fEmptyMenuAction); } } }); tree.setMenu(mm.createContextMenu(tree)); }