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

Bug 204658

Summary: Stereotypes and their values are not copied in UML Editor
Product: [Modeling] MDT.UML2 Reporter: Stefan Holzknecht <s.holzknecht>
Component: CoreAssignee: Kenn Hussey <Kenn.Hussey>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P2 CC: borlander, bruck.james, francois.temp1, Kenn.Hussey, kutter, nyssen, tatiana.fesenko, unger
Version: 2.1.0Keywords: plan
Target Milestone: M7Flags: Kenn.Hussey: kepler+
Hardware: PC   
OS: Windows XP   
Whiteboard: Community Support

Description Stefan Holzknecht CLA 2007-09-26 05:23:58 EDT
Build ID: I20070625-1500

Steps To Reproduce:
1.Create a uml model
2. Create a class 'A' in created package and assign any stereotype.
3. Create a package b, copy class A and paste it into b.
4. see that the copy does not have a stereotype assigned.


More information:
Comment 1 Nick Boldt CLA 2007-09-26 10:03:14 EDT
This is not a Releng bug.
Comment 2 Kenn Hussey CLA 2008-05-01 17:40:42 EDT
It's too late now for this feature to make it into the 2.2 release. :(
Comment 3 Kenn Hussey CLA 2012-06-20 22:28:46 EDT
The copy command would need to be overridden/extended so that stereotype applications are handled properly. This is similar to bug 281326 and can perhaps be explored in Keppler.
Comment 4 Kenn Hussey CLA 2013-04-16 19:45:02 EDT
I have done some further analysis and prototyping for this issue. As it turns out, the commands for copy, cut, and paste will all need to be specialized in the context of the UML editor.

I will implement a solution wherein stereotype applications for the copied/cut elements are pasted to the target resource iff the same version of the associated profile is applied in the resulting context. This means that the specific version of the containing profile(s) must be applied either to a package in the hierarchy of the elements being copied/cut or to a package in the hierarchy of the target to which the elements are being pasted.
Comment 5 Philipp W. Kutter CLA 2013-04-17 00:26:15 EDT
I agree, that if another version of the same profile is applied, we should be careful.

However, if the same profile has not yet been applied, it would simplify things a lot for non-specialists, if the copy/past command would not only copy the applications of the stereotypes and their tags, but as well the application of the profile.

Does the following:
> This means that the specific version of the containing profile(s) must 
> be applied either to a package in the hierarchy of the elements being 
> copied/cut or to a package in the hierarchy of the target to which the 
> elements are being pasted.

Mean that you would apply the profile to the target, if you had it applied in the hierarchy of the elements being copied/cut? If yes, to which package would it be applied, to the least enclosing, or to the root?

Another question: if we have in source and target context two versions of the same profile applied, and if the stereotype is so simple that it can be recognized as being the same in both versions: would it not be great, to have it copied over anyhow?
Comment 6 Kenn Hussey CLA 2013-04-17 11:49:13 EDT
(In reply to comment #5)
> However, if the same profile has not yet been applied, it would simplify things
> a lot for non-specialists, if the copy/past command would not only copy the
> applications of the stereotypes and their tags, but as well the application of
> the profile.

I agree that it seems simpler (on the surface), but having thought in detail about it, it's not so simple. Consider, for example, the fact that the modeler may wish to not have the profile applied in the new context or may wish to have it applied to a specific package (by convention). Another complication is required stereotypes - automatically applying the profile could result in a number of applications of required stereotypes as a (potentially undesirable) side-effect.

> Does the following:
> > This means that the specific version of the containing profile(s) must
> > be applied either to a package in the hierarchy of the elements being
> > copied/cut or to a package in the hierarchy of the target to which the
> > elements are being pasted.
> 
> Mean that you would apply the profile to the target, if you had it applied in
> the hierarchy of the elements being copied/cut? If yes, to which package would
> it be applied, to the least enclosing, or to the root?

No, it means that either the hierarchy of elements being copied/cut must contain the needed profile application (e.g., perhaps you are copying/cutting and pasting a package with all of its contents and the needed profile is applied to that package) or some package in the hierarchy into which you are pasting the elements must have the need profile applied. If neither of these is true, the stereotype applications from that profile will not be pasted.

> Another question: if we have in source and target context two versions of the
> same profile applied, and if the stereotype is so simple that it can be
> recognized as being the same in both versions: would it not be great, to have it
> copied over anyhow?

This is another example of how complicated things can get - the modeler might wish to apply a newer version of a profile in a narrower context or instead upgrade to a newer version of the profile in the target context. Even worse, you could be copying stereotype applications from an older version of a profile for which a newer version is applied in the target context. Much better, IMHO, to give the modeler full control over which versions of which profiles are applied where in the target context; the contract provided by the cut/copy/paste commands will be that any stereotype applications which are still valid in the target context will be preserved.
Comment 7 Kenn Hussey CLA 2013-04-19 13:57:57 EDT
The solution described in comment #4 has been committed/pushed to the 'master' branch in git.
Comment 8 Kenn Hussey CLA 2013-04-19 16:19:05 EDT
An integration build (for UML2 4.1) containing the changes is now available.