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

Bug 391593

Summary: WizardDialog.run does not run in user context
Product: [RT] RAP Reporter: Markus Krüger <webmaster>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 1.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
A test app. none

Description Markus Krüger CLA 2012-10-10 14:27:50 EDT
Created attachment 222138 [details]
A test app.

Using getContainer().run(...) in a performFinish method of a wizard not runs the runnable in user context.

You can see it, if you start the test app with "-nl" set to a language your browser is not using. This way, you will get the locale of the browser outside of the runnable and inside you will get the default locale set with "-nl".
Calling UICallback.runFake...() and request the locale inside of this runnable will return the right locale.
So i think, that getContainer().run(...) needs to run with user context.
Comment 1 Ivan Furnadjiev CLA 2012-10-12 04:19:47 EDT
Markus, did you try to execute the WizardDialog.run with fork == false? Based on WizardDialog#run method JavaDoc, in order to execute the runnable in the UI thread you have to specify fork == false. Otherwise you have to ensure the correct context yourself as you pointed out - "Calling UICallback.runFake...() and request the locale inside of this runnable will return the right locale".
Comment 2 Markus Krüger CLA 2012-10-12 07:28:51 EDT
fork == false works as expected.
So it is a wanted behavior that these background threads are not called with user context? Is there a reason for this? I can not imagine a case where this might not be needed...
Comment 3 Ivan Furnadjiev CLA 2012-10-12 07:42:57 EDT
(In reply to comment #2)
> fork == false works as expected.
> So it is a wanted behavior that these background threads are not called with
> user context? Is there a reason for this? I can not imagine a case where this
> might not be needed...
This is an original JFace code and it is designed to behave that way. Running into the UI thread (fork = false) has the user context, running into the background thread (fork = true) you have to provide a context if needed. I don't want to changed it if it's not really necessary. I will close this bug as INVALID. Please reopen if you disagree.