@Override public void updateElement(UIElement element, Map parameters) { IWorkbenchLocationService wls = element .getServiceLocator() .getService(IWorkbenchLocationService.class); IWorkbenchWindow window = wls.getWorkbenchWindow(); if (window == null || !(window instanceof WorkbenchWindow)) return; element .setText(isCoolbarVisible((WorkbenchWindow) window) ? WorkbenchMessages.ToggleCoolbarVisibilityAction_hide_text : WorkbenchMessages.ToggleCoolbarVisibilityAction_show_text); }
/** * Updates the visibilty status of the element. */ @Override public void updateElement(UIElement element, Map parameters) { IWorkbenchLocationService wls = element .getServiceLocator() .getService(IWorkbenchLocationService.class); IWorkbenchWindow window = wls.getWorkbenchWindow(); if (!(window instanceof WorkbenchWindow)) return; MUIElement trimStatus = getTrimStatus((WorkbenchWindow) window); if(trimStatus != null) { element.setText(trimStatus.isVisible() ? WorkbenchMessages.ToggleStatusBarVisibilityAction_hide_text : WorkbenchMessages.ToggleStatusBarVisibilityAction_show_text); } }
@Override public void updateElement(UIElement element, Map parameters) { IWorkbenchWindow window = element .getServiceLocator().getService(IWorkbenchWindow.class); if (window == null) { return; } IWorkbenchPage page = window.getActivePage(); if (page == null) { return; } IEditorPart editor = page.getActiveEditor(); if (editor == null) { return; } IWorkbenchPartReference ref = page.getReference( editor); if (ref instanceof WorkbenchPartReference) { WorkbenchPartReference concreteRef = (WorkbenchPartReference) ref; element.setChecked(concreteRef.isPinned()); } }