List of usage examples for org.eclipse.jface.action IContributionManager update
void update(boolean force);
From source file:net.refractions.udig.project.ui.internal.MapEditor.java
License:Open Source License
void doUpdateScaleLabel() { IContributionManager bar = mapEditorSite.getActionBars().getStatusLineManager(); if (bar == null) return;//w ww .j a v a2s . c o m ScaleRatioLabel label = (ScaleRatioLabel) bar.find(ScaleRatioLabel.SCALE_ITEM_ID); if (label == null) { label = new ScaleRatioLabel(this); bar.appendToGroup(StatusLineManager.MIDDLE_GROUP, label); label.setVisible(true); bar.update(true); } label.setViewportModel(getMap().getViewportModel()); }
From source file:net.refractions.udig.project.ui.internal.MapEditorWithPalette.java
License:Open Source License
/** * Updates the crs label in the statusbar. *///from w w w . j a v a2 s .co m protected void updateCRS() { Map map = getMap(); if (map == null) { getSite().getPage().closeEditor(this, false); return; } CoordinateReferenceSystem crs = map.getViewportModel().getCRS(); if (crs == null || crs.getName() == null) { return; } final String full = crs.getName().getCode(); if (full == null || isSame(full)) return; Display display = PlatformUI.getWorkbench().getDisplay(); if (display == null) display = Display.getDefault(); display.asyncExec(new Runnable() { public void run() { IContributionManager bar = mapEditorSite.getActionBars().getStatusLineManager(); if (bar == null) return; StatusBarButton label = (StatusBarButton) bar.find(StatusBarButton.CRS_ITEM_ID); if (label == null) { label = new StatusBarButton(StatusBarButton.CRS_ITEM_ID, full); bar.appendToGroup(StatusLineManager.MIDDLE_GROUP, label); label.setVisible(true); // StatusBarToolOptionsPage label2 = new StatusBarToolOptionsPage("An Id",editor); // bar.appendToGroup(StatusLineManager.BEGIN_GROUP, label2); // label2.setVisible(true); bar.update(true); return; } label.setText(full); } }); }
From source file:net.yatomiya.e4.ui.workbench.renderers.swt.MenuManagerRenderer.java
License:Open Source License
private void scheduleManagerUpdate(IContributionManager mgr) { // Bug 467000: Avoid repeatedly updating menu managers // This workaround is opt-in for 4.5 // >>> net_yatomiya_e4_ui_workbench_renderers_swt // always enable workaround. /*//from w ww. j a va 2 s . c o m boolean workaroundEnabled = Boolean.getBoolean("eclipse.workaround.bug467000"); //$NON-NLS-1$ if (!workaroundEnabled) { mgr.update(false); return; } */ // <<< net_yatomiya_e4_ui_workbench_renderers_swt synchronized (mgrToUpdate) { if (this.mgrToUpdate.isEmpty()) { Display display = context.get(Display.class); if (display != null && !display.isDisposed()) { display.timerExec(100, new Runnable() { @Override public void run() { Collection<IContributionManager> toUpdate = new LinkedHashSet<>(); synchronized (mgrToUpdate) { toUpdate.addAll(mgrToUpdate); mgrToUpdate.clear(); } for (IContributionManager mgr : toUpdate) { mgr.update(false); } } }); } // >>> net_yatomiya_e4_ui_workbench_renderers_swt //this.mgrToUpdate.add(mgr); // <<< net_yatomiya_e4_ui_workbench_renderers_swt } // >>> net_yatomiya_e4_ui_workbench_renderers_swt // Added. // It should be added when mgrToUpdate.size() > 0... bug ? this.mgrToUpdate.add(mgr); // << net_yatomiya_e4_ui_workbench_renderers_swt } }
From source file:org.apertium.api.translate.extensionpoint.contribution.statusbar.MTStatusBarExtensionPoint.java
License:Open Source License
@Override @SwtAsyncExec//w w w . j a v a2 s . c o m public void update() { if (!isVisible()) { setVisible(true); } IContributionManager contributionManager = getParent(); if (contributionManager != null) contributionManager.update(true); IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); try { if (workbenchWindow instanceof WorkbenchWindow) { ((WorkbenchWindow) workbenchWindow).getStatusLineManager().update(true); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.dawnsci.breadcrumb.navigation.views.AbstractNavigationView.java
License:Open Source License
/** * //ww w .ja va 2 s. co m * @param control * @param mode - may be null. If null, toolbar will not be updated. */ public void setActiveUI(Control control, INavigationDelegateMode mode) { contextStack.topControl = control; card.layout(); if (mode != null) { IContributionManager man = getViewSite().getActionBars().getToolBarManager(); for (INavigationDelegateMode key : pages.keySet()) pages.get(key).setActionsActive(false, man); pages.get(mode).setActionsActive(true, man); setPartName(mode.getLabel()); if (mode.hasIcon()) { AbstractNavigationView.this.setTitleImage(mode.getIcon().createImage()); } man.update(true); } }
From source file:org.dawnsci.plotting.tools.window.WindowTool.java
License:Open Source License
private void setActionsEnabled(boolean enabled) { if (getSite() == null) return;/* w w w . j ava 2 s .c om*/ IContributionManager[] mans = new IContributionManager[] { getSite().getActionBars().getToolBarManager(), getSite().getActionBars().getMenuManager() }; for (IContributionManager man : mans) { IContributionItem[] items = man.getItems(); for (IContributionItem item : items) { item.setVisible(enabled); } man.update(true); } }
From source file:org.eclipse.jubula.client.ui.rcp.widgets.StatusLineContributionItem.java
License:Open Source License
/** * Sets the conribution item visible and updates the contribution manager. * @param visible set visible.// w ww .j av a 2s . c o m */ private void updateContributionManager(boolean visible) { setVisible(visible); IContributionManager contributionManager = getParent(); if (contributionManager != null) { contributionManager.update(true); } }
From source file:org.eclipse.linuxtools.internal.docker.ui.utils.UIUtils.java
License:Open Source License
/** * Register the given ContributionManager with the given id. The * contribution manager gets unregistered on control disposal. * //www . j ava 2 s. co m * @param id * the id * @param contributionManager * the contribution manager * @param control * the control * * @see ContributionManager * @see IMenuService * @see DisposeListener */ public static void registerContributionManager(final String id, final IContributionManager contributionManager, final Control control) { Assert.isNotNull(id); Assert.isNotNull(contributionManager); Assert.isTrue(control != null && !control.isDisposed()); final IMenuService menuService = PlatformUI.getWorkbench().getService(IMenuService.class); menuService.populateContributionManager((ContributionManager) contributionManager, id); contributionManager.update(true); control.addDisposeListener( e -> menuService.releaseContributions((ContributionManager) contributionManager)); }
From source file:org.eclipse.ocl.examples.emf.validation.debug.ui.view.ValidityView.java
License:Open Source License
private void fillConstrainingColumnToolBar(IContributionManager manager) { manager.add(enableAllConstrainingNodesAction); manager.add(disableAllConstrainingNodesAction); manager.add(new Separator()); manager.add(disableAllUnusedConstrainingNodesAction); manager.update(true); }
From source file:org.eclipse.ocl.examples.emf.validation.debug.ui.view.ValidityView.java
License:Open Source License
private void fillValidatableColumnToolBar(IContributionManager manager) { manager.add(enableAllValidatableNodesAction); manager.add(disableAllValidatableNodesAction); manager.add(new Separator()); manager.add(disableAllUnusedValidatableNodesAction); manager.update(true); }