Ejemplo n.º 1
0
 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);
   }
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 public static void setHelp(Control control, String pluginId, String helpContextID) {
   PlatformUI.getWorkbench()
       .getHelpSystem()
       .setHelp(control, pluginId + "." + helpContextID); // $NON-NLS-1$
 }
Ejemplo n.º 4
0
 @Nullable
 public static Shell getActiveShell() {
   IWorkbench workbench = PlatformUI.getWorkbench();
   return workbench == null ? null : getShell(workbench.getActiveWorkbenchWindow());
 }