AnsiCLibrary does not seem to be loaded [message #1803937] |
Wed, 13 March 2019 22:26 |
reza ahmadi Messages: 47 Registered: September 2016 |
Member |
|
|
Hi,
I have a stand-alone Java application that processes UML-RT models.
This application processes the message parameter and capsule attribute types. In a model, if a message parameter or attribute type is based on the types defined in the "PrimitiveTypes" library package, my tool can successfully recognize the type of that message parameter or attribute. However, if types defined the model library AnsiCLibrary are used, the PrimitiveType attribute is null, which suggests that AnsiCLibrary is not loaded.
In my application, I load the resources required using, e.g.,
myResourceSet.getPackageRegistry().put(RTCppPropertiesPackage.eNS_URI, RTCppPropertiesPackage.eINSTANCE);
to load UML-RT profile.
But I cannot find which resource should be loaded in my application to be able to successfully load the types defined in AnsiCLibrary.
For example, if a capsule attribute X is defined in a model and its type is unsigned int (which has been defined in AnsiCLibrary model library), when I read the attributes in that capsule, X.getType().getName() equals null. However, if X is typed Integer (which has been defined in PrimaryTypes model library), X.getType().getName() returns "Integer".
Thanks for any help,
Reza
|
|
|
Re: AnsiCLibrary does not seem to be loaded [message #1803938 is a reply to message #1803937] |
Wed, 13 March 2019 22:43 |
Ernesto Posse Messages: 438 Registered: March 2011 |
Senior Member |
|
|
If you are asking at the modelling level:
- If you create the model with the New Papyrus Project wizard, select the UML-RT architecture context, and click [Next] twice (rather than [Finish]), and you select "UML for C++" under "You can load a template", the AnsiCLibrary will be automatically imported into the new model.
- If you are dealing with a model not created like that, right-click on the root element in the model explorer, select "Import > Import Registered Package", and in the dialog you should see the AnsiCLibrary.
If you are asking how to do it programmatically, get the Papyrus-RT sources from git, and search for "AnsiCLibrary". Also look at the org.eclipse.papyrusrt.xtumlrt.external plugin, which provides a class that can be used to load resources, libraries, profiles, etc. specially useful for standalone (non-eclipse-based) applications. This is used in the code generator. Take a look at org.eclipse.papyrusrt.codegen.cpp.AnsiCLibraryMetadata and org.eclipse.papyrusrt.codegen.cpp.AbstractUMLRT2CppCodeGenerator.java:62.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03644 seconds