Migration of new profile definition does not work [message #777349] |
Tue, 10 January 2012 05:13  |
Eclipse User |
|
|
|
Hello everyone,
currently I try to apply a profile ("ansicextension") to an existing UML model programmatically in an xTend script. For that I am following the code suggested by org.eclipse.uml2.uml.editor.actions.ApplyProfileAction:
setProfile(uml::Package p, uml::Profile profile) :
let m = p.getModel() :
if (m.getProfileApplication(m.getAppliedProfile("ansicextension")) == null ||
m.getProfileApplication(m.getAppliedProfile("ansicextension")) != profile.getDefinition()) then (
"All applied profiles:".info() ->
m.getAllAppliedProfiles().info() ->
"".info() ->
"Profile application of profile with old definition:".info() ->
m.getProfileApplication(m.getAppliedProfile("ansicextension")).info() ->
"".info() ->
"Applying profile with new definition...".info() ->
"".info() ->
//m.applyProfile(profile) ->
m.migrateProfile(profile) ->
"All applied profiles:".info() ->
m.getAllAppliedProfiles().info() ->
"".info() ->
"Definition of profile \"ansicextension\"".info() ->
m.getAppliedProfile("ansicextension").getDefinition().info() ->
"".info() ->
"Definition of passed profile".info() ->
m.getProfileApplication(profile).getAppliedDefinition().info() ->
"".info() ->
"Applied definition of profile \"ansicextension\"".info() ->
m.getProfileApplication(m.getAppliedProfile("ansicextension")).getAppliedDefinition().info() ->
"".info()
)
;
(The new "ansicextension" is passed to setProfile to get its most current definition and there might be already an applied "ansicextension" with an old definition)
I get the following console output:
1859 INFO IOExtensions - All applied profiles:
1869 INFO IOExtensions - [org.eclipse.uml2.uml.internal.impl.ProfileImpl@1daf835 (name: ansicextension, visibility: <unset>)]
1870 INFO IOExtensions -
1870 INFO IOExtensions - Profile application of profile with old definition:
1872 INFO IOExtensions - org.eclipse.uml2.uml.internal.impl.ProfileApplicationImpl@11f24bb (isStrict: false)
1873 INFO IOExtensions -
1874 INFO IOExtensions - Applying profile with new definition...
1874 INFO IOExtensions -
1929 INFO IOExtensions - All applied profiles:
1930 INFO IOExtensions - [org.eclipse.uml2.uml.internal.impl.ProfileImpl@1daf835 (name: ansicextension, visibility: <unset>), org.eclipse.uml2.uml.internal.impl.ProfileImpl@863d22 (name: ansicextension, visibility: <unset>)]
1930 INFO IOExtensions -
1931 INFO IOExtensions - Definition of profile "ansicextension"
1933 INFO IOExtensions - org.eclipse.emf.ecore.impl.EPackageImpl@1606bf5 (name: ansicextension) (nsURI: http:///schemas/ansicextension/_XJckUDq7EeGbEJmsvlSgdQ/10, nsPrefix: ansicextension)
1934 INFO IOExtensions -
1934 INFO IOExtensions - Definition of passed profile
1936 INFO IOExtensions - org.eclipse.emf.ecore.impl.EPackageImpl@be0382 (name: ansicextension) (nsURI: http:///schemas/ansicextension/_XJckUDq7EeGbEJmsvlSgdQ/10, nsPrefix: ansicextension)
1936 INFO IOExtensions -
1937 INFO IOExtensions - Applied definition of profile "ansicextension"
1937 INFO IOExtensions - org.eclipse.emf.ecore.impl.EPackageImpl@8bf223 (name: ansicextension) (nsURI: http:///schemas/ansicextension/_ZWVOQMzAEeCV_4ZI_I7CJQ/9, nsPrefix: ansicextension)
1938 INFO IOExtensions -
It can be seen that the profile to be applied is just added to all applied profiles and whereas the both profiles are the same (but the new one with a new definition) the new profile is not migrated into the old one. In the end the old definition keeps applied.
Does anyone have an idea what I am doing wrong?
Thanks in advance and best regards,
Tom
|
|
|
|
Powered by
FUDForum. Page generated in 0.09253 seconds