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

Bug 314959

Summary: IObjectActionDelegate use is problemmatic across multiple workbenches
Product: [RT] RAP Reporter: Austin Riddle <austin.riddle>
Component: WorkbenchAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3    
Version: 1.3   
Target Milestone: 1.3 RC3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed fix
ruediger.herrmann: review+
mylyn/context/zip none

Description Austin Riddle CLA 2010-05-28 16:53:11 EDT
In reference to:

http://www.eclipse.org/forums/index.php?t=msg&th=169015&start=0&

There is a bug in the handling of IObjectActionDelegate.

After testing in 1.2, it is clear that there used to be separate delegate instances per user.  In 1.3M7 there is a shared delegate for all users.

The implications of this are described in the thread above.
Comment 1 Austin Riddle CLA 2010-05-28 17:14:38 EDT
OK, I spoke too soon.  Repeated tests show that in both 1.2 and 1.3 there is a shared delegate, it is just that it is "possible" for the instance to be different because of the workbench logic behind it.  

This is still a very difficult issue for us to grapple with because we have so many object delegates in our code.
Comment 2 Ralf Sternberg CLA 2010-05-31 09:17:42 EDT
Created attachment 170520 [details]
Proposed fix

It seems that we have missed two singletons in the workbench: Turning the class ObjectActionContributorManager into a session singleton cures the problem, i.e. it results in separate IActionDelegate instances per user session.
Since Workbench#shutdown invokes dispose() on this singleton, I think it is clear that it is meant to have Workbench scope. The same is true for PropertyPageContributionManager.
Comment 3 Ralf Sternberg CLA 2010-05-31 09:17:47 EDT
Created attachment 170521 [details]
mylyn/context/zip
Comment 4 Ralf Sternberg CLA 2010-05-31 09:41:14 EDT
I'm convinced that the ObjectPluginAction instances (those are passed as parameter to the IObjectActionDelegate) should have session scope, as they contain state that is related to the workbench instance.
I'm not quite sure about the solution. Although it is simple and looks reasonable, it leads to reading the extension registry once for every application. Not sure if there is some better way to do it.

Please ignore the mylyn context, this slipped in here by accident.
Comment 5 Ralf Sternberg CLA 2010-06-01 04:05:05 EDT
Committed patch to CVS HEAD.