Question about Common Navigator and drop adapter assistants [message #330247] |
Tue, 22 July 2008 16:30  |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
I've got a common navigator viewer for which I need to do some
specialized drag-and-drop handling. I'm trying to define a
CommonDropAdapterAssistant to be used for certain file types. So in my
plugin.xml I have something like this:
<dropAssistant
class="org.skyway.core.ui.navigator.SkywayDropAssistant"
id="org.skyway.core.ui.navigator.dropAssistant">
<possibleDropTargets>
<adapt type="org.skyway.core.model.Container"></adapt>
</possibleDropTargets>
</dropAssistant>
The problem is, even when the drop target can not be adapted to a
org.skyway.core.model.Container, the drop operation is allowed to proceed.
I think this is because there is always a
org.eclipse.ui.navigator.resources.ResourceDropAdapterAssist ant included
(it is declared by the plugin org.eclipse.ui.navigator.resources) and
it's possibleDropTargets expression includes any target that can be
adapted to an IFile, IFolder, or IProject.
So can I have a drop assistant that controls the validation of drops on
particular files and folders? In other words, can I override this
behavior of ResourceDropAdapterAssistant for certain resources, while
keeping it in place for everything else?
Eric
|
|
|
Re: Question about Common Navigator and drop adapter assistants [message #330269 is a reply to message #330247] |
Thu, 24 July 2008 02:08  |
Eclipse User |
|
|
|
The org.eclipse.ui.navigator.resources does defined a DropAssistant that
handles resources. However, you don't need to include this with your
instance of the CN.
You probably have something like this as part of your
org.eclipse.ui.navigator.viewer extension:
<viewerContentBinding
viewerId="example.view">
<includes>
<contentExtension
pattern="org.eclipse.ui.navigator.resourceContent" />
<contentExtension
pattern="org.eclipse.ui.navigator.resources.filters.*"/>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.linkHelper"/>
<contentExtension
pattern="org.eclipse.ui.navigator.resources.workingSets"/>
</includes>
</viewerContentBinding>
The first content extension pulls the resourceContent which includes the
dropAssistant. Just remove that reference. If you want some of what's
defined in org.eclipse.ui.navigator, then you can make your own content
extension and copy what you want from the
org.eclipse.ui.navigator.resources plugin.
HTH,
Francis
PS - sorry for the delay in the reply.
Eric Rizzo wrote:
> I've got a common navigator viewer for which I need to do some
> specialized drag-and-drop handling. I'm trying to define a
> CommonDropAdapterAssistant to be used for certain file types. So in my
> plugin.xml I have something like this:
>
> <dropAssistant
> class="org.skyway.core.ui.navigator.SkywayDropAssistant"
> id="org.skyway.core.ui.navigator.dropAssistant">
> <possibleDropTargets>
> <adapt type="org.skyway.core.model.Container"></adapt>
> </possibleDropTargets>
> </dropAssistant>
>
> The problem is, even when the drop target can not be adapted to a
> org.skyway.core.model.Container, the drop operation is allowed to proceed.
> I think this is because there is always a
> org.eclipse.ui.navigator.resources.ResourceDropAdapterAssist ant included
> (it is declared by the plugin org.eclipse.ui.navigator.resources) and
> it's possibleDropTargets expression includes any target that can be
> adapted to an IFile, IFolder, or IProject.
>
> So can I have a drop assistant that controls the validation of drops on
> particular files and folders? In other words, can I override this
> behavior of ResourceDropAdapterAssistant for certain resources, while
> keeping it in place for everything else?
>
> Eric
--
*new* Common Navigator Framework section in:
3.4RC4 Platform Plugin Developer Guide (Programmer's Guide)
http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/guide/cnf.htm
http://dev.eclipse.org/blogs/francis
http://wiki.eclipse.org/Common_Navigator_Framework
http://wiki.eclipse.org/Common_Navigator_Framework_Use_Cases
You have brains in your head.
You have feet in your shoes.
- Dr Seuss, Oh the Places You'll Go
|
|
|
Powered by
FUDForum. Page generated in 0.06889 seconds