Java Code Examples for org.eclipse.jface.action.IToolBarManager#update()
The following examples show how to use
org.eclipse.jface.action.IToolBarManager#update() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackageExplorerActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void updateToolBar(IToolBarManager toolBar) { boolean hasBeenFrameActionsShown= fFrameActionsShown; fFrameActionsShown= fBackAction.isEnabled() || fUpAction.isEnabled() || fForwardAction.isEnabled(); if (fFrameActionsShown != hasBeenFrameActionsShown) { if (hasBeenFrameActionsShown) { toolBar.remove(fBackAction.getId()); toolBar.remove(fForwardAction.getId()); toolBar.remove(fUpAction.getId()); toolBar.remove(FRAME_ACTION_SEPARATOR_ID); } else { toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, new Separator(FRAME_ACTION_SEPARATOR_ID)); toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fUpAction); toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fForwardAction); toolBar.prependToGroup(FRAME_ACTION_GROUP_ID, fBackAction); } toolBar.update(true); } }
Example 2
Source File: DisableButtonsByPerspectiveListener.java From statecharts with Eclipse Public License 1.0 | 5 votes |
private void enableEditingButtons(IToolBarManager tb, boolean isVisible) { for (String id : BUTTON_IDS) { IContributionItem item = tb.find(id); if (item != null) { item.setVisible(isVisible); } } tb.update(true); }
Example 3
Source File: GamaNavigator.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void createPartControl(final Composite compo) { this.parent = GamaToolbarFactory.createToolbars(this, compo); super.createPartControl(parent); restoreState(); final IToolBarManager tb = getViewSite().getActionBars().getToolBarManager(); for (final IContributionItem item : tb.getItems()) { if (item instanceof ActionContributionItem) { final ActionContributionItem aci = (ActionContributionItem) item; final IAction action = aci.getAction(); if (action instanceof LinkEditorAction) { link = action; tb.remove(aci); } else if (action instanceof org.eclipse.ui.internal.navigator.actions.CollapseAllAction) { tb.remove(aci); } } } linkItem.setSelection(link.isChecked()); tb.update(true); tb.insertBefore("toolbar.toggle", byDate.toCheckAction()); tb.insertBefore("toolbar.toggle", expandAll.toAction()); tb.insertBefore(expandAll.getId(), collapseAll.toAction()); try { final IDecoratorManager mgr = PlatformUI.getWorkbench().getDecoratorManager(); mgr.setEnabled("msi.gama.application.date.decorator", false); } catch (final CoreException e) { e.printStackTrace(); } properties = new PropertyDialogAction(new SameShellProvider(getSite().getShell()), getSite().getSelectionProvider()); findControl.initialize(); }
Example 4
Source File: PackageExplorerActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
void fillToolBar(IToolBarManager toolBar) { if (fBackAction.isEnabled() || fUpAction.isEnabled() || fForwardAction.isEnabled()) { toolBar.add(fBackAction); toolBar.add(fForwardAction); toolBar.add(fUpAction); toolBar.add(new Separator(FRAME_ACTION_SEPARATOR_ID)); fFrameActionsShown= true; } toolBar.add(new GroupMarker(FRAME_ACTION_GROUP_ID)); toolBar.add(fCollapseAllAction); toolBar.add(fToggleLinkingAction); toolBar.update(true); }
Example 5
Source File: TypeHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void fillMainToolBar(IToolBarManager tbmanager) { tbmanager.removeAll(); for (int i= 0; i < fViewActions.length; i++) { tbmanager.add(fViewActions[i]); } tbmanager.add(fHistoryDropDownAction); tbmanager.update(false); }
Example 6
Source File: ReferenceSearchViewPage.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@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); control.setLayout(new FillLayout()); viewer = new TreeViewer(control, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(labelProvider); viewer.setComparator(sorter); createOpenAndLinkWithEditorHandler(); IToolBarManager tbm = getSite().getActionBars().getToolBarManager(); fillToolbar(tbm); tbm.update(true); pagebook.showPage(control); isBusyShowing = false; queryListener = createQueryListener(); NewSearchUI.addQueryListener(queryListener); menu = new MenuManager("#PopUp"); //$NON-NLS-1$ menu.setRemoveAllWhenShown(true); menu.setParent(getSite().getActionBars().getMenuManager()); menu.addMenuListener(mgr -> { fillContextMenu(mgr); part.fillContextMenu(mgr); }); viewer.getControl().setMenu(menu.createContextMenu(viewer.getControl())); viewer.getControl().addKeyListener(KeyListener.keyPressedAdapter(e -> { if (e.keyCode == SWT.DEL) { removeSelectedMatchesAction.run(); } else if ((e.stateMask | SWT.COMMAND) != 0 && e.keyCode == 'c') { copyAction.run(); } })); }
Example 7
Source File: BasicFormPage.java From tlaplus with MIT License | 4 votes |
/** * Forces the form refresh */ public void refresh() { IManagedForm mForm = this.getManagedForm(); if (mForm != null) { IToolBarManager toolbarManager = mForm.getForm().getToolBarManager(); // get the usage status boolean modelRunning = getModel().isRunning(); // refresh the title String title = mForm.getForm().getText(); int titleIndex = Math.max(title.indexOf(RUNNING_TITLE), title.indexOf(CRASHED_TITLE)); // restore the title if (titleIndex != -1) { title = title.substring(0, titleIndex); } if (modelRunning) { if (getModel().isStale()) { mForm.getForm().setText(title + CRASHED_TITLE); } else { mForm.getForm().setText(title + RUNNING_TITLE); } } else { // restore the title, only if we need if (titleIndex != -1) { mForm.getForm().setText(title); } } // refresh the tool-bars toolbarManager.markDirty(); toolbarManager.update(true); if (headClientTBM != null) { headClientTBM.markDirty(); headClientTBM.update(true); } // refresh enablement status setEnabled(!modelRunning); mForm.getForm().update(); } }
Example 8
Source File: SvnRevPropertiesView.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * Adds the action contributions for this view. */ public void contributeActions() { // Contribute actions to popup menu for the table // MenuManager menuMgr = new MenuManager(); // Menu menu = menuMgr.createContextMenu(tableViewer.getTable()); // menuMgr.addMenuListener(new IMenuListener() { // public void menuAboutToShow(IMenuManager menuMgr) { // fillTableMenu(menuMgr); // } // }); // menuMgr.setRemoveAllWhenShown(true); // tableViewer.getTable().setMenu(menu); // getSite().registerContextMenu(menuMgr, tableViewer); // Create the local tool bar IActionBars actionBars = getViewSite().getActionBars(); IToolBarManager tbm = actionBars.getToolBarManager(); tbm.add(getRefreshAction()); tbm.update(false); // set F1 help PlatformUI.getWorkbench().getHelpSystem().setHelp(tableViewer.getControl(), IHelpContextIds.REV_PROPERTIES_VIEW); // set the selectionchanged listener for the table // updates property value when selection changes tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection == null || !(selection instanceof IStructuredSelection)) { textViewer.setDocument(new Document("")); //$NON-NLS-1$ return; } IStructuredSelection ss = (IStructuredSelection)selection; if (ss.size() != 1) { textViewer.setDocument(new Document("")); //$NON-NLS-1$ return; } ISVNProperty property = (ISVNProperty)ss.getFirstElement(); textViewer.setDocument(new Document(property.getValue())); } }); }
Example 9
Source File: SVNHistoryPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private void contributeActions() { toggleShowComments = new Action(Policy.bind("HistoryView.showComments"), //$NON-NLS-1$ SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_COMMENTS)) { public void run() { showComments = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_SHOW_COMMENTS, showComments); } }; toggleShowComments.setChecked(showComments); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextAction, // IHelpContextIds.SHOW_COMMENT_IN_HISTORY_ACTION); // Toggle wrap comments action toggleWrapCommentsAction = new Action(Policy.bind("HistoryView.wrapComments")) { //$NON-NLS-1$ public void run() { wrapCommentsText = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_WRAP_COMMENTS, wrapCommentsText); } }; toggleWrapCommentsAction.setChecked(wrapCommentsText); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleTextWrapAction, // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION); // Toggle path visible action toggleShowAffectedPathsAction = new Action(Policy.bind("HistoryView.showAffectedPaths"), //$NON-NLS-1$ SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_FLAT_MODE)) { public void run() { showAffectedPaths = isChecked(); setViewerVisibility(); store.setValue(ISVNUIConstants.PREF_SHOW_PATHS, showAffectedPaths); } }; toggleShowAffectedPathsAction.setChecked(showAffectedPaths); // PlatformUI.getWorkbench().getHelpSystem().setHelp(toggleListAction, // IHelpContextIds.SHOW_TAGS_IN_HISTORY_ACTION); // Toggle stop on copy action toggleStopOnCopyAction = new Action(Policy.bind("HistoryView.stopOnCopy")) { //$NON-NLS-1$ public void run() { refresh(); SVNUIPlugin.getPlugin().getPreferenceStore().setValue(ISVNUIConstants.PREF_STOP_ON_COPY, toggleStopOnCopyAction.isChecked()); } }; toggleStopOnCopyAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_STOP_ON_COPY)); // Toggle include merged revisions action toggleIncludeMergedRevisionsAction = new Action(Policy.bind("HistoryView.includeMergedRevisions")) { //$NON-NLS-1$ public void run() { store.setValue(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS, toggleIncludeMergedRevisionsAction.isChecked()); refreshTable(); refresh(); } }; toggleIncludeMergedRevisionsAction.setChecked(store.getBoolean(ISVNUIConstants.PREF_INCLUDE_MERGED_REVISIONS)); IHistoryPageSite parentSite = getHistoryPageSite(); IPageSite pageSite = parentSite.getWorkbenchPageSite(); IActionBars actionBars = pageSite.getActionBars(); // Contribute toggle text visible to the toolbar drop-down IMenuManager actionBarsMenu = actionBars.getMenuManager(); actionBarsMenu.add(getGetNextAction()); actionBarsMenu.add(getGetAllAction()); actionBarsMenu.add(toggleStopOnCopyAction); actionBarsMenu.add(toggleIncludeMergedRevisionsAction); actionBarsMenu.add(new Separator()); actionBarsMenu.add(toggleWrapCommentsAction); actionBarsMenu.add(new Separator()); actionBarsMenu.add(toggleShowComments); actionBarsMenu.add(toggleShowAffectedPathsAction); actionBarsMenu.add(new Separator()); for (int i = 0; i < toggleAffectedPathsModeActions.length; i++) { actionBarsMenu.add(toggleAffectedPathsModeActions[i]); } actionBarsMenu.add(new Separator()); for (int i = 0; i < toggleAffectedPathsLayoutActions.length; i++) { actionBarsMenu.add(toggleAffectedPathsLayoutActions[i]); } // Create the local tool bar IToolBarManager tbm = actionBars.getToolBarManager(); // tbm.add(getRefreshAction()); tbm.add(new Separator()); tbm.add(getSearchAction()); tbm.add(getClearSearchAction()); tbm.add(new Separator()); tbm.add(toggleShowComments); tbm.add(toggleShowAffectedPathsAction); tbm.add(new Separator()); tbm.add(getGetNextAction()); tbm.add(getGetAllAction()); // tbm.add(getLinkWithEditorAction()); tbm.update(false); actionBars.updateActionBars(); }
Example 10
Source File: TreeConflictsView.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private void createToolbar() { IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager(); toolbarManager.add(getRefreshAction()); toolbarManager.add(new Separator()); toolbarManager.update(false); }
Example 11
Source File: TypeHierarchyViewPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void clearMainToolBar(IToolBarManager tbmanager) { tbmanager.removeAll(); tbmanager.update(false); }