Bug 445111

Summary: [Model Import] Refactor->Switch Libraries causes side-effects which means stereotypes get dropped from models
Product: [Modeling] Papyrus Reporter: Ronan Bar <ronan.barrett>
Component: OthersAssignee: Camille Letavernier <cletavernier>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P1 CC: cletavernier, papyrus-bugs, rschnekenburger, yuwen.hu
Version: 1.0.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard: dx deploy minor import
Attachments:
Description Flags
Video for RSA import issues
none
Sample project for RSA Import Issue none

Description Ronan Bar CLA 2014-09-25 10:48:17 EDT
Running the Refactor->Switch Libraries action causes certain models to lose stereotypes. We will provide more details in a further comment. Also it should be noted these side-effects are visible when the Apply button is pressed. Selecting cancel on the popup window does *not* undo the side-effects caused by the apply. Ctrl+Z once the popup has been dismissed is the only way to undo the damage.
Comment 1 Yuwen Hu CLA 2014-09-25 11:14:12 EDT
Created attachment 247371 [details]
Video for RSA import issues
Comment 2 Yuwen Hu CLA 2014-09-25 11:15:21 EDT
Created attachment 247372 [details]
Sample project for RSA Import Issue
Comment 3 Yuwen Hu CLA 2014-09-25 11:24:13 EDT
Here is the details for this bug.
We have a BlankPackage (already import from RSA to Papyrus), a BlankPackage2 (plan to import from RSA to Papyrus), a Profile which defines a Stereotype which reference by BlankPackage2.

1. Import Profile.epx, and then remove Profile.epx
2. Import BlankPackage2.epx
3. Double click the import result BlankPackge2, and then choose Profile.profile.uml to replace Profile.epx ref in "Repair Stereotype" dialogs.
4. Expand BlankPackage2, to check Class2 has the Generalization has the correct Stereotype from Profile.
5. Right-click BlankPackage2 in ModelExplorer to launch "Refactor" > "Switch Libraries...".
6. Choose BlankPacakge.uml in workspace to replace BlankPackage.epx and then click "Apply".
7. Now the Stereoype for the Generalization in Class2 get dropped.

Please check the video to sample project to reproduce the problem.
Comment 4 Camille Letavernier CLA 2014-09-26 05:53:01 EDT
The switch library algorithm updates all references to external elements, including Derived references (When they are modifyable). In this case, Class#general was set, which led to the deletion & re-creation of the Generalization (Thus losing stereotypes, and probably other useful information)

Commits d507a74 (Maintenance/Luna), 7472d59f (Master/Mars):

- Prevent modification of derived properties during the Switch Library action, to avoid similar side effects (Derived properties are properly recomputed anyway, e.g. when Generalization#general is changed, in this case)