Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Prevent illegal drag&drop
Prevent illegal drag&drop [message #364175] Tue, 28 July 2009 14:07 Go to next message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
In my model, the Canvas Element is of type A, which can itself contain
several instances of A. These sub-nodes can then be edited using diagram
partitioning.

Using the tool, it is not possible to add a new figure of type A into an
existing figure. To add a sub-node to a figure, I need to open it as a new
diagram and add the new node there.
This is exactly what I want.

However, when I create two nodes of type A in the same diagram, then I can
drag&drop on of them into the figure of the other one. The second figure
is then displayed within the first one.

Though this results in a valid model (A contained in A), it is displayed
in a way I don't want. The figure is still visible in main-diagram instead
of sub-diagram.

What's the best way to prevent this?

A more sophisticated solution might be to remove the figure from
main-diagram and add it in sub-diagram when dropped, but I expect this to
be much more complicated.

Any idea appreciated!
Re: Prevent illegal drag&drop [message #420552 is a reply to message #364175] Thu, 30 July 2009 12:02 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Peter,

You can override CreationEditPolicy.getReparentCommand() method of corresponding
EditPolicy and handle this sotuatino by returning UnexecutableCommand.INSTANCE
for such cases from there.

-----------------
Alex Shatalin
Re: Prevent illegal drag&drop [message #432081 is a reply to message #420552] Thu, 30 July 2009 16:12 Go to previous messageGo to next message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
Excellent - thanks, Alex!

Although it works as expected now, I'm wondering if this is a bug?
It allows to create a structure (Node-Figure A in Node-Figure A) that is
not defined in gmfmap.

Thanks again,
Regards, Peter
Re: Prevent illegal drag&drop [message #432406 is a reply to message #432081] Thu, 30 July 2009 16:42 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Peter,

> Although it works as expected now, I'm wondering if this is a bug?
> It allows to create a structure (Node-Figure A in Node-Figure A) that
> is not defined in gmfmap.
D&D support in not generated by GMF now - one from runtime is used, so the
task is to generate D&D by tooling.
You can open such request to indicate you are interested in it.

-----------------
Alex Shatalin
Previous Topic:Child setLocation
Next Topic:binding a diagram file to an external data file
Goto Forum:
  


Current Time: Thu Apr 25 06:22:28 GMT 2024

Powered by FUDForum. Page generated in 0.03172 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top