Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Common Navigator PluginTransfer DND(PluginTransferData Common Navigator Framework)
Common Navigator PluginTransfer DND [message #765383] Wed, 14 December 2011 00:00 Go to next message
Erik Englund is currently offline Erik EnglundFriend
Messages: 49
Registered: July 2009
Member
I have a Common Navigator View that contains my own content. I would like to trigger an action when I drag on of my object onto an IResource in the Project Explorer, or Package explorer or wherever. I can drag an IResource into my viewer just fine. The other direction doesn't seem to work.

I would have thought that all I need to do is override

validatePluginTransferDrop and handlePluginTransferDrop in my DropAdapterAssistant. I Extend CommonDropAdapterAssistant.

I turned on tracing and I see the drag happening but the transfer type is always LocalSelectionTransfer. And since the target viewer doesn't recognize my objects nothing happens and the drop is aborted.

In my navigatorContent extension the dropAssistant possibleDropTargets is an or of my model object type and IResource.

What am I missing here?
Re: Common Navigator PluginTransfer DND [message #765906 is a reply to message #765383] Wed, 14 December 2011 21:45 Go to previous messageGo to next message
Erik Englund is currently offline Erik EnglundFriend
Messages: 49
Registered: July 2009
Member
So I was able to get my dropAssistant to be called by including my Navigator content within the project explorer view. While this works, it is not the way I would want it to work since it adds my navigator content to the project explorer view which doesn't make sense.

I beleive the problem lies in how the drag enter validate drop works. The drag enter if it runs into a local selection transfer will use that. However, later on the validate drop won't know what to do with the selection an thus ignore it. It it had instead used the plugin drop everything would have been fine.
Re: Common Navigator PluginTransfer DND [message #766959 is a reply to message #765383] Fri, 16 December 2011 18:39 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Quote:
So I was able to get my dropAssistant to be called by including my Navigator content within the project explorer view. While this works, it is not the way I would want it to work since it adds my navigator content to the project explorer view which doesn't make sense.


I'm not sure why this does not make sense to you. You are essentially modifying the Project Explorer to handle the drop of your object then your plugin is installed. I think this is the way things are supposed to work.

Quote:
I beleive the problem lies in how the drag enter validate drop works. The drag enter if it runs into a local selection transfer will use that. However, later on the validate drop won't know what to do with the selection an thus ignore it. It it had instead used the plugin drop everything would have been fine.


Can you elaborate on the last sentence please? (Forgive me, I have been away from this code for a while, but I would like to understand if we need to do anything here).

Thanks!


Re: Common Navigator PluginTransfer DND [message #768097 is a reply to message #766959] Mon, 19 December 2011 15:17 Go to previous messageGo to next message
Erik Englund is currently offline Erik EnglundFriend
Messages: 49
Registered: July 2009
Member
1
I'm not sure why this does not make sense to you. You are essentially modifying the Project Explorer to handle the drop of your object then your plugin is installed. I think this is the way things are supposed to work.


You are probably right. I just felt it was strange since I didn't want to contribute any content to the Project Explorer, I just wanted to contribute behavior. For example, I didn't want my Navigator content to appear in the Content Tab of the Project Explorer. But I still wanted be able to drag my content from my navigator into the project explorer.

2

Can you elaborate on the last sentence please? (Forgive me, I have been away from this code for a while, but I would like to understand if we need to do anything here).


Forgive me, I just read over it myself and realized I should have proof read it some more before submitting.

Basically, I saw my DropAdapterAssistant if I extend CommonDropAdapterAssistant I can override the following methods:
IStatus handlePluginDrop(IStructuredSelection, Object)
and
IStatus validatePluginTransferDrop(IStructuredSelection, Object)

They seemed to work the same way as the validateDrop and handleDrop methods, only these would be triggered by the callback of the PluginTransferData.

I assumed that meant if I dragged an item from my NavigatorContent onto another viewer it would use the PluginTransferData and callback to my DropAdapterAssistant.

While debuging it I saw that in the CommonDropAdapter.dragEnter(DropTargetEvent) it first checks to see if the event supports LocalSelectionTransfer. If it does it tries to handle the event as a LocalSelectionTransfer. Since I am dragging from a NavigatorContententViewer the LocalSelectionTransferType will always be supported as well as PluginTransferType.

Now I was hoping that the other viewer would realize it couldn't handle the object within the LocalSelectionTransfer and thus abort back to using the PluginTransferType instead. This doesn't appear to be the case. It appears the only way the PluginTransferData Type would be used is if the Event did NOT support either LocalSelectionTransferType nor FileTransferType.

Re: Common Navigator PluginTransfer DND [message #905933 is a reply to message #765383] Fri, 31 August 2012 10:34 Go to previous message
paolo russian is currently offline paolo russianFriend
Messages: 81
Registered: July 2009
Member

"I have a Common Navigator View that contains my own content. I would like to trigger an action when I drag on of my object onto an IResource in the Project Explorer, or Package explorer or wherever. I can drag an IResource into my viewer just fine. The other direction doesn't seem to work."

Excuse me but I have a CNV view and I can drag out of it my custom objects wherever I want, but I cannot manage to do the other way round: I need to drag stuff over some of my custom nodes and it seems impossible. Looks like the opposite of your situation. How did you attached a drop listener to the CNV?
I'm not talking of reordering stuff inside the same tree. I mean for instance draggin text from wherever over a node and replacing the node name with that text, just to make an example.
Previous Topic:Export wizard failing
Next Topic:How to find which feature contains org.eclipse.core.runtime?
Goto Forum:
  


Current Time: Thu Apr 25 14:34:12 GMT 2024

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

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

Back to the top