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

Bug 355999

Summary: ECPWorkspace.setActiveProject should be called in implementations
Product: [Modeling] ECP Reporter: Nikolay Kasyanov <corrmage>
Component: Model WorkspaceAssignee: Maximilian Koegel <mkoegel>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jhelming
Version: unspecified   
Target Milestone: 0.8.9   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch against latest 0.8x maintenance branch on svn
none
added some fix none

Description Nikolay Kasyanov CLA 2011-08-27 06:08:44 EDT
Build Identifier: I20110613-1736

I have not found way to listen changes of ECPWorkspace activeProject field, because EMFECPWorkspace doesn't call super.setActiveProject at all :( So, to detect active project change one should add listener to org.eclipse.emf.emfstore.client.model.Workspace

It's not implementation-agnostic, so I think implementations should call ECPWorkspace.setActiveProject, in methods like EMFECPWorkspace.setActiveModelElement

Reproducible: Always
Comment 1 Jonas Helming CLA 2011-08-30 05:26:22 EDT
I agree, that is because the EMFECPWorkspace forwards the active project calls. I think it would be sufficient if the EMFECPWorkspace creates the right notifications that the active project has changed.
Comment 2 Nikolay Kasyanov CLA 2011-08-30 11:37:50 EDT
I've tried to add super.setActiveProject to EMFECPWorkspace.setActiveModelElement and to remove overriden getActiveProject, looks good at first glance.
Comment 3 Jonas Helming CLA 2011-09-01 06:21:14 EDT
could you provide a patch for that?
Comment 4 Nikolay Kasyanov CLA 2011-09-01 11:49:47 EDT
Created attachment 202612 [details]
patch against latest 0.8x maintenance branch on svn

here it is
Comment 5 Nikolay Kasyanov CLA 2011-09-01 12:10:20 EDT
Created attachment 202616 [details]
added some fix
Comment 6 Nikolay Kasyanov CLA 2011-09-01 12:20:07 EDT
I see one potential issue: If in future another mapping.remove will be added, it should be guarded with check for active project. So, I see two ways:
1. Use HashMap with overridden remove method (which checks active project).
2. Leave all as for now and provide notification about changing activeProject field without actually changing it.
Comment 7 Jonas Helming CLA 2011-10-28 05:56:54 EDT
You switched to the 0.9.x branch now, right? I would rather apply this in the GIT, if you do not mind.
Comment 8 Nikolay Kasyanov CLA 2011-10-28 08:10:13 EDT
we haven't decided yet
Comment 9 Nikolay Kasyanov CLA 2012-02-02 03:29:20 EST
Any news on this?
On current (M920) version it seems that I cannot detect active project change at model level at all, because field Workspace.activeProjectSpace which I used for such detection removed.

The only way is to fix this bug I think. Point me if I'm wrong.
Comment 10 Jonas Helming CLA 2012-02-02 05:06:29 EST
current selection can be used instead, the concept of active project has been a duplicate.