public static void removeFocusTracker(IServiceLocator serviceLocator, Control control) { if (PlatformUI.getWorkbench().isClosing()) { // TODO: it is a bug in eclipse. During workbench shutdown disposed service returned. return; } final IFocusService focusService = serviceLocator.getService(IFocusService.class); if (focusService != null) { focusService.removeFocusTracker(control); } else { log.debug("Focus service not found in " + serviceLocator); } }
public static boolean isContextActive(String contextId) { Collection<?> contextIds = PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getService(IContextService.class) .getActiveContextIds(); for (Object id : contextIds) { if (contextId.equals(id)) { return true; } } return false; }
public static void setHelp(Control control, String pluginId, String helpContextID) { PlatformUI.getWorkbench() .getHelpSystem() .setHelp(control, pluginId + "." + helpContextID); // $NON-NLS-1$ }
@Nullable public static Shell getActiveShell() { IWorkbench workbench = PlatformUI.getWorkbench(); return workbench == null ? null : getShell(workbench.getActiveWorkbenchWindow()); }