Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338576 - Add the platform IEvaluationContext as a parent for debug UI IEvaluationContexts
Summary: Add the platform IEvaluationContext as a parent for debug UI IEvaluationContexts
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks: 343751 337043
  Show dependency tree
 
Reported: 2011-03-01 14:09 EST by Michael Rennie CLA
Modified: 2011-05-26 14:36 EDT (History)
4 users (show)

See Also:
pwebster: review+


Attachments
proposed fix (14.59 KB, patch)
2011-03-01 14:09 EST, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rennie CLA 2011-03-01 14:09:46 EST
Created attachment 190077 [details]
proposed fix

Version: 3.7.0
Build id: I20110224-1726 (has always been this way)

In various places in org.eclipse.debug.ui we create IEvaluationContexts to compute the enablemment of, among other things, launch shortcuts. When we create these contexts we always pass in null as the parent context and set a single variable (usually the selection). We should be passing in the context from the platform's IEvaluationService as the parent to these new contexts so that all known platform variables can be supported for enablements as well.

A good example is in the launch shortcut case. Currently if you try to use the org.eclipse.core.runtime.Platform variable to determine bundle state (using the org.eclipse.core.runtime.bundleState property) in your launch shortcut enablement, you will get an exception that the variable is unknown.
Comment 1 Pawel Piech CLA 2011-03-01 16:51:48 EST
Make sense.  I'm curious what use case has prompted this bug though?
Comment 2 Michael Rennie CLA 2011-03-01 17:11:35 EST
(In reply to comment #1)
> Make sense.  I'm curious what use case has prompted this bug though?

Trying to fix the following:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=337043

I wanted to not show the launch and not have it considered for context launching unless the Rhino bundle was loaded.
Comment 3 Dani Megert CLA 2011-03-02 03:24:20 EST
Paul, can you confirm that this is the right thing to do?
Comment 4 Paul Webster CLA 2011-03-02 07:44:02 EST
This is an OK pattern.

Also used in the CNF:
org.eclipse.ui.internal.navigator.NavigatorPlugin.getEvalContext(Object)
org.eclipse.ui.internal.navigator.NavigatorPlugin.getEmptyEvalContext()

Comment:

If you are allowing the more general core expressions, you should consider whether you should set context.setAllowPluginActivation(true).

I'll also point out in the launch config you will be in the dialog scope, and some standard variables might not be available.

PW
Comment 5 Michael Rennie CLA 2011-03-22 12:55:15 EDT
applied patch to HEAD
Comment 6 Dani Megert CLA 2011-03-23 04:10:41 EDT
Is there a test case or steps that allow us to verify the fix?
Comment 7 Michael Rennie CLA 2011-03-23 09:59:47 EDT
(In reply to comment #6)
> Is there a test case or steps that allow us to verify the fix?

You can apply the patch from bug 337043 to verify the launch shortcut does not appear unless the bundle is loaded - testing that parent variables are being set. You can also run the LaunchConfigurationManagerTests tests in jdt.debug.tests to test that the old behavior is properly maintained.
Comment 8 Pawel Piech CLA 2011-05-06 18:51:49 EDT
Already reviewed.