コード例 #1
0
 private void activateContext() {
   IContextService service = (IContextService) getSite().getService(IContextService.class);
   if (service != null) {
     service.activateContext("org.eclipse.dltk.ui.scriptEditorScope");
     service.activateContext(EDITING_XQUERY_SOURCE_CONTEXT);
   }
 }
コード例 #2
0
  public void testBasicService() throws Exception {
    IWorkbenchWindow window = openTestWindow();
    IEvaluationService service = (IEvaluationService) window.getService(IEvaluationService.class);
    assertNotNull(service);

    MyEval listener = new MyEval();
    IContextActivation context1 = null;
    IEvaluationReference evalRef = null;
    IContextService contextService = null;
    try {
      evalRef =
          service.addEvaluationListener(
              new ActiveContextExpression(CONTEXT_ID1, new String[] {ISources.ACTIVE_CONTEXT_NAME}),
              listener,
              IEvaluationService.RESULT);
      assertEquals(1, listener.count);
      assertFalse(listener.currentValue);

      contextService = (IContextService) window.getService(IContextService.class);
      context1 = contextService.activateContext(CONTEXT_ID1);
      assertEquals(2, listener.count);
      assertTrue(listener.currentValue);

      contextService.deactivateContext(context1);
      context1 = null;
      assertEquals(3, listener.count);
      assertFalse(listener.currentValue);

      service.removeEvaluationListener(evalRef);
      evalRef = null;
      assertEquals(4, listener.count);

      context1 = contextService.activateContext(CONTEXT_ID1);
      assertEquals(4, listener.count);
      assertFalse(listener.currentValue);
      contextService.deactivateContext(context1);
      context1 = null;
      assertEquals(4, listener.count);
      assertFalse(listener.currentValue);
    } finally {
      if (context1 != null) {
        contextService.deactivateContext(context1);
      }
      if (evalRef != null) {
        service.removeEvaluationListener(evalRef);
      }
    }
  }
コード例 #3
0
  public void testTwoEvaluations() throws Exception {
    IWorkbenchWindow window = openTestWindow();
    IEvaluationService service = (IEvaluationService) window.getService(IEvaluationService.class);
    assertNotNull(service);

    MyEval listener1 = new MyEval();
    MyEval listener2 = new MyEval();
    IContextActivation context1 = null;
    IEvaluationReference evalRef1 = null;
    IEvaluationReference evalRef2 = null;
    IContextService contextService = null;
    try {
      evalRef1 =
          service.addEvaluationListener(
              new ActiveContextExpression(CONTEXT_ID1, new String[] {ISources.ACTIVE_CONTEXT_NAME}),
              listener1,
              IEvaluationService.RESULT);
      assertEquals(1, listener1.count);
      assertFalse(listener1.currentValue);

      evalRef2 =
          service.addEvaluationListener(
              new ActiveContextExpression(CONTEXT_ID1, new String[] {ISources.ACTIVE_CONTEXT_NAME}),
              listener2,
              IEvaluationService.RESULT);
      assertEquals(1, listener2.count);
      assertFalse(listener2.currentValue);
      evalRef2.setResult(true);

      contextService = (IContextService) window.getService(IContextService.class);
      context1 = contextService.activateContext(CONTEXT_ID1);
      assertEquals(2, listener1.count);
      assertTrue(listener1.currentValue);
      // we already set this guy to true, he should skip
      assertEquals(1, listener2.count);
      assertFalse(listener2.currentValue);

      evalRef1.setResult(false);
      contextService.deactivateContext(context1);
      context1 = null;
      assertEquals(2, listener2.count);
      assertFalse(listener2.currentValue);

      // we already set this guy to false, so he should be the old
      // values
      assertEquals(2, listener1.count);
      assertTrue(listener1.currentValue);

    } finally {
      if (context1 != null) {
        contextService.deactivateContext(context1);
      }
      if (evalRef1 != null) {
        service.removeEvaluationListener(evalRef1);
      }
      if (evalRef2 != null) {
        service.removeEvaluationListener(evalRef2);
      }
    }
  }
コード例 #4
0
 public synchronized void activateContext() {
   if (contextActivation == null) {
     contextActivation = contextService.activateContext(CONTROL_PANEL_CONTEXT_ID);
     bindingService.addBindingManagerListener(new BindingServiceListener());
     updateTriggerSequences();
   }
 }
