Russ Loucks Messages: 11 Registered: December 2011
Junior Member
I have a GEF/Draw2D-based editor that allows users to build a data flow
diagram. Figures include both input data 'channel' anchors and output
data 'channel' anchors. I've extended AbstractConnectionAnchor to suit
my needs and this mostly works well.
One problem. When I select an output 'channel' anchor on an figure
using the connection tool, a feedback connection line appears between
the channel I've just selected and the closest input 'channel' anchor on
the same element. I would prefer nothing appear in this case; the model
doesn't support nodes to be connected to themselves.
In the edit part for the nodes, I've implemented the
GRAPHICAL_NODE_ROLE edit policy
(getConnectionCreateCommand(CreateConnectionRequest),
getConnectionCompleteCommand(CreateConnectionRequest), etc.) and tried
to return NULL in the 'getConnectionCompleteCommand()' method if the
source and target nodes are the same.
Russ Loucks Messages: 11 Registered: December 2011
Junior Member
On 02/07/2012 02:25 PM, Alexander Nyssen wrote:
> Don't return null (which means the edit policy ignores the command) but
> an UnexecutableCommand instance. That should to the trick...
This didn't work (the connection feedback line was still there). The
fix that worked was to return a 'null' ConnectionAnchor in my public
ConnectionAnchor EditPart.getTargetConnectionAnchor(Request request) {}
method.
I check to see if the source n target parts exist and return null if
their models' are the same.
Russ Loucks Messages: 11 Registered: December 2011
Junior Member
On 02/09/2012 07:15 AM, Missing name Mising name wrote:
> in the target EdtiPart override the method
>
> public ConnectionAnchor getSourceConnectionAnchor(Request request)
> public ConnectionAnchor getTargetConnectionAnchor(Request request)
>
> and make them return the correct anchor point for the creationConnection
> request.
> This anchor will be used only during the creation of the connection.
>
> hop this help you
Thanks. The fix that worked was to return a 'null' ConnectionAnchor in
my public ConnectionAnchor EditPart.getTargetConnectionAnchor(Request
request) {} method.
I check to see if the source n target parts exist and return null if
their models' are the same.