Skip to main content



      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 05:42 Go to next message
Eclipse UserFriend
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 15:19 Go to previous messageGo to next message
Eclipse UserFriend
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 04:06 Go to previous message
Eclipse UserFriend
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: Mon Jul 07 02:26:26 EDT 2025

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

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

Back to the top