コード例 #5
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
   * .Composite)
   */
  public void createPartControl(Composite parent) {
    Assert.isTrue(fViewer == null);

    fTypeComparator = new ScriptElementTypeComparator();

    // Setup viewer
    fViewer = createViewer(parent);

    initDragAndDrop();

    fLabelProvider = createLabelProvider();
    fViewer.setLabelProvider(createDecoratingLabelProvider(fLabelProvider));

    fViewer.setComparator(createModelElementComparator());
    fViewer.setUseHashlookup(true);
    fTitleProvider = createTitleProvider();

    createContextMenu();
    getSite().setSelectionProvider(fViewer);

    if (fMemento != null) { // initialize linking state before creating the
      // actions
      restoreLinkingEnabled(fMemento);
    }

    createActions(); // call before registering for selection changes
    addKeyListener();

    if (fMemento != null) restoreState(fMemento);

    getSite().setSelectionProvider(fViewer);

    // Status line
    IStatusLineManager slManager = getViewSite().getActionBars().getStatusLineManager();
    fViewer.addSelectionChangedListener(createStatusBarUpdater(slManager));

    hookViewerListeners();

    // Filters
    addFilters();

    // Initialize viewer input
    fViewer.setContentProvider(createContentProvider());
    setInitialInput();

    // Initialize selection
    setInitialSelection();
    fMemento = null;

    // Listen to page changes
    getViewSite().getPage().addPostSelectionListener(this);
    getViewSite().getPage().addPartListener(fPartListener);

    fillActionBars(getViewSite().getActionBars());
    IContextService ctxService = (IContextService) getSite().getService(IContextService.class);
    if (ctxService != null) {
      fContextActivation = ctxService.activateContext(DLTKUIPlugin.CONTEXT_VIEWS);
    }
    setHelp();
  }
コード例 #6
0
  public void testExtensionContributionExpression() throws Exception {
    IAction a =
        new Action() {
          @Override
          public void run() {
            System.out.println("Hello action");
          }
        };
    final MenuManager manager = new MenuManager();
    final ActionContributionItem aci = new ActionContributionItem(a);

    IExtensionRegistry reg = Platform.getExtensionRegistry();
    IExtensionPoint menusExtension = reg.getExtensionPoint("org.eclipse.ui.menus");
    IExtension extension = menusExtension.getExtension(EXTENSION_ID);

    IConfigurationElement[] mas = extension.getConfigurationElements();
    final Expression activeContextExpr[] = new Expression[1];
    for (IConfigurationElement ma : mas) {
      IConfigurationElement[] items = ma.getChildren();
      for (IConfigurationElement item : items) {
        String id = item.getAttribute("id");
        if (id != null && id.equals("org.eclipse.ui.tests.menus.itemX1")) {
          IConfigurationElement visibleWhenElement = item.getChildren("visibleWhen")[0];
          activeContextExpr[0] =
              ExpressionConverter.getDefault().perform(visibleWhenElement.getChildren()[0]);
        }
      }
    }
    assertNotNull("Failed to find expression", activeContextExpr[0]);
    AbstractContributionFactory factory =
        new AbstractContributionFactory(LOCATION, TestPlugin.PLUGIN_ID) {
          @Override
          public void createContributionItems(
              IServiceLocator menuService, IContributionRoot additions) {
            additions.addContributionItem(aci, activeContextExpr[0]);
          }
        };

    menuService.addContributionFactory(factory);
    menuService.populateContributionManager(manager, LOCATION);

    assertFalse("starting state", aci.isVisible());

    activeContext = contextService.activateContext(MenuContributionHarness.CONTEXT_TEST1_ID);
    final Menu menu = manager.createContextMenu(window.getShell());
    menu.notifyListeners(SWT.Show, new Event());
    assertTrue("active context", aci.isVisible());
    menu.notifyListeners(SWT.Hide, new Event());

    contextService.deactivateContext(activeContext);
    activeContext = null;

    menu.notifyListeners(SWT.Show, new Event());
    assertFalse("after deactivation", aci.isVisible());
    menu.notifyListeners(SWT.Hide, new Event());

    menuService.releaseContributions(manager);
    menuService.removeContributionFactory(factory);
    manager.dispose();
  }
コード例 #7
0
  /** @param newContextId The new context id */
  private void changeContext(String newContextId) {

    IContextService contextService = Utils.getContextService();
    if (previousActivation != null) {
      contextService.deactivateContext(previousActivation);
    }
    previousActivation = contextService.activateContext(newContextId);
  }
