Skip to main content

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 12:04 Go to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member

As a consequence of this issue ( 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/] []

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 11:28 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1900
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
Re: [Acceleo] problem with primitive types when executed as Java application [message #905390 is a reply to message #904402] Thu, 30 August 2012 09:49 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member


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.


Stephane Begaudeau
Re: [Acceleo] problem with primitive types when executed as Java application [message #1793371 is a reply to message #905390] Mon, 06 August 2018 18:25 Go to previous message
Tomas Balderas is currently offline Tomas BalderasFriend
Messages: 64
Registered: July 2010
Hello Stephane and Laurent

I got the same problem with instances of PrimitiveType, when started to write a Swift code generator from class diagrams built using Papyrus. My class diagram has a number of classes containing properties typed by elements of UML Primitive Types (String and Integer), and when trying to get the names of such primitive types as strings ("String" and "Integer") I got blank, just like Andrea indicated previously. More details on my problem is in this thread: I am running Acceleo 3.7.3... and Papyrus 4.0.0... on top of Eclipse Photon and my generator is not running as a stand-alone application.

My question is: do I have to modify the registerPackages() method in the file? What modifications do I have to do to register the UML Primitive Type package? I am not really understanding this registering stuff and your assistance will be really appreciated.

Thank in advance for your help. Kindest regards.

Previous Topic:[Acceleo] Maximum size of a module
Next Topic:[Acceleo] Problem when accessing a property of an instance of the meta-class PrimitiveType
Goto Forum:

Current Time: Sun Oct 02 06:53:44 GMT 2022

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

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

Back to the top