Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Cannot get Instances of Applied Stereotypes(Element.getStereotypeApplications() returns only DynamicEObjectImpl Instances)
Cannot get Instances of Applied Stereotypes [message #1753184] Thu, 02 February 2017 14:20 Go to next message
Sven Peldszus is currently offline Sven PeldszusFriend
Messages: 5
Registered: February 2017
Junior Member
Hello everyone,

I've an problem with getting instances of UML sereotype applications.

I think I've some problem with the registration of the generated EMF code but I am not able to figure out where the problem is.

In advance I am executing everything in the Eclipse context.

My problem is that a call to Element.getStereotypeApplications() only returns a List of DynamicEObjectImpl instances instead of instances of the according EClasses. However, every DynamicEObjectImpl represents the correct EClass and has somehow also a List with the right values for EAttributes.

Ok, what have I done:

I defined a UML profile and for use in Papyrus I created the following two entries in my plugin.xml:

<extension point="org.eclipse.papyrus.uml.extensionpoints.UMLProfile">
  <profile
    iconpath="icons/Logo16x16.png"
    name="UMLsec.Variability" 
    path="pathmap://UMLsec/Variability.uml">
  </profile>
</extension>

<extension point="org.eclipse.emf.ecore.uri_mapping">
  <mapping 
    source="pathmap://UMLsec/Variability.uml"
    target="platform:/plugin/carisma.profile.umlsec.variability/profile/variability.profile.uml">
  </mapping>
</extension>


And inside of Papyrus everything is working fine.

However, I have the problem described above at the point where I am processing the created models.

Until now I tried to register the model at the following extension points but it made no differences:

org.eclipse.uml2.uml.dynamic_package
org.eclipse.uml2.uml.generated_package

If I register a genmodel created from the profile under the same URI at org.eclipse.emf.ecore.generated_package, I get a collision and a call to Element.getStereotypeApplications() or Element.getAppliedStereotypes() returns an empty List.

Therefore, I tried also to register the genmodel with an URI containing a postfix. But this only resolves the collision but makes no difference for my main problem.

I hope I din't forget to mention anything important. Hopefully, you are able to help me.

Thank you very much

Sven
Re: Cannot get Instances of Applied Stereotypes [message #1753207 is a reply to message #1753184] Thu, 02 February 2017 16:49 Go to previous messageGo to next message
German Vega is currently offline German VegaFriend
Messages: 51
Registered: December 2015
Member
Hello

It seems that you are trying to use a statically generated profile.

Usually the problem is the 'location' property in the extension point 'org.eclipse.uml2.uml.generated_package' that needs to be the URI of the profile element within the profile file (not the URI of the profile file itself)

There is a very useful step-by-step tutorial at http://nyssen.blogspot.fr/2009/09/defining-static-profiles-with-eclipse.html that details this

that shows all the registrations that you need to do
Re: Cannot get Instances of Applied Stereotypes [message #1753270 is a reply to message #1753207] Fri, 03 February 2017 09:38 Go to previous messageGo to next message
Sven Peldszus is currently offline Sven PeldszusFriend
Messages: 5
Registered: February 2017
Junior Member
Thank you very much for the fast response and this helpful link.

It solved my problem Smile
Re: Cannot get Instances of Applied Stereotypes [message #1753271 is a reply to message #1753207] Fri, 03 February 2017 09:38 Go to previous message
Sven Peldszus is currently offline Sven PeldszusFriend
Messages: 5
Registered: February 2017
Junior Member
Thank you very much for the fast response and this helpful link.

It solved my problem Smile
Previous Topic:getAppliedStereotypes is empty but the stereotype has been applied
Next Topic:Get and create SysML subprofiles (SysML 1.4 Memtamodel)
Goto Forum:
  


Current Time: Sun Apr 22 05:09:43 GMT 2018

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

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