コード例 #8
0
 /**
  * We just store the input and site to catch events
  *
  * @param input : the input to set
  * @param site : the site to set
  */
 @Override
 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
   IContextService contextService = (IContextService) site.getService(IContextService.class);
   contextService.activateContext(GRAPH_CONTEXT_ID);
   handlerService = (IHandlerService) site.getService(IHandlerService.class);
   setSite(site);
   setInput(input);
 }
コード例 #9
0
 @Override
 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
   super.init(site, input);
   IContextService contextService = (IContextService) getSite().getService(IContextService.class);
   if (contextService != null) {
     // This String constant is referenced in the plugin.xml
     contextService.activateContext("org.eclipse.emf.eson.ui.context");
   }
 }
コード例 #10
0
 @Override
 public void createPartControl(Composite parent) {
   IContextService contextService = (IContextService) getSite().getService(IContextService.class);
   // FIXME : before Eclipse Juno, this line was not necessary
   // see bug 367816 and bug 382218
   contextService.activateContext(
       "org.eclipse.gmf.runtime.diagram.ui.diagramContext"); //$NON-NLS-1$
   super.createPartControl(parent);
 }
コード例 #11
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.console.IConsolePageParticipant#activated()
  */
 public void activated() {
   // add EOF submissions
   IPageSite site = fPage.getSite();
   IHandlerService handlerService = (IHandlerService) site.getService(IHandlerService.class);
   IContextService contextService = (IContextService) site.getService(IContextService.class);
   fActivatedContext = contextService.activateContext(fContextId);
   fActivatedHandler =
       handlerService.activateHandler(
           "org.eclipse.debug.ui.commands.eof", fEOFHandler); // $NON-NLS-1$
   ErlideUIPlugin.getDefault().setConsolePage((ErlangConsolePage) fPage);
 }
コード例 #12
0
  public void testBasicContribution() throws Exception {

    IAction a =
        new Action() {
          @Override
          public void run() {
            System.out.println("Hello action");
          }
        };
    final MenuManager manager = new MenuManager();
    final ActionContributionItem item = new ActionContributionItem(a);
    final Expression activeContextExpr =
        new ActiveContextExpression(
            MenuContributionHarness.CONTEXT_TEST1_ID, new String[] {ISources.ACTIVE_CONTEXT_NAME});
    AbstractContributionFactory factory =
        new AbstractContributionFactory(LOCATION, TestPlugin.PLUGIN_ID) {
          @Override
          public void createContributionItems(
              IServiceLocator menuService, IContributionRoot additions) {
            additions.addContributionItem(item, activeContextExpr);
          }
        };

    menuService.addContributionFactory(factory);
    menuService.populateContributionManager(manager, LOCATION);

    Shell shell = window.getShell();

    // Test the initial menu creation
    final Menu menuBar = manager.createContextMenu(shell);
    Event e = new Event();
    e.type = SWT.Show;
    e.widget = menuBar;
    menuBar.notifyListeners(SWT.Show, e);

    assertFalse("starting state", item.isVisible());

    activeContext = contextService.activateContext(MenuContributionHarness.CONTEXT_TEST1_ID);
    menuBar.notifyListeners(SWT.Show, e);

    assertTrue("active context", item.isVisible());

    contextService.deactivateContext(activeContext);
    activeContext = null;
    menuBar.notifyListeners(SWT.Show, e);

    assertFalse("after deactivation", item.isVisible());

    menuService.releaseContributions(manager);
    menuService.removeContributionFactory(factory);
    manager.dispose();
  }
コード例 #13
0
 /*
  * @see IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
  */
 @Override
 public final void createPartControl(Composite parent) {
   internalCreatePartControl(parent);
   inititalizeColors();
   getSite().getWorkbenchWindow().getPartService().addPartListener(fPartListener);
   createActions();
   createContextMenu();
   fillActionBars(getViewSite().getActionBars());
   IContextService ctxService = (IContextService) getSite().getService(IContextService.class);
   if (ctxService != null) {
     fContextActivation = ctxService.activateContext(DLTKUIPlugin.CONTEXT_VIEWS);
   }
   PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), getHelpContextId());
 }
