• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drag and Drop to Tree Viewer

 
LQ McDonald III
Greenhorn
Posts: 10
Eclipse IDE IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there folks,

So I am having an issue with a bit of code that I am working with and I thought I would stop banging my head against the screen long enough to petition the brilliant minds here at the ranch for some guidance.

I have a TreeViewer that is set up and working nicely inside an RCP View. Everything is working fine with that. I also have another view that contains a ListViewer. Also working fine. I have the List in the ListViewer as the DragSource and the Tree in my TreeViewer as my Drop Target. I also have a Mouse Hover Listener on the tree to change the selection when a node of the tree is hovered over. This also works as intended. The issue I am having is that when I grab an item from the list and drag it to the tree the mouse hover even does not get handled. It is obvious to me that this is because the mouse button is held down and mouse events can't trigger if the mouse button is held down but I am wondering if anyone has a work around or potentially clever solution to the problem? What i want to happen is when I grab something from the list and drag it to the tree I want the tree to change to the node I am hovered over and drop the object there.

I have tried several different potential solutions including focus listeners, mouse events, etc to no avail. I thought I would get a fresh perspective before I throw my computer out the window. I appreciate the time and energy of your responses and if you need further clarification please ask. Thanks!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if it was Swing, you might be able to dispatchEvent(..) to the TreeViewer.
don't know if there's an equivalent in SWT (?)
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no experience with it, but I think you should probably post some code snippet to show what you have done so far. That will increase your chances of getting an answer.
 
LQ McDonald III
Greenhorn
Posts: 10
Eclipse IDE IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:if it was Swing, you might be able to dispatchEvent(..) to the TreeViewer.
don't know if there's an equivalent in SWT (?)


If it was Swing it would be much easier, of that much I am certain but the dev environment requires SWT/Jface api.

I am not sure how relevant a code snippet(s) is as the solution is not reliant on any particular implementation. I am simply asking if there is a reasonable way to detect mouse events even when the mouse button is held down. I have explained what I have done so far and I do not see the value in prancing out a bunch of code that does not address the root issue, namely the question about whether mouse hover events can be forced to be handled even if the mouse button is held down.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I read the post to quickly and didn't notice you're looking just for an idea.
 
LQ McDonald III
Greenhorn
Posts: 10
Eclipse IDE IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kemal Sokolovic wrote:Sorry, I read the post to quickly and didn't notice you're looking just for an idea.


No problem. I appreciate the post and advice anyway.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic