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$ } } }
/* (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { String param = event.getParameter(ID_PARAMETER_MODE); if (param == null || param.equals(fCurrentValue)) return null; fCurrentValue = param; CDebugCorePlugin.getDefault() .getPluginPreferences() .setValue(ICDebugConstants.PREF_STEP_MODE, fCurrentValue); IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); ICommandService service = window.getService(ICommandService.class); service.refreshElements(event.getCommand().getId(), null); return null; }