コード例 #14
0
ファイル: NotesPopup.java プロジェクト: Bluelich/xmind
  public int open() {
    IWorkbench workbench = window.getWorkbench();
    bindingService = (IBindingService) workbench.getAdapter(IBindingService.class);
    contextService = (IContextService) workbench.getAdapter(IContextService.class);
    if (bindingService != null) {
      registerWorkbenchCommands();
    }
    int ret = super.open();
    if (ret == OK) {
      if (contextService != null) {
        contextActivation = contextService.activateContext(CONTEXT_ID);
      }
      if (bindingService != null) {
        registerDialogCommands();
      }
    }
    activateJob();

    return ret;
  }
コード例 #15
0
ファイル: TaskEditor.java プロジェクト: harishpalk/mylyn_3.17
  @Override
  public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    if (!(input instanceof TaskEditorInput)) {
      throw new PartInitException(
          "Invalid editor input \"" + input.getClass() + "\""); // $NON-NLS-1$ //$NON-NLS-2$
    }

    super.init(site, input);

    this.taskEditorInput = (TaskEditorInput) input;
    this.task = taskEditorInput.getTask();

    // initialize selection
    site.getSelectionProvider().setSelection(new StructuredSelection(task));

    setPartName(input.getName());

    // activate context
    IContextService contextSupport = (IContextService) site.getService(IContextService.class);
    if (contextSupport != null) {
      contextSupport.activateContext(ID_EDITOR);
    }
  }
コード例 #16
0
  public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Code Folding
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // Occurrence initiation, need ITextResource and ISourceViewer.
    highlighting =
        new com.github.funthomas424242.rezeptsammler.rezept.resource.rezept.ui.RezeptHighlighting(
            getResource(), viewer, colorManager, this);

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    // turn projection mode on
    viewer.doOperation(ProjectionViewer.TOGGLE);
    codeFoldingManager =
        new com.github.funthomas424242.rezeptsammler.rezept.resource.rezept.ui
            .RezeptCodeFoldingManager(viewer, this);

    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext(
        "com.github.funthomas424242.rezeptsammler.rezept.resource.rezept.EditorScope");
  }
コード例 #17
0
  public void testScopedService() throws Exception {
    IWorkbenchWindow window = openTestWindow();
    IEvaluationService service = (IEvaluationService) window.getService(IEvaluationService.class);
    assertNotNull(service);
    assertTrue(service instanceof SlaveEvaluationService);

    MyEval listener = new MyEval();
    IContextActivation context1 = null;
    IContextService contextService = null;
    try {
      service.addEvaluationListener(
          new ActiveContextExpression(CONTEXT_ID1, new String[] {ISources.ACTIVE_CONTEXT_NAME}),
          listener,
          IEvaluationService.RESULT);
      assertEquals(1, listener.count);
      assertFalse(listener.currentValue);

      contextService = (IContextService) window.getWorkbench().getService(IContextService.class);
      context1 = contextService.activateContext(CONTEXT_ID1);
      assertEquals(2, listener.count);
      assertTrue(listener.currentValue);

      window.close();
      processEvents();
      assertEquals(3, listener.count);
      assertTrue(listener.currentValue);

      contextService.deactivateContext(context1);
      context1 = null;
      assertEquals(3, listener.count);
      assertTrue(listener.currentValue);
    } finally {
      if (context1 != null) {
        contextService.deactivateContext(context1);
      }
    }
  }
コード例 #18
0
ファイル: RConsolePage.java プロジェクト: donkang/statet
  @Override
  protected void initActions(
      final IServiceLocator serviceLocator, final HandlerCollection handlers) {
    super.initActions(serviceLocator, handlers);

    final IContextService contextService =
        (IContextService) serviceLocator.getService(IContextService.class);
    contextService.activateContext("de.walware.statet.r.actionSets.RSessionTools"); // $NON-NLS-1$

    fHelpContextProvider =
        RUIHelp.createEnrichedRHelpContextProvider(
            getInputGroup().getViewer(), IRUIHelpContextIds.R_CONSOLE);
    getInputGroup()
        .getViewer()
        .getTextWidget()
        .addHelpListener(
            new HelpListener() {
              public void helpRequested(final HelpEvent e) {
                PlatformUI.getWorkbench()
                    .getHelpSystem()
                    .displayHelp(fHelpContextProvider.getContext(null));
              }
            });
  }
