Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying attribute types in Papyrus

I recently installed Papyrus and attempted to follow the tutorial for creating a model and generating Java code off it.

Unfortunately, I'm pretty much stuck right at the beginning. In the class definition, I added a static operation for main, and I'm able to specify its argument as an array:

in args: <Undefined> [*]

Unfortunately, it does not allow me to specify the type to be String. That is, I would like to specify it as follows:

in args: String [*]

No matter how I enter the type (or any type for that matter), the type reverts back to <Undefined>. I suspect something is wrong or missing with a profile it is supposed to use. Unfortunately, the documentation for this tool is rather sparse, and I cannot find an answer or solution to this.

Anyone has run into this same problem as well???

like image 830
luis.espinal Avatar asked Sep 05 '11 04:09

luis.espinal


People also ask

How do you add attributes to Papyrus?

How can I create class attributes in Papyrus? Hi, After adding a class from the palette, you can select on the palette the node "property" and move it into your AttributeCompartment's class. You can also open the Model Explorer, right click on your class, and select "New Child / Create a new Property".

How do I use papyrus in eclipse?

To begin using Papyrus, launch Eclipse (or stand-alone Papyrus) and navigate to Window -> Open Perspective -> Other, select Papyrus and press OK. To create a new Project, navigate to File -> New -> Papyrus Project. Enter your project name and, if desired, change the default location.


2 Answers

Have you imported the UML Primitive types package? This should allow you to define the type of the argument to Integer, String or Boolean.

In the model explorer, right click on your model, then choose 'Import package from registered library'
In the window that pops up pick 'UMLPrimitiveTypes' (or the Java ones, if you prefer that).
After this, it should work.

like image 50
JackStoneS Avatar answered Sep 17 '22 14:09

JackStoneS


In the latest version of Papyrus, you have to go to model explorer, right click on your model and then choose Import. After that select "Import Registered Package." That will bring up a dialog with a list of registered packages. From that you can select either "UMLPrimitiveTypes" or "JavaPrimitiveTypes"

like image 42
Sanjaya Wijeratne Avatar answered Sep 21 '22 14:09

Sanjaya Wijeratne