Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Drop in Diagram from custom source(Creating a new container as result of a drop)
Drop in Diagram from custom source [message #1800418] Thu, 27 December 2018 14:42 Go to next message
Emmanuel Chebbi is currently offline Emmanuel ChebbiFriend
Messages: 123
Registered: February 2018
Senior Member
Hello,

I am currently trying to allow the creation of new containers in a Sirius 6.1.1 diagram with Drag'n'Drop. More specifically:

  • I have a CommonNavigator displaying a tree of EObject in a dedicated view
  • I have a ContainerDrop tool that handles drops on the diagram and creates new containers accordingly
  • I would like to drag elements from my CommonNavigator to the diagram

Following previous topics on the subject [1][2] I managed to do the following:

  • Handling a drag from the Model Explorer
  • Creating a new container as a result of the drop

My problem is that when the drag source is my own CommonNavigator then the DropContainer tool is not called at all. After some time spent in the debugger it seems that drop is rejected by the DragAndDropValidator [3] [4] because the dragged EObject does not belong to any Resource. Indeed, it is a bare collection of EObjects that I compute at runtime and that is not persisted. I believe that I could overcome this limitation by:

  1. Adding the dragged EObject to a Resource
  2. Adding the new Resource to the diagram's Semantic Resources
  3. Handling the drop
  4. Removing the created Resource

but it really feels like a trick and I'd prefer to avoid it. Does someone have a better solution ? Did I miss something ?

[1] https://www.eclipse.org/forums/index.php/t/798310/
[2] https://www.eclipse.org/forums/index.php/t/1093807/
[3] https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/graphical/edit/internal/policies/validators/DragAndDropValidator.java?id=1ea9423d6497979d2076716c37551d75307d1bf4#n139
[4] https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/tree/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/resource/WorkspaceDragAndDropSupport.java?id=1ea9423d6497979d2076716c37551d75307d1bf4#n63

[Updated on: Thu, 27 December 2018 14:43]

Report message to a moderator

Re: Drop in Diagram from custom source [message #1800554 is a reply to message #1800418] Wed, 02 January 2019 10:41 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Hi,

Dropping "external" EObjects (model elements which are not part of the underlying Sirius session) is not supported at the moment. It seems related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=514645, so maybe you could add your use case to that ticket, but unless someone sponsors the corresponding developement the enhancement is not in the roadmap at the moment.

Regards,


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Drop in Diagram from custom source [message #1800830 is a reply to message #1800554] Tue, 08 January 2019 19:47 Go to previous message
Emmanuel Chebbi is currently offline Emmanuel ChebbiFriend
Messages: 123
Registered: February 2018
Senior Member
Hello,

Thank you for the clarification. I will take a look at the ticket and try to share my use case.

I'll try to implement a workaround and will update this thread if I manage to implement a satisfactory solution.

Regards,
Emmanuel
Previous Topic:Hide Sirius legacy tabs in Properties view
Next Topic:Problem with custom layout provider
Goto Forum:
  


Current Time: Thu Apr 18 17:41:24 GMT 2024

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

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

Back to the top