コード例 #19
0
  public void testRestriction() {
    boolean temporarilyDisabled = true;
    if (temporarilyDisabled) return;

    IWorkbenchWindow window = openTestWindow();
    IEvaluationService evaluationService =
        (IEvaluationService) window.getService(IEvaluationService.class);
    assertNotNull(evaluationService);
    IContextService contextService = (IContextService) window.getService(IContextService.class);
    assertNotNull(contextService);

    Expression expression =
        new ActiveContextExpression(CONTEXT_ID1, new String[] {ISources.ACTIVE_CONTEXT_NAME});

    final boolean[] propertyChanged = new boolean[1];
    final boolean[] propertyShouldChange = new boolean[1];

    IPropertyChangeListener propertyChangeListener =
        new IPropertyChangeListener() {

          public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals("foo")) propertyChanged[0] = true;
          }
        };
    IEvaluationReference ref =
        evaluationService.addEvaluationListener(expression, propertyChangeListener, "foo");
    ((WorkbenchWindow) window).getMenuRestrictions().add(ref);

    IPropertyChangeListener propertyShouldChangeListener =
        new IPropertyChangeListener() {

          public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals("foo")) propertyShouldChange[0] = true;
          }
        };
    evaluationService.addEvaluationListener(expression, propertyShouldChangeListener, "foo");

    propertyChanged[0] = false;
    propertyShouldChange[0] = false;

    assertFalse(contextService.getActiveContextIds().contains(CONTEXT_ID1));
    IContextActivation activation = contextService.activateContext(CONTEXT_ID1);

    assertTrue(propertyChanged[0]);
    assertTrue(propertyShouldChange[0]);
    propertyChanged[0] = false;
    propertyShouldChange[0] = false;

    contextService.deactivateContext(activation);
    assertTrue(propertyChanged[0]);
    assertTrue(propertyShouldChange[0]);
    assertFalse(contextService.getActiveContextIds().contains(CONTEXT_ID1));
    activation = contextService.activateContext(CONTEXT_ID1);
    propertyChanged[0] = false;
    propertyShouldChange[0] = false;
    assertTrue(contextService.getActiveContextIds().contains(CONTEXT_ID1));

    // open second window
    IWorkbenchWindow window2 = openTestWindow();
    assertFalse(propertyChanged[0]);
    assertTrue(propertyShouldChange[0]);
    assertFalse(contextService.getActiveContextIds().contains(CONTEXT_ID1));
    propertyChanged[0] = false;
    propertyShouldChange[0] = false;

    window2.close();
    processEvents();

    assertTrue(contextService.getActiveContextIds().contains(CONTEXT_ID1));
    assertFalse(propertyChanged[0]);
    assertTrue(propertyShouldChange[0]);
  }
コード例 #20
0
 private IContextActivation activateContext(String contextId) {
   IContextActivation c = contextService.activateContext(contextId);
   testContextActivations.put(contextId, c);
   return c;
 }
コード例 #21
0
  public void activateHandlers() {
    ICommandService commandSupport = getSite().getService(ICommandService.class);
    IHandlerService handlerService = getSite().getService(IHandlerService.class);
    IContextService contextSupport = getSite().getService(IContextService.class);

    if (commandSupport != null && handlerService != null && contextSupport != null) {
      contextSupport.activateContext(ID_MEMORY_VIEW_CONTEXT);

      fAddHandler =
          new AbstractHandler() {
            @Override
            public Object execute(ExecutionEvent event) throws ExecutionException {
              IAdaptable context = DebugUITools.getPartDebugContext(getSite());
              if (context != null
                  && MemoryViewUtil.isValidSelection(new StructuredSelection(context))) {
                RetargetAddMemoryBlockAction action =
                    new RetargetAddMemoryBlockAction(MemoryView.this);
                action.run();
                action.dispose();
              }
              return null;
            }
          };
      handlerService.activateHandler(ID_ADD_MEMORY_BLOCK_COMMAND, fAddHandler);

      fToggleMonitorsHandler =
          new AbstractHandler() {
            @Override
            public Object execute(ExecutionEvent event) throws ExecutionException {
              ToggleMemoryMonitorsAction action = new ToggleMemoryMonitorsAction();
              action.init(MemoryView.this);
              action.run();
              action.dispose();
              return null;
            }
          };

      handlerService.activateHandler(
          ID_TOGGLE_MEMORY_MONITORS_PANE_COMMAND, fToggleMonitorsHandler);

      fNextMemoryBlockHandler =
          new AbstractHandler() {

            @Override
            public Object execute(ExecutionEvent event) throws ExecutionException {
              SwitchMemoryBlockAction action = new SwitchMemoryBlockAction();
              action.init(MemoryView.this);
              action.run();
              action.dispose();
              return null;
            }
          };
      handlerService.activateHandler(ID_NEXT_MEMORY_BLOCK_COMMAND, fNextMemoryBlockHandler);

      fCloseRenderingHandler =
          new AbstractHandler() {

            @Override
            public Object execute(ExecutionEvent event) throws ExecutionException {

              IMemoryRenderingContainer container = getContainer(fActivePaneId);
              if (container != null) {
                if (container instanceof RenderingViewPane) {
                  if (!((RenderingViewPane) container).canRemoveRendering()) return null;
                }
                IMemoryRendering activeRendering = container.getActiveRendering();
                if (activeRendering != null) {
                  container.removeMemoryRendering(activeRendering);
                }
              }

              return null;
            }
          };
      handlerService.activateHandler(ID_CLOSE_RENDERING_COMMAND, fCloseRenderingHandler);

      fNewRenderingHandler =
          new AbstractHandler() {

            @Override
            public Object execute(ExecutionEvent event) throws ExecutionException {

              IMemoryRenderingContainer container = getContainer(fActivePaneId);

              if (container != null && container instanceof RenderingViewPane) {
                RenderingViewPane pane = (RenderingViewPane) container;
                if (pane.canAddRendering()) pane.showCreateRenderingTab();
              }
              return null;
            }
          };
      handlerService.activateHandler(ID_NEW_RENDERING_COMMAND, fNewRenderingHandler);
    }
  }
