|Re: DND support for text in project explorer [message #304904 is a reply to message #304472]
||Mon, 19 June 2006 01:29
| Michael D. Elder
Registered: July 2009
What Transfer Type are you trying to add? Is there a reason why the
LocalSelectionTransfer (the default version from JFace) wouldn't work in
What are you trying to drag the selection onto? Another editor?
Something else in the Project Explorer viewer?
The handshake between drag and drop adapters is a little subtle.
Basically, the DND support in Eclipse tries to find a TransferType that
both sides can support. So in this case, whatever the thing is you're
trying drop onto is selecting the FileTransfer type. Only then, is your
adapter given the opportunity to actually set the data. You should be
able to setup any Transfer Type you want. The JFace LocalSelection is
handled by default, and with org.eclipse.ui.navigator.resources adding
support for FileTransfer and ResourceTransfer. (These must be layered in
to allow the core framework to be RCP compliant while still handling the
90% case for IDE clients).
> Thanks to the very helpful articles about the Common Navigator Framework
> from Michael D. Elder, I wrote an extension to the Project Explorer that
> allows expanding and collapsing of XML-Elements.
> So far, everything works great.
> Now we want to allow DND for some specific expanded XML-Elements into
> the XML-Editor.
> Therefor I extended the "org.eclipse.ui.navigator.ProjectExplorer" -
> Extension-Point with the dragAssistent element.
> I extended the CommonDragAdapterAssistent Class and filled the methods
> getSupportTransferTypes and setDragData with contents.
> But it didn't work as I meant it to work.
> I set printlns in the code and found out, that the method "setDragData"
> is only called if I set "FileTransfer" to one of the supported types in
> the "getSupportedTransferTypes" method.
> Hence, could it be that the Project Explorer only allows to DND Files?
> How can I DND text?
Powered by FUDForum
. Page generated in 0.01779 seconds