Drag selected text from Editor Follow
I'm little bit stuck with drag selected text from Editor window to my plugin present by toolWindow.
Problem what I'm facing is when drop done selected text is removed from source Editor.
Is there any way how I can disable that "feature"? I did try set getSourceActions() to COPY as prevention removing text but no change.
I'll be happy is someone help me with that.
Please sign in to leave a comment.
It will work in the desired way, if your drop target will be implemented using com.intellij.ide.dnd.DnDManager. See 'registerTarget' method in particular.
Thx for answer anyway result is not as I expected.
My target is JBList within ToolWindow. I did register this component with DndManager.registerTarget but while I can see any activity while dragging item from Project three (repeat update() follow drop() and cleanUpOnLeave()) with selected text dragged from opened editor window I see only cleanUpOnLeave() call.
Also another issue is with highlight list item when cursor is over ...is doing nothing. ]
Previous I had got jbList.setTransferHandler() which more less works as expected (of course problem was with removing dragged text).
Then is there something what I'm doing wrong? Or better is there any sample how to implement DndManager with JBList?
Make your drop target implement DnDNativeTarget (it enables drag'n'drop from sources not using DnDManager, like editor).
I could find only one example of using DnDManager with JBList - com.intellij.ide.palette.impl.PaletteGroupHeader.
With DndNativeTarget now I can see call update() also from editor (dragged selected text to jlist) but unline item from projecttree editor doesn't produce drop() call. :(
Make sure you have
in 'update' method.