Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to Drag a node from a tree view to EMF editor?
How to Drag a node from a tree view to EMF editor? [message #418284] Wed, 09 April 2008 23:30 Go to next message
Eclipse UserFriend
Originally posted by: hufangjian31.hotmail.com

Hi,
I have an application like the "library" example, so you can creat a
library that has kinds of books. Let's say we have creat a library which
has 3 books and we save this file. I have created my own tree view to
diaplay the content of this "library", I mean, you can see how many books
are there in this library from this view.
Now if I want to drag a "book" from this tree view and drop it to the EMF
editor, I hope I can creat a new "book" item to the EMF editor.
what can I do to achieve that?//or is there any article or tutorial about
this?
any advice will be welcome.
Thanks in advance!

Best Regards
HU Fangjian
Re: How to Drag a node from a tree view to EMF editor? [message #418285 is a reply to message #418284] Thu, 10 April 2008 00:39 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Drag and drop support is hooked up like this in the generated editor:

viewer.addDragSupport(dndOperations, transfers, new
ViewerDragAdapter(viewer));
viewer.addDropSupport(dndOperations, transfers, new
EditingDomainViewerDropAdapter(editingDomain, viewer));

You'll need to investigate how that works to do something similar...


Fangjian wrote:
> Hi,
> I have an application like the "library" example, so you can creat a
> library that has kinds of books. Let's say we have creat a library
> which has 3 books and we save this file. I have created my own tree
> view to diaplay the content of this "library", I mean, you can see how
> many books are there in this library from this view.
> Now if I want to drag a "book" from this tree view and drop it to the
> EMF editor, I hope I can creat a new "book" item to the EMF editor.
> what can I do to achieve that?//or is there any article or tutorial
> about this? any advice will be welcome.
> Thanks in advance!
>
> Best Regards
> HU Fangjian
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to Drag a node from a tree view to EMF editor? [message #418296 is a reply to message #418285] Thu, 10 April 2008 23:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hufangjian31.hotmail.com

Thanks for your advice.
I know that you can drag a "book" form the outline view and drop it to the
EMF editor. I can drag the "book" from my own tree view but I can not drop
to the editor. Is there any trick about this?
Ed Merks wrote:

> Drag and drop support is hooked up like this in the generated editor:

> viewer.addDragSupport(dndOperations, transfers, new
> ViewerDragAdapter(viewer));
> viewer.addDropSupport(dndOperations, transfers, new
> EditingDomainViewerDropAdapter(editingDomain, viewer));

> You'll need to investigate how that works to do something similar...


> Fangjian wrote:
>> Hi,
>> I have an application like the "library" example, so you can creat a
>> library that has kinds of books. Let's say we have creat a library
>> which has 3 books and we save this file. I have created my own tree
>> view to diaplay the content of this "library", I mean, you can see how
>> many books are there in this library from this view.
>> Now if I want to drag a "book" from this tree view and drop it to the
>> EMF editor, I hope I can creat a new "book" item to the EMF editor.
>> what can I do to achieve that?//or is there any article or tutorial
>> about this? any advice will be welcome.
>> Thanks in advance!
>>
>> Best Regards
>> HU Fangjian
>>
Re: How to Drag a node from a tree view to EMF editor? [message #418297 is a reply to message #418296] Thu, 10 April 2008 23:36 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Fangjian,

I guess you hooked up a drag source to your view... Did you try setting
breakpoints in the drop adapter to see what happens when you try to drop
into the editor. The debugger is your best friend and it's not a good
idea to neglect one your best friends...


Fangjian wrote:
> Thanks for your advice.
> I know that you can drag a "book" form the outline view and drop it to
> the EMF editor. I can drag the "book" from my own tree view but I can
> not drop to the editor. Is there any trick about this?
> Ed Merks wrote:
>
>> Drag and drop support is hooked up like this in the generated editor:
>
>> viewer.addDragSupport(dndOperations, transfers, new
>> ViewerDragAdapter(viewer));
>> viewer.addDropSupport(dndOperations, transfers, new
>> EditingDomainViewerDropAdapter(editingDomain, viewer));
>
>> You'll need to investigate how that works to do something similar...
>
>
>> Fangjian wrote:
>>> Hi,
>>> I have an application like the "library" example, so you can creat a
>>> library that has kinds of books. Let's say we have creat a library
>>> which has 3 books and we save this file. I have created my own tree
>>> view to diaplay the content of this "library", I mean, you can see
>>> how many books are there in this library from this view.
>>> Now if I want to drag a "book" from this tree view and drop it to
>>> the EMF editor, I hope I can creat a new "book" item to the EMF
>>> editor. what can I do to achieve that?//or is there any article or
>>> tutorial about this? any advice will be welcome.
>>> Thanks in advance!
>>>
>>> Best Regards
>>> HU Fangjian
>>>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Is there anyway to save model without eclipse platform dependency?
Next Topic:change recorder
Goto Forum:
  


Current Time: Thu Mar 28 10:08:31 GMT 2024

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

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

Back to the top