Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » getAppliedStereotypes() does not work when model and profile are in the same file ?
getAppliedStereotypes() does not work when model and profile are in the same file ? [message #1592977] Fri, 30 January 2015 10:42 Go to next message
Dominique Marcadet is currently offline Dominique MarcadetFriend
Messages: 14
Registered: January 2013
Junior Member
Hello,

I have a profile with a stereotype extending Class and a model with a class in a package. The profile is applied to the package and the stereotype is applied to the class.

When the package and the profile are in two different files, I am able to get the stereotype with getAppliedStereotypes().
But when the the package and the profile are in the same model and file, getAppliedStereotypes() returns nothing even if the stereotype is correctly displayed by UML editor.

Is there anything specific to do to handle the "only one file" case ?

I attach the UML and test java files showing the problem.

regards,
Dominique

Re: getAppliedStereotypes() does not work when model and profile are in the same file ? [message #1598134 is a reply to message #1592977] Mon, 02 February 2015 20:19 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1176
Registered: July 2009
Location: Canada
Senior Member

Hi, Dominique,

The answer to your problem is a common mistake in creating the URIs
with which a resource is loaded. As Ed reminds us weekly on the EMF
newsgroup, you must always use an absolute URI when loading a resource
to ensure correct resolution of references. In this case, even local
references into the same resource (via some package registry or other
component that loses the context of what is the referencing resource).

So, changing the URI created at line 20 of your example program to an
absolute URI lets the stereotype applied to the class be found at line
24.

Cheers,

Christian


On 2015-01-30 10:42:43 +0000, Dominique Marcadet said:

> Hello,
>
> I have a profile with a stereotype extending Class and a model with a
> class in a package. The profile is applied to the package and the
> stereotype is applied to the class.
>
> When the package and the profile are in two different files, I am able
> to get the stereotype with getAppliedStereotypes().
> But when the the package and the profile are in the same model and
> file, getAppliedStereotypes() returns nothing even if the stereotype is
> correctly displayed by UML editor.
>
> Is there anything specific to do to handle the "only one file" case ?
>
> I attach the UML and test java files showing the problem.
>
> regards,
> Dominique
>
>
> <image><image><image><image>
Re: getAppliedStereotypes() does not work when model and profile are in the same file ? [message #1598943 is a reply to message #1598134] Tue, 03 February 2015 09:06 Go to previous message
Dominique Marcadet is currently offline Dominique MarcadetFriend
Messages: 14
Registered: January 2013
Junior Member
Hi Christian,

Thanks for the advice, it solves my problem.
Here is the new java test file using absolute URIs.
Regards,
Dominique

Previous Topic:Registering and loading a profile programatically (standalone)
Next Topic:Classifier.getInheritedMembers() method vs UML inheritance semantics
Goto Forum:
  


Current Time: Wed Nov 14 00:41:43 GMT 2018

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

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

Back to the top