|
|
|
Re: [QVTo] Setting the parent (owner) of a new element [message #655491 is a reply to message #655131] |
Mon, 21 February 2011 12:14 |
Eclipse User |
|
|
|
Originally posted by: koen.yskout.cs.kuleuven.be
The properties you have tried to set (e.g., ownedElements) are derived
as the union of several other properties, so you can't set/modify it.
Activity does have a (non-derived) property 'node' which contains the
ActivityNodes of that activity, so it should be possible to set or
modify this. Probably, there is an error in your syntax (or in the
things that supposedly don't matter :p), so I guess you'd need to
provide more specific information to solve that particular problem.
Btw, an easy way to explore the UML metamodel is by using the Metamodel
Explorer view that ships with QVTo, to find out which properties exist
and are (or aren't) derived. To me, this is easier than using the
debugger :)
Regards,
Koen
On 18/02/11 14:04, Haffi wrote:
> The Activity container has a property called 'ownedElements' which is
> also read only like the 'owner' so I'm stumped. (The mapping itself is
> actually working with an element in the activity diagram but not the
> diagram itself, but I guess that shouldn't matter)
>
> Via debugging I've found a property of the Activity container which is
> called node and is a set of the nodes, but it's hidden because if I try
> to do something like:
> activityContainer.node := something... the editor gives me an error that
> 'node' is not a variable.
|
|
|
|
Re: [QVTo] Setting the parent (owner) of a new element [message #655669 is a reply to message #655507] |
Tue, 22 February 2011 09:17 |
Eclipse User |
|
|
|
Originally posted by: koen.yskout.cs.kuleuven.be
Haffi,
No, you should not need Java code to do this.
The following simple transformation works for me without any problems,
so I'm not sure what causes the problems you are having...
modeltype UML "strict"
uses uml("http://www.eclipse.org/uml2/3.0.0/UML");
transformation SampleTransformation(inout model : UML);
main() {
model.rootObjects()[Model]->map testAddActivity();
}
mapping inout UML::Model::testAddActivity() {
self.packagedElement += map newActivityWithFlowFinalNode();
}
mapping newActivityWithFlowFinalNode() : UML::Activity {
name := "testActivity";
node += object FlowFinalNode {
name := "flowFinal";
}
}
On 21/02/11 14:54, Haffi wrote:
> Thank you for pointing out the metamodel explorer, it's very helpful. I
> still can't find a way to change or set the node property, the list of
> possible methods on the object doesn't seem to contain anything to
> influence this. Is it possible that I might somehow have to change this
> through Java code?
|
|
|
Powered by
FUDForum. Page generated in 0.03735 seconds