Java - Eclipse-RCP

activate own context

org.eclipse.ui.contexts
In the example it is set an own context at the receipt of the focus. At the loss of the focus, the context is removed again.


addFocusListener(new FocusListener() {
   IContextActivation context;
   IContextService service;
 
   @Override
   public void focusGained(FocusEvent e) {
      service = (IContextService)PlatformUIActivator.getDefault().getWorkbench().getService(IContextService.class);
      context = service.activateContext("com.sowas.javawiki.context");
      System.out.println("context activated");
   }
 
   @Override
   public void focusLost(FocusEvent e) {
      service.deactivateContext(context);
      System.out.println("context deactivated");
   }
});

Eigene Werkzeuge
Werkzeuge

gratis Counter by GOWEB
seit 9.10.2007