Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » DND support for text in project explorer
DND support for text in project explorer [message #304472] Wed, 07 June 2006 21:09 Go to next message
Sandro Schiefner is currently offline Sandro SchiefnerFriend
Messages: 13
Registered: July 2009
Junior Member
Hi,

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?

Sandro
Re: DND support for text in project explorer [message #304904 is a reply to message #304472] Mon, 19 June 2006 01:29 Go to previous messageGo to next message
Michael D. Elder is currently offline Michael D. ElderFriend
Messages: 62
Registered: July 2009
Member
Hi Sandro,

What Transfer Type are you trying to add? Is there a reason why the
LocalSelectionTransfer (the default version from JFace) wouldn't work in
your scenario?

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).


-MDE.


Sandro wrote:
> Hi,
>
> 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?
>
> Sandro
Re: DND support for text in project explorer [message #871528 is a reply to message #304904] Mon, 14 May 2012 10:46 Go to previous message
Uwe Voigt is currently offline Uwe VoigtFriend
Messages: 10
Registered: July 2009
Junior Member
... reactivating an ancient thread.

I'd like to drag objects using FileTransfer from ProjectExplorer to the EditorArea. Unfortunately I couldn't manage it for the exception pasted below.
In plugin.xml I have added my DragAssistant to the ProjectExplorer using the org.eclipse.ui.navigator.viewer extension point. It supports only FileTransfer.

It seems the problem arises because of the ResourceTransfer which is added to the allowed transfer types by default.
Since org.eclipse.swt.dnd.Transfer is not ordered within the Set of supported types in CommonDragAdapter.getSupportedDragTransfers in some VM sessions the FileTransfer is before the ResourceTransfer and in some it is after it in the resulting array of Transfers.

Do I miss something or should it be possible to explicitly exclude Transfer-types by the API of a DragAssistant?


Thanks for the help,
Uwe

Caused by: org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
at org.eclipse.ui.internal.ide.EditorAreaDropAdapter.asyncDrop(EditorAreaDropAdapter.java:116)
Previous Topic:[ANN] JXTA development plug-in
Next Topic:Is there a way to programatically set the width of the columns in the ProblemsView?
Goto Forum:
  


Current Time: Thu Mar 28 16:43:41 GMT 2024

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

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

Back to the top