Skip to main content

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 12:02 Go to next message
Tex Iano is currently offline Tex IanoFriend
Messages: 99
Registered: February 2012

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:


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?


Re: How does "isProfileApplied" work? [message #889967 is a reply to message #889957] Wed, 20 June 2012 12:39 Go to previous message
Tex Iano is currently offline Tex IanoFriend
Messages: 99
Registered: February 2012
Ah, getNamespace() does not work. But!


And from the definition I can use getNsURI to compare the nsURI.

However, there exists another problem:

At the beginning of my program I load the profile from a file and I always use this profile to get stereotypes etc.

But obviously the applied profile is not the same as the one I have loaded from the file. So, what profile should I use within my program? The one I've loaded from the file or the one that is applied from a previous session? i.e.

Profile profileIWillUse = SemanticsHelper.getInstance().getProfile();


Profile profileIWillUse = model.getAppliedProfile("Semantics");

What is the right way to work and continue working with applied profiles? Because asumed I do not have the profile as file. Now, the model is loaded and I get the profile with getAppliedProfile("Semantics"). How can I use the profile when I have never loaded the UML profile file?

I am just confused Smile


Previous Topic:UML2 Tools and Indigo
Next Topic:Compatibility of applied profiles
Goto Forum:

Current Time: Fri May 25 18:32:11 GMT 2018

Powered by FUDForum. Page generated in 0.01308 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top