Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » How does "isProfileApplied" work?
How does "isProfileApplied" work? [message #889957] Wed, 20 June 2012 08:02 Go to previous message
Tex Iano is currently offline Tex Iano
Messages: 98
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
 
Read Message
Read Message
Previous Topic:UML2 Tools and Indigo
Next Topic:Compatibility of applied profiles
Goto Forum:
  


Current Time: Mon May 20 11:49:28 EDT 2013

Powered by FUDForum. Page generated in 0.08212 seconds