Skip to main content



      Home
Home » Modeling » Graphiti » [DND] Drop business object from external TableViewer
[DND] Drop business object from external TableViewer [message #881375] Mon, 04 June 2012 08:37 Go to next message
Eclipse UserFriend
I am trying to drop a business object from an 'external' TableViewer, i.e. in a workbench part outside the DiagramEditor. When entering the diagram area, the DROP operation does not change, i.e. I cannot drop the object.

What SWT Transfer do I have to use? Or how do I have to configure the TableViewer to be able to drop its selection onto the diagram?
Re: [DND] Drop business object from external TableViewer [message #881756 is a reply to message #881375] Tue, 05 June 2012 03:57 Go to previous messageGo to next message
Eclipse UserFriend
Hi Erdal,

I have something similar for my Graphiti editor: I have an "external" view with some TableViewers that show certain business objects in my model that I can then drag onto the diagram to initiate certain actions.

The code to enable drag support on my TableViewers looks like this:

this.tblv.addDragSupport(DND.DROP_MOVE | DND.DROP_COPY, new Transfer[] { LocalSelectionTransfer.getTransfer() },
				new DragSourceAdapter() {

					@Override
					public void dragStart(DragSourceEvent event) {
						LocalSelectionTransfer.getTransfer().setSelection(CatalogView.this.tblv.getSelection());
					}
			
				});


I use the LocalSelectionTransfer, as you can see, and just pass it the selection of my TableViewer.

What you also need is an AddFeature in your Graphiti editor for the kind of business object you're trying to drop. In that AddFeature, you can use the canAdd(IAddContext context) method to implement a check whether the business object should be "droppable" at the desired location, for example by checking the target container of the given context.

I hope this helps you in any way.

Cheers
Henning
Re: [DND] Drop business object from external TableViewer [message #881854 is a reply to message #881756] Tue, 05 June 2012 07:38 Go to previous message
Eclipse UserFriend
Thanks Henning, that is a good starting point!
Previous Topic:Spray: containment of different objects
Next Topic:ICreateConnection.create(): returning null Connection allowed?
Goto Forum:
  


Current Time: Tue Jul 22 19:20:19 EDT 2025

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

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

Back to the top