How does "isProfileApplied" work? [message #889957] |
Wed, 20 June 2012 12:02 |
Tex Iano Messages: 99 Registered: February 2012 |
Member |
|
|
Hi,
I have the following situation:
I have a program loading a UML profile. Afterwards, a model is created and the profile is applied. Finally, the model is saved.
When I load the model again, I want to check whether the profile is already applied:
if (!model.isProfileApplied(SemanticsHelper.getInstance().getProfile())) {
This works pretty well, when I do not restart the application. In that case, this check fails.
So my question is: How does the "isProfileApplied" method work? Obviously it compares the instance of the profile class and not the profile itself. I tried to output the profile and the applied profile:
System.out.println(SemanticsHelper.getInstance().getProfile()));
System.out.println(model.getAppliedProfile("Semantics"));
org.eclipse.uml2.uml.internal.impl.ProfileImpl@bdfcd0 (name: Semantics, visibility: <unset>)
org.eclipse.uml2.uml.internal.impl.ProfileImpl@e4acd9 (name: Semantics, visibility: <unset>)
This is in case when I restart the application. As you can see, the instance ID differs. In case when I do not restart the application the ID is identical.
So... isProfileApplied is maybe not what I want to achieve. Maybe I just have to use
model.getAppliedProfile("Semantics")!=null && model.getAppliedProfile("Semantics").getNamespace() == SemanticsHelper.getInstance().getProfile().getNamespace()
to check whether the profile is applied? I.e. comparing the applied profiles according their namespace?
Regards,
Tex
|
|
|
|
Powered by
FUDForum. Page generated in 0.04214 seconds