Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Project Explorer navigator content dropAssistant validate drop not being called(how to get my dropAssistant to be called when dragging files onto my IProject with Nature)
Project Explorer navigator content dropAssistant validate drop not being called [message #758870] Thu, 24 November 2011 21:02 Go to next message
John B is currently offline John B
Messages: 18
Registered: November 2011
Junior Member
Is it even possible? If so what am I missing?
Requirements:
Drag file(s) from outside Eclipse into Project Explorer. If dragged file(s) are over one of my IProject with ProjectNature OR is over a IFolder inside one of my IProject with ProjectNature then validateDrop in my drop assistant. If valid then let Eclipse's ImportTypeDialog handle the drop.

The Project Explorer can have a mix of projects. Java, PyDev, My Project with Nature, etc.

Currently when I drag a file into Project Explorer from outside Eclipse the only time my drop assistant's validateDrop is called is when the target is WorkspaceRoot. As soon as the dragged item is over anything other than WorkspaceRoot it stops using my drop assistant.
When I drag a file from one of my IProject with ProjectNature (ProjectA) it only calls validateDrop when inside the originating IProject (ProjectA). If you drag the file from ProjectA to a different IProject with my Project Nature (ProjectB) my validateDrop in my drop assistant is not called.

Here is my content extension:
    <extension
         point="org.eclipse.ui.navigator.navigatorContent">
      <navigatorContent
            contentProvider="com.custom.navigator.providers.ContentProvider"
            id="com.custom.navigator.navigatorContent"
            labelProvider="com.custom.navigator.providers.LabelProvider"
            name="Navigator Content"
            priority="highest">
         <triggerPoints>
            <or>
               <and>
                  <instanceof
                        value="org.eclipse.core.resources.IProject">
                  </instanceof>
                  <test
                        property="org.eclipse.core.resources.projectNature"
                        value="com.ui.ide.projectNature">
                  </test>
               </and>
               <instanceof
                     value="org.eclipse.core.resources.IResource">
               </instanceof>
            </or>
         </triggerPoints>
         <dropAssistant
               class="com.custom.navigator.dnd.CommonDropAdapterAssistant"
               id="com.custom.navigator.dropAssistant">
            <possibleDropTargets>
               <or>
                  <instanceof
                        value="org.eclipse.core.resources.IProject">
                  </instanceof>
                  <instanceof
                        value="org.eclipse.core.resources.IResource">
                  </instanceof>
                  <instanceof
                        value="org.eclipse.core.resources.IContainer">
                  </instanceof>
               </or>
            </possibleDropTargets>
         </dropAssistant>
         <possibleChildren>
            <or>
               <instanceof
                     value="org.eclipse.core.resources.IResource">
               </instanceof>
            </or>
         </possibleChildren>
      </navigatorContent>
   </extension>



Is there anyway to override the dropAssistant from org.eclipse.ui.navigator.resourceContent? [message #759494 is a reply to message #758870] Mon, 28 November 2011 19:47 Go to previous messageGo to next message
John B is currently offline John B
Messages: 18
Registered: November 2011
Junior Member
It all boils down to including org.eclipse.ui.navigator.resourceContent (contentExtension) in the org.eclipse.ui.navigator.viewer extension as a viewerContentBinding.

If you don't include org.eclipse.ui.navigator.resourceContent then my dropAssistant is used. But I lose Copy, Paste, Delete, Move... and Rename... from the context menu which is defined in org.eclipse.ui.navigator.resourceContent as actionProviders. You also lose the two common wizards and commonSorter both of which I'm less interested in.

Copying everything from org.eclipse.ui.navigator.resourceContent except the dropAssistant into your own navigatorContent definition doesn't work either. Copy, Paste, Delete, etc. don't appear on the context menu.

Is there any way to override the dropAssistant from org.eclipse.ui.navigator.resourceContent?

[Updated on: Mon, 28 November 2011 21:35]

Report message to a moderator

Re: Is there anyway to override the dropAssistant from org.eclipse.ui.navigator.resourceContent? [message #765710 is a reply to message #759494] Wed, 14 December 2011 15:02 Go to previous messageGo to next message
John B is currently offline John B
Messages: 18
Registered: November 2011
Junior Member
I think the problem may be with bug 295760 in bugs.eclipse.org
https://bugs.eclipse.org/bugs/show_bug.cgi?id=295760

I am unable to handle drops on MY marked and decorated IFolder(s) because the org.eclipse.ui.navigator.resourceContent navigatorContent always takes over. Even if I set MY navigatorContent priority to highest and set it to appearBefore org.eclipse.ui.navigator.resourceContent and to override org.eclipse.ui.navigator.resourceContent.


[Updated on: Wed, 14 December 2011 19:39]

Report message to a moderator

Re: Is there anyway to override the dropAssistant from org.eclipse.ui.navigator.resourceContent? [message #794385 is a reply to message #765710] Thu, 09 February 2012 08:16 Go to previous messageGo to next message
Ray Missing name is currently offline Ray Missing name
Messages: 4
Registered: July 2011
Junior Member
Has this issue been solved?
Or any workaround?

Thanks!
Re: Is there anyway to override the dropAssistant from org.eclipse.ui.navigator.resourceContent? [message #794637 is a reply to message #794385] Thu, 09 February 2012 14:28 Go to previous message
John B is currently offline John B
Messages: 18
Registered: November 2011
Junior Member
The issue is not resolved. It is currently (Eclipse 3.7.1) not possible to override a drop assistant.

I ended up having my content provider override resourceContent's content provider and replacing any Marked IFolder with a new object of my type (MyFolder). That allows my drop assistant to control reordering of IFile's under MyFolder and control what is dropped into MyFolder.


Previous Topic:Problem running app with multiple versions of the same bundle selected
Next Topic:Re: Use &quot;Save and Launch&quot; Dialog for my own Plugin
Goto Forum:
  


Current Time: Mon Oct 20 13:06:48 GMT 2014

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

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