Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Drag-drop from Project Explorer to Diagram
Drag-drop from Project Explorer to Diagram [message #199979] Mon, 04 August 2008 05:15 Go to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Hi,

I am trying to implement drag and drop from model nodes in the Project
Explorer tree (generated with GMF's navigator generator) into an open
GMF model diagram. For example:

project
- foo.model
- Component A
- Component B
- Child C
- another.model

If I have foo.model_diagram or another.model_diagram currently open, I'd
like to be able to drag and drop any of the Components or Children onto
the window.

So far I have worked out that I need to add a DragSourceListener onto
the Project Explorer window (somehow), and a resulting
DropTargetListener onto the ViewPart, using a custom Transfer class
based likely on SimpleObjectTransfer. Is this right?

How can I reference the Project Explorer window to register an
additional DragSourceListener? Or am I going the wrong way about this
(mixing GMF/GEF with SWT/Eclipse)?

Is there an example I could build upon? The Logic example allows for
drag-dropping items within the Outline view, but doesn't link up with
the Navigator or allow drag-drop from outline view to current view window.

Currently I can handle IResource drag-drops (ResourceTransfer) (I
think), but these aren't helpful because the data is set to null when
dragging one of the model components, so I can't see what was actually
dragged.

Thanks for any help.

Jevon
Re: Drag-drop from Project Explorer to Diagram [message #200049 is a reply to message #199979] Mon, 04 August 2008 10:09 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jevon,

> I am trying to implement drag and drop from model nodes in the Project
> Explorer tree (generated with GMF's navigator generator) into an open
> GMF model diagram. For example:
This functionality can be generated by GMF for you. You have to set "shortcutsProvidedFor"/"containsShortcutsTo"
properties in accordance with http://wiki.eclipse.org/GMF_GenModel_Hints#GenDiagram
and regenerate diagram code. As a result "shortcut" to the dropped element
should be created on underlying diagram on D&D from the model navigator to
the diagam.

-----------------
Alex Shatalin
Re: Drag-drop from Project Explorer to Diagram [message #200254 is a reply to message #200049] Tue, 05 August 2008 05:30 Go to previous messageGo to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Wow, thanks Alex! That works perfectly!

Jevon

Alex Shatalin wrote:
> Hello Jevon,
>
>> I am trying to implement drag and drop from model nodes in the Project
>> Explorer tree (generated with GMF's navigator generator) into an open
>> GMF model diagram. For example:
> This functionality can be generated by GMF for you. You have to set
> "shortcutsProvidedFor"/"containsShortcutsTo" properties in accordance
> with http://wiki.eclipse.org/GMF_GenModel_Hints#GenDiagram and
> regenerate diagram code. As a result "shortcut" to the dropped element
> should be created on underlying diagram on D&D from the model navigator
> to the diagam.
>
> -----------------
> Alex Shatalin
>
>
Re: Drag-drop from Project Explorer to Diagram [message #207586 is a reply to message #200254] Wed, 01 October 2008 06:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: manojm.blr.interrasystems.com

Hi!

I am also facing kind of same problem.
I want to implement DnD, from different medel to GMF editor.

Could you please help?

Regards,
Manoj

Jevon Wright wrote:
> Wow, thanks Alex! That works perfectly!
>
> Jevon
>
> Alex Shatalin wrote:
>
>> Hello Jevon,
>>
>>> I am trying to implement drag and drop from model nodes in the Project
>>> Explorer tree (generated with GMF's navigator generator) into an open
>>> GMF model diagram. For example:
>>
>> This functionality can be generated by GMF for you. You have to set
>> "shortcutsProvidedFor"/"containsShortcutsTo" properties in accordance
>> with http://wiki.eclipse.org/GMF_GenModel_Hints#GenDiagram and
>> regenerate diagram code. As a result "shortcut" to the dropped element
>> should be created on underlying diagram on D&D from the model
>> navigator to the diagam.
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: Drag-drop from Project Explorer to Diagram [message #207627 is a reply to message #207586] Wed, 01 October 2008 12:16 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Manoj,

> I want to implement DnD, from different medel to GMF editor.
You can use GMF-generated as an example of D&D implementation and try doing
the same in with different model view/editor..

-----------------
Alex Shatalin
Re: Drag-drop from Project Explorer to Diagram [message #207635 is a reply to message #207627] Wed, 01 October 2008 13:50 Go to previous message
Eclipse UserFriend
Originally posted by: manojm.blr.interrasystems.com

Thanks Alex,

But how should I make my editor aware of the fact, that the dropped
element is from other model?

Please provide me some clue.

Regards,
Manoj

Alex Shatalin wrote:
> Hello Manoj,
>
>> I want to implement DnD, from different medel to GMF editor.
>
> You can use GMF-generated as an example of D&D implementation and try
> doing the same in with different model view/editor..
> -----------------
> Alex Shatalin
>
>
Previous Topic:Scheme editor, ecore to gmf
Next Topic:How to create Share EditingDomain: Should all the metamodelType be replaced by specializationType in
Goto Forum:
  


Current Time: Wed Mar 03 06:42:36 GMT 2021

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

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

Back to the top