how to create programatically an instance of given DataType in UML [message #1073724] |
Thu, 25 July 2013 07:27  |
Eclipse User |
|
|
|
Need:
Given a UML self-defined DataType, not UML pre-defined DataType (e.g. MyType), how to create its instance programatically?
Use case:
In a UML profile, we define a stereotype which has some attributes of MyType. In order to specify a UML model correctly, we need to create an instance of MyType after we apply the stereotype.
Current Papyrus UI Capability
In the "applied stereotype view", we can select the stereotype and a panel to create those instance is ready on the right side. It needs only to click "+" to open a dialog and initialize an instance. How this is done by code ?
Example Pseudo Code:
Element target;
Stereotype st = getStereotypeByName("name");
target.applyStereotype(st);
DataType dt = getDataTypeByName("MyType");
EObject instance = createInstance(dt);
target.setValue(st, "myTypeAttr", instance);
Question:
How this method "EObject createInstance(DataType dt)" can be implemented ?
Thanks in advance.
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03759 seconds