Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336184

Summary: [Commands] "The variable activeWorkbenchWindow.activePerspective is not defined"
Product: [Eclipse Project] Platform Reporter: Tom Crockett <Thomas.M.Crockett>
Component: IDEAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: francisu, prakash, pwebster, remy.suen
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=296728
Whiteboard: stalebug

Description Tom Crockett CLA 2011-02-02 22:38:21 EST
Build Identifier: 20100617-1415

On Mac, after launching the IDE and switching back to Eclipse as it loads, we get many stack traces similar to the following on the console:

!ENTRY org.eclipse.ui.navigator 4 2 2011-02-02 19:21:31.149
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.navigator".
!STACK 1
org.eclipse.core.runtime.CoreException: The variable activeWorkbenchWindow.activePerspective is not defined
	at org.eclipse.core.internal.expressions.WithExpression.evaluate(WithExpression.java:65)
	at org.eclipse.core.internal.expressions.ReferenceExpression.evaluate(ReferenceExpression.java:70)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
	at org.eclipse.core.internal.expressions.AndExpression.evaluate(AndExpression.java:29)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
	at org.eclipse.core.internal.expressions.EnablementExpression.evaluate(EnablementExpression.java:53)
	at org.eclipse.ui.internal.navigator.NavigatorPlugin$Evaluator.run(NavigatorPlugin.java:245)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.navigator.NavigatorPlugin.safeEvaluate(NavigatorPlugin.java:260)
	at org.eclipse.ui.internal.navigator.actions.CommonActionProviderDescriptor.isEnabledFor(CommonActionProviderDescriptor.java:235)
	at org.eclipse.ui.internal.navigator.actions.CommonActionDescriptorManager.addProviderIfRelevant(CommonActionDescriptorManager.java:258)
	at org.eclipse.ui.internal.navigator.actions.CommonActionDescriptorManager.findRelevantActionDescriptors(CommonActionDescriptorManager.java:235)
	at org.eclipse.ui.navigator.NavigatorActionService.fillActionBars(NavigatorActionService.java:248)
	at org.eclipse.ui.navigator.CommonNavigatorManager$2.run(CommonNavigatorManager.java:92)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.navigator.CommonNavigatorManager$UpdateActionBarsJob.runInUIThread(CommonNavigatorManager.java:87)
	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3586)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3279)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at our.custom.Application.start(Application.java:301)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
!SUBENTRY 1 org.eclipse.core.expressions 4 301 2011-02-02 19:21:31.152
!MESSAGE The variable activeWorkbenchWindow.activePerspective is not defined
!SUBENTRY 1 org.eclipse.core.expressions 4 301 2011-02-02 19:21:31.154
!MESSAGE The variable activeWorkbenchWindow.activePerspective is not defined

Reproducible: Always

Steps to Reproduce:
1) Register an ActionProvider for a common navigator, which is sensitive to the perspective:

   <actionProvider ...>
      <enablement>
         <with
               variable="activeWorkbenchWindow.activePerspective">
            <equals value="our.custom.perspective">
            </equals>
         </with>
     </enablement>
  <actionProvider>

2) Start up the IDE, then immediately switch to another app (for instance back to the eclipse you launched from). If the launched app stays in the foreground, this won't happen. You probably also have to open your custom navigator, quit, and restart for it to happen.

3) Many errors get printed on the console (see Details).

Once one returns the launched app to the foreground, presumably, the "activeWorkbenchWindow.activePerspective" variable gets registered somehow and everything works fine. 

This appears to be fairly innocuous, it's just an annoyance due to the spam on the console.
Comment 1 Tom Crockett CLA 2011-02-02 22:42:32 EST
Looks similar to bug 296728, but that was marked as fixed for 3.6 and this is still happening in 3.6.
Comment 2 Francis Upton IV CLA 2011-04-20 23:40:12 EDT
This is not really related to bug 296728 as that was an incorrect setting of the evaluation context. It seems that in this case everything is working as it's supposed to but the activePerspective is just not available.

I don't think there is anything we can do in CNF land about this (short of suppressing this particular error message for this particular variable which does not seem very nice).

Paul, can you comment on this?
Comment 3 Paul Webster CLA 2011-04-21 12:38:05 EDT
(In reply to comment #2)
> Paul, can you comment on this?

yes, it's shell activation events and the instantiated workbench that fills this in correctly.  If the app is coming up in the background, it's possible we're not updating as the workbench window is opened and the CNF is instantiated.

PW
Comment 4 Francis Upton IV CLA 2011-04-21 13:14:45 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > Paul, can you comment on this?
> 
> yes, it's shell activation events and the instantiated workbench that fills
> this in correctly.  If the app is coming up in the background, it's possible
> we're not updating as the workbench window is opened and the CNF is
> instantiated.
> 
> PW

Any ideas on how to best deal with this?
Comment 5 Francis Upton IV CLA 2011-04-22 11:01:04 EDT
I think this is more an issue for commands then rather than the CNF, there is little I can do about it.
Comment 6 Paul Webster CLA 2011-04-25 09:24:44 EDT
If someone (Tom?) provides me with a simple plugin that reproduces the problem for them, maybe I can make sure all provided variables are set to org.eclipse.core.expressions.IEvaluationContext.UNDEFINED_VARIABLE

PW
Comment 7 Eclipse Genie CLA 2019-08-05 15:32:07 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.