Visibility of variabe [message #1229387] |
Thu, 09 January 2014 05:43  |
Eclipse User |
|
|
|
I want to define a (edge creation) tool that creates two additional sockets on the entities that are to be connected by an element based edge. I'm not able to set the endpoints of the edge as I don't know how to refer to the newly created sockets.
So the domain model contains entities named Node, Socket and Edge. Nodes contain Sockets and Edges refer to sockets for their ednpoints.
The tool should accept two nodes as source and target. Upon invocation, the tool should create a Socket contained by the source a Socket contained by the target. Then, it should create an Edge and let its endpoints refer to the newly created Sockets.
My tool operation now looks like:
Change context (self.eContainer())
- Change context (var:source)
-- Create instance Socket
- Change context (var:target)
-- Create instance Socket
- Create instance Edge
-- Set Value (endpoints)
In the properties of the Create Socket instance operations, I defined variable names for the new instances (sourceSocket and targetSocket). When trying to refer to these while setting the endpoints value of the Edge, the system complaints with: unknown variable: sourceSocket.
It seems that the visibility of sourceSocket is limited to the scope of Create instance.
How can I refer to these instances later on. Or should I structure my tool definition in a different way?
Greetings,
Wilbert.
|
|
|
|
|
|
Re: Visibility of variabe [message #1229796 is a reply to message #1229792] |
Fri, 10 January 2014 03:29  |
Eclipse User |
|
|
|
Based on your help I now came up with:
Change context (self.eContainer())
- Create instance Edge (varname: instance)
-- Change context (var:source)
--- Create instance Socket (varname: sourceSocket)
-----Change context (var: instance)
------Set Value(endpoints=sourceSocket)
-- Change context (var:target)
--- Create instance Socket (varname: targetSocket)
-----Change context (var: instance)
------Set Value(endpoints=targetSocket)
Is there an easier way to do this? For instance, would it make sense to change the context and set the value of an attribute in one operation?
Greetings,
Wilbert.
|
|
|
Powered by
FUDForum. Page generated in 0.07584 seconds