Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] problem with primitive types when executed as Java application
[Acceleo] problem with primitive types when executed as Java application [message #902957] Tue, 21 August 2012 08:04 Go to next message
Andrea Sindico is currently offline Andrea Sindico
Messages: 266
Registered: November 2010
Senior Member


As a consequence of this issue (http://www.eclipse.org/forums/index.php/t/369676/) I have an acceleo transformation which produces the desired output only when executed as a Java Application.

I have however notice that in this case there are some problems with primitive types. suppose I have a classifier property called att typed with an Integer UML Primitive type. If I run (as a Java Application) this code

   [att.type/] [att.type.name/]


I get

org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@548eb (eProxyURI: pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Integer)


Follow me on Twitter @andreasindico

Re: [Acceleo] problem with primitive types when executed as Java application [message #904402 is a reply to message #902957] Tue, 28 August 2012 07:28 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1621
Registered: July 2009
Senior Member
Hi Andrea,

When using UML in standalone (Java Application), you need to properly register everything it needs, including the primitive types. See the UML FAQ.

The bits needed to register their models and factories can be done in your generated java launcher, within the "register*" methods.

Laurent Goubet
Obeo
Re: [Acceleo] problem with primitive types when executed as Java application [message #905390 is a reply to message #904402] Thu, 30 August 2012 05:49 Go to previous message
Stephane Begaudeau is currently offline Stephane Begaudeau
Messages: 406
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

You should use something like this in the method registerPackages of your generator:

Map uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI.createURI("platform:/plugin/org.eclipse.uml2.uml.resources/");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));


But for the stand alone, the path of the jar org.eclipse.uml2.uml.resources is not "platform:/plugin/org.eclipse.uml2.uml.resources/" but the absolute path of the jar.

Regards,

Stephane Begaudeau



Previous Topic:Acceleo induced InvalidRegistryObjectException
Next Topic:[Acceleo] Iterate through associated classes
Goto Forum:
  


Current Time: Tue Jul 29 23:05:23 EDT 2014

Powered by FUDForum. Page generated in 0.01614 seconds