[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Drag and Drop Between Two Editing Panes

Hi Axel,

thx for the hint and the link. it works in so far, that you are able to drag 
a resource from the view or even the OS and drop it on the diagram. but the 
part will not be added to the diagram. i think, this is why:


GEF                                                   GMF
CreateCommand                                CreateElementCommand
TargetDropListener(SWT)                  ResourceDropTargetListener


unfortunately, the classes used in GMF are not extending or implementing the 
same interfaces like the GEF-classes do. there is no chance to add a 
ResourceDropTargetListener to the DiagramEditorPart!


Sam

"Axel Guckelsberger" <info@xxxxxxxx> schrieb im Newsbeitrag 
news:fc3c52$pn5$1@xxxxxxxxxxxxxxxxxxxx
> Hi Joe,
>
> I have no particular solution for you, but you might consider starting
> with this article to get a basic information:
> http://www.eclipse.org/articles/Article-GEF-dnd/GEF-dnd.html
>
>
> Joe Dente schrieb:
>> Does anybody have any information with regards to drag and drop between
>> editors? We are scoping an upcoming project and need to know if drag and
>> drop between editors is feasible.  Copy and paste between editors will 
>> get
>> the job done, but drag and drop is so much better.
>> Thanks,
>> Joe
>>
>> "Joe Dente" <jdente@xxxxxxxxxxxxxxxxxx> wrote in message
>> news:fbkcts$s8s$1@xxxxxxxxxxxxxxxxxxxx
>>> Hi,
>>>
>>>    How do we enable drag and drop between multiple GMF editors? I've 
>>> been
>>> working for a while on trying to implement drag and drop between 
>>> different
>>> graphical editing panes in GMF-2.0 and Eclipse-3.3.  For example, using
>>> the Logic diagram example online, if I have two diagrams logic1 and
>>> logic2, I would like to be able to drag and drop sets of logic gates,
>>> connections, etc, from logic1 onto logic2.
>>>
>>>   As a first step, I figured out how to enable UUIDs, which allowed me 
>>> to
>>> cut/copy/paste between two or more diagrams.  I then began experimenting
>>> with drag and drop.  I immediately ran into problems with drag and drop
>>> because the default behavior of auto-expanding/scrolling the current
>>> canvas does not let drag and drop move between editors.  I created
>>> DropSourceListeners and DropTargetListeners and registered them with my
>>> DiagramEditor in initializeGraphicalViewer().  These listeners attempted
>>> to override the auto-expand behavior found in
>>> AbstractTransferDropTargetListener.  I have also added a drag and drop
>>> edit policy on the EditPart that contains all of the elements I wish to
>>> drag and drop.  I can see output and logging from all of these different
>>> components, so I know that they registered correctly and are being 
>>> called.
>>> However, I still cannot remove the auto-expand/scroll behavior on drag 
>>> and
>>> drop actions.
>>>
>>> I have the following questions:
>>>
>>> 1) What do I need to extend or modify in order to disable the
>>> auto-expand/scroll behavior that is preventing me from dragging from one
>>> editor to another?  The AbstractTransferDropTargetListener seems to
>>> control a lot of the auto-expand behavior.  However, I also see a lot of
>>> code pertaining to drag and drop auto-expand/target-viewer operations in
>>> the SelectionTool code and the DragTracker code.  Where is the default
>>> drag and drop behavior coming from and how do I override it?
>>>
>>> 2) Which EditPolicy do I use with my EditPart? Initially, I used
>>> DiagramDragDropEditPolicy, but this class throws class cast exceptions
>>> whenever it is used.  The getDropObjectsCommand attempts to cast the
>>> selected objects (EditParts) to EObjects.  I extended this class as a
>>> temporary fix, but I do not believe my class is working correctly.
>>>
>>> 3) Which Transfer should I be using in my DragSourceListener? Currently 
>>> I
>>> am using LocalSelectionTransfer, which seems correct.
>>>
>>> 4) Can these modifications be performed using extension points so that I
>>> do not need to modify generated code?  I was able to change the 
>>> EditPolicy
>>> using an extension, but I have not been able to register new DragSource
>>> and DropTarget Listeners using extensions.  There appears to be an
>>> extension point to register new DND extensions
>>> (org.eclipse.gmf.runtime.common.ui.services.dnd.dragDropListenerProviders
>>> and
>>> org.eclipse.gmf.runtime.common.ui.services.dnd.transferAdapterProviders),
>>> but I cannot get these extension points to work and I cannot find any
>>> documentation or information online.
>>>
>>> I have found a couple of posts in mailing lists and forums about 
>>> enabling
>>> drag and drop between editors in GEF and GMF, but none of the threads
>>> fully solved my problems.
>>>
>>> Thanks,
>>> Joe
>>>
>>
>>