Java Code Examples for org.eclipse.ui.commands.ICommandService#refreshElements()
The following examples show how to use
org.eclipse.ui.commands.ICommandService#refreshElements() .
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: UIUtils.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public static void setCoolBarVisibility(boolean visible) { IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow(); if (activeWorkbenchWindow instanceof WorkbenchWindow) { WorkbenchWindow workbenchWindow = (WorkbenchWindow) activeWorkbenchWindow; workbenchWindow.setCoolBarVisible(visible); workbenchWindow.setPerspectiveBarVisible(visible); // Try to force a refresh of the text on the action IWorkbenchPart activePart = getActivePart(); if (activePart != null) { ICommandService cmdService = (ICommandService) activePart.getSite().getService(ICommandService.class); cmdService.refreshElements("org.eclipse.ui.ToggleCoolbarAction", null); //$NON-NLS-1$ } } }
Example 2
Source File: XLIFFEditorImplWithNatTable.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 改变当前布局 ; */ public void changeLayout() { isHorizontalLayout = !isHorizontalLayout; changeLayout(isHorizontalLayout); // 刷新工具栏的改变布局按钮的图片 ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements("net.heartsome.cat.ts.ui.handlers.ChangeXliffEditorModelCommand", null); }
Example 3
Source File: PatientDetailView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void releaseAndRefreshLock(IPersistentObject object, String commandId){ if (object != null && LocalLockServiceHolder.get().isLockedLocal(object)) { LocalLockServiceHolder.get().releaseLock(object); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(commandId, null); }
Example 4
Source File: KontaktBlatt.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public void runInUi(ElexisEvent ev){ Kontakt kontakt = (Kontakt) ev.getObject(); switch (ev.getType()) { case ElexisEvent.EVENT_SELECTED: Kontakt deselectedKontakt = actKontakt; setKontakt(kontakt); if (deselectedKontakt != null) { if (LocalLockServiceHolder.get().isLockedLocal(deselectedKontakt)) { LocalLockServiceHolder.get().releaseLock(deselectedKontakt); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench() .getService(ICommandService.class); commandService.refreshElements(ToggleCurrentKontaktLockHandler.COMMAND_ID, null); } break; case ElexisEvent.EVENT_DESELECTED: setEnabled(false); break; case ElexisEvent.EVENT_LOCK_AQUIRED: case ElexisEvent.EVENT_LOCK_RELEASED: if (kontakt.equals(actKontakt)) { save(); setUnlocked(ev.getType() == ElexisEvent.EVENT_LOCK_AQUIRED); } break; default: break; } }
Example 5
Source File: Patientenblatt2.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void releaseAndRefreshLock(IPersistentObject object, String commandId){ if (object != null && LocalLockServiceHolder.get().isLockedLocal(object)) { LocalLockServiceHolder.get().releaseLock(object); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(commandId, null); }
Example 6
Source File: StockSCSToggleArticleOutlay.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public Object execute(ExecutionEvent executionEvent) throws ExecutionException{ Command command = executionEvent.getCommand(); HandlerUtil.toggleCommandState(command); ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(executionEvent.getCommand().getId(), null); return null; }
Example 7
Source File: InvoiceCorrectionView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void releaseAndRefreshLock(IPersistentObject object, String commandId){ if (object != null && LocalLockServiceHolder.get().isLocked(object)) { LocalLockServiceHolder.get().releaseLock(object); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(commandId, null); }
Example 8
Source File: FallDetailView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void releaseAndRefreshLock(IPersistentObject object, String commandId){ if (object != null && LocalLockServiceHolder.get().isLockedLocal(object)) { LocalLockServiceHolder.get().releaseLock(object); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(commandId, null); }
Example 9
Source File: KonsDetailView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void releaseAndRefreshLock(Object object, String commandId){ if (object != null && LocalLockServiceHolder.get().isLockedLocal(object)) { LocalLockServiceHolder.get().releaseLock(object); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(commandId, null); }
Example 10
Source File: OpenToolBarHandler.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event); if (activeWorkbenchWindow instanceof WorkbenchWindow) { WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow; window.toggleToolbarVisibility(); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(event.getCommand().getId(), null); return null; }
Example 11
Source File: OpenStatusBarHandler.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); boolean oldValue = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status); ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.WorkbenchWindowAdvisor; configurer.setStatusVisible(!oldValue); preferenceStore.setValue(TsPreferencesConstant.TS_statusBar_status, !oldValue); ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(event.getCommand().getId(), null); return null; }
Example 12
Source File: OpenToolBarHandler.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event); if (activeWorkbenchWindow instanceof WorkbenchWindow) { WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow; window.toggleToolbarVisibility(); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(event.getCommand().getId(), null); return null; }
Example 13
Source File: OpenStatusBarHandler.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); boolean oldValue = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status); ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.WorkbenchWindowAdvisor; configurer.setStatusVisible(!oldValue); preferenceStore.setValue(TsPreferencesConstant.TS_statusBar_status, !oldValue); ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(event.getCommand().getId(), null); return null; }
Example 14
Source File: ApplicationWorkbenchWindowAdvisor.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override public void postWindowOpen() { IWorkbenchWindow workbenchWindow = getWindowConfigurer().getWindow(); // workbenchWindow.getShell().setMaximized(true); restorEditorHistory(); saveEditorHistory(); final ICommandService commandService = (ICommandService) workbenchWindow.getService(ICommandService.class); // 在程序主体窗口打开之前,更新打开工具栏的菜单,让它初始化菜单图片 --robert 2012-03-19 commandService.refreshElements("net.heartsome.cat.ts.openToolBarCommand", null); // 添加监听 addViewPartVisibleListener(workbenchWindow); addWorkplaceListener(); // 自动检查更新 automaticCheckUpdate(); // 设置将文件拖到导航视图时的模式为直接复制 setDragModle(); setListenerToPespective(commandService); setIdToHelpSystem(); setProgressIndicatorVisible(false); setInitLinkEnable(); // 处理 hunspell 内置词典内置文件 try { CommonFunction.unZipHunspellDics(); } catch (Exception e) { e.printStackTrace(); } }
Example 15
Source File: XLIFFEditorImplWithNatTable.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 改变当前布局 ; */ public void changeLayout() { isHorizontalLayout = !isHorizontalLayout; changeLayout(isHorizontalLayout); // 刷新工具栏的改变布局按钮的图片 ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements("net.heartsome.cat.ts.ui.handlers.ChangeXliffEditorModelCommand", null); }
Example 16
Source File: CommonEditorPlugin.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void setCommandState(boolean state) { ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); Command command = service.getCommand(COMMAND_ID); State commandState = command.getState(COMMAND_STATE); if (((Boolean) commandState.getValue()) != state) { commandState.setValue(state); service.refreshElements(COMMAND_ID, null); } }
Example 17
Source File: TreatWarningsAsErrors.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { GamaPreferences.Runtime.CORE_WARNINGS.set(!GamaPreferences.Runtime.CORE_WARNINGS.getValue()); final ICommandService service = HandlerUtil.getActiveWorkbenchWindowChecked(event).getService(ICommandService.class); service.refreshElements(event.getCommand().getId(), null); return null; }
Example 18
Source File: ErrorsPauseAndEdit.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { GamaPreferences.Runtime.CORE_REVEAL_AND_STOP.set(!GamaPreferences.Runtime.CORE_REVEAL_AND_STOP.getValue()); final ICommandService service = HandlerUtil.getActiveWorkbenchWindowChecked(event).getService(ICommandService.class); service.refreshElements(event.getCommand().getId(), null); return null; }
Example 19
Source File: ShowErrors.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { GamaPreferences.Runtime.CORE_SHOW_ERRORS.set(!GamaPreferences.Runtime.CORE_SHOW_ERRORS.getValue()); final ICommandService service = HandlerUtil.getActiveWorkbenchWindowChecked(event).getService(ICommandService.class); service.refreshElements(event.getCommand().getId(), null); if (GamaPreferences.Runtime.CORE_SHOW_ERRORS.getValue()) { GAMA.getGui().showView(null, ErrorView.ID, null, IWorkbenchPage.VIEW_VISIBLE); } else { WorkbenchHelper.hideView(ErrorView.ID); } return null; }
Example 20
Source File: ToggleMarkOccurrencesHandler.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
private static void setToggleState(boolean toggleState) { ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); service.refreshElements(COMMAND_ID, null); }