コード例 #22
0
  /** @param newState */
  private void handleContextChanges(final Map<String, Object> newState) {
    /*
     * If inside a container binding, then activate the proper context
     */
    final boolean cb =
        newState.get(Constants.SOURCES_ACTIVE_CONTAINER_BINDING)
            != IEvaluationContext.UNDEFINED_VARIABLE;
    if (cb && myContainerContextContextActivation == null) {
      myContainerContextContextActivation =
          myContextService.activateContext(Constants.CONTAINER_CONTEXT_ID);
      if (Activator.getDefault().TRACE_CONTEXTS) {
        LogUtils.debug(this, "activated " + Constants.CONTAINER_CONTEXT_ID);
      }
    }
    if (!cb && myContainerContextContextActivation != null) {
      myContextService.deactivateContext(myContainerContextContextActivation);
      myContainerContextContextActivation = null;
      if (Activator.getDefault().TRACE_CONTEXTS) {
        LogUtils.debug(this, "deactivated " + Constants.CONTAINER_CONTEXT_ID);
      }
    }

    /*
     * If inside an value binding, then activate the proper context
     */
    final boolean vb =
        !cb
            && newState.get(Constants.SOURCES_ACTIVE_BINDING)
                != IEvaluationContext.UNDEFINED_VARIABLE;
    if (vb && myWidgetContextContextActivation == null) {
      myWidgetContextContextActivation =
          myContextService.activateContext(Constants.WIDGET_CONTEXT_ID);
      if (Activator.getDefault().TRACE_CONTEXTS) {
        LogUtils.debug(this, "activated " + Constants.WIDGET_CONTEXT_ID);
      }
    }
    if (!vb && myWidgetContextContextActivation != null) {
      myContextService.deactivateContext(myWidgetContextContextActivation);
      myWidgetContextContextActivation = null;
      if (Activator.getDefault().TRACE_CONTEXTS) {
        LogUtils.debug(this, "deactivated " + Constants.WIDGET_CONTEXT_ID);
      }
    }

    /*
     * Also activate the base context - this does not seem to happen automatically ???
     */
    final boolean bc =
        myContainerContextContextActivation != null || myWidgetContextContextActivation != null;
    if (bc && myBaseContextContextActivation == null) {
      myBaseContextContextActivation =
          myContextService.activateContext(Constants.COMMON_CONTEXT_ID);
      if (Activator.getDefault().TRACE_CONTEXTS) {
        LogUtils.debug(this, "activated " + Constants.COMMON_CONTEXT_ID);
      }
    }
    if (!bc && myBaseContextContextActivation != null) {
      myContextService.deactivateContext(myBaseContextContextActivation);
      myBaseContextContextActivation = null;
      if (Activator.getDefault().TRACE_CONTEXTS) {
        LogUtils.debug(this, "deactivated " + Constants.COMMON_CONTEXT_ID);
      }
    }
  }