Bug 195655 - [dnd] Drag'n'drop selected text
Summary: [dnd] Drag'n'drop selected text
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P2 normal with 17 votes (vote)
Target Milestone: 3.17   Edit
Assignee: Dawid Pakula CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
: 283994 387549 (view as bug list)
Depends on: 178104 173405
Blocks: 231294
  Show dependency tree
 
Reported: 2007-07-06 10:10 EDT by Double Compile CLA
Modified: 2020-01-09 09:46 EST (History)
18 users (show)

See Also:


Attachments
A screen shot to illustrate how to patch MergeDropTarget inner class (51.25 KB, image/png)
2015-08-18 17:21 EDT, Eclipse Consultant CLA
no flags Details
Patch file (905 bytes, patch)
2015-08-18 17:57 EDT, Eclipse Consultant CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Double Compile CLA 2007-07-06 10:10:16 EDT
+++ This bug was initially created as a clone of Bug #156323 +++

Dragging selected text in editor

This feature is now available in the Eclipse Platform.  Please, please, please add this feature to PDT!
Comment 1 moshe CLA 2007-07-18 06:44:00 EDT
StructuredTextEditor override method:
protected void installTextDragAndDrop(ISourceViewer viewer) {
	// do nothing
}
What is the reason?
Comment 2 Nitin Dahyabhai CLA 2007-07-24 15:32:51 EDT
(In reply to comment #1)
> StructuredTextEditor override method:
> protected void installTextDragAndDrop(ISourceViewer viewer) {
>         // do nothing
> }
> What is the reason?

Extension points we've had since before WTP 1.0 have allowed drop handlers to be registered and changed on the fly, conflicting with the newly introduced IDragAndDropService (see bug 173405, bug 173410, and bug 178104) and its support in AbstractTextEditor.  Dropping text into the editor already works through StructuredTextEditor.initializeDrop(ITextViewer)
Comment 3 Francis Upton IV CLA 2009-07-21 01:27:43 EDT
*** Bug 283994 has been marked as a duplicate of this bug. ***
Comment 4 Scott Iverson CLA 2009-10-15 20:23:46 EDT
You should also be able to hold down ctrl while dragging to copy the selected
text once this bug is fixed, right?
Comment 5 John Warde CLA 2009-10-16 05:51:33 EDT
Please fix Drag and Drop text in Eclipse for PHP, HTML, CSS, XML (source view)
etc.  Thanks! John
Comment 6 Ian Tewksbury CLA 2010-02-05 15:35:04 EST
we still don't seem to have drag and drop in HTML, XML, JSP, or CSS, this would be nice to have but seems like an enhancement request not a bug fix.
Comment 7 Jason Epperson CLA 2011-12-13 18:50:27 EST
"we still don't seem to have drag and drop in HTML, XML, JSP, or CSS, this would
be nice to have but seems like an enhancement request not a bug fix."

I would deem this a bug. If it was totally unavailable I would consider it a "feature request". However, the fact that I can highlight and drag text in a file with the extension .js, but not in a file with the extension .htm presses me to label this a bug.

Especially as HTML is probably the most ubiquitous language out there. Please address in a future update. 

Thank you.

My file extension should not determine my text editing features.
Comment 8 Nitin Dahyabhai CLA 2012-08-20 09:50:39 EDT
*** Bug 387549 has been marked as a duplicate of this bug. ***
Comment 9 Philippe Lhoste CLA 2014-09-16 06:20:57 EDT
Mmm, this bug is 7 years old, and marked as P2...

As I routinely drag'n'drop snippets of code, to move them or to copy them (and change them thereafter), I see this bug in the Web Tools to be a major drag (erm).
I dislike using the clipboard when I can avoid it, as I prefer avoiding polluting my clipboard manager history, and beside, I find its usage slower for such small movements.

Of course, I don't see the difficulties in fixing this (lot of legacy code to update?), but I sure hope somebody will have a look at it.

Thanks.
Comment 10 Eclipse Consultant CLA 2015-08-18 17:21:14 EDT
Created attachment 255936 [details]
A screen shot to illustrate how to patch MergeDropTarget inner class

Patch the code change in EditorSiteDragAndDropServceImpl
Comment 11 Eclipse Consultant CLA 2015-08-18 17:29:47 EDT
(In reply to Jack Chi from comment #10)
> Created attachment 255936 [details]
> A screen shot to illustrate how to patch MergeDropTarget inner class
> 
> Patch the code change in EditorSiteDragAndDropServceImpl

I also think this bug should be assigned to platform team. this problem is found in the ui.workbench project so it has nothing to do with web standard tool project. The platform team is still actively working on e4 projects so there should be some developers there to own this project.
Comment 12 Eclipse Consultant CLA 2015-08-18 17:57:38 EDT
Created attachment 255937 [details]
Patch file

Provide this patch file so that you build a new ui.workbench project and put the produced jar file in your target folder.
Comment 13 Eclipse Consultant CLA 2015-08-25 17:36:44 EDT
I found some code in IDEWorkbenchWindowAdvisor.preWindowOpen() that shows you how to set up the drag and drop in your workbench. Ignore my previous patch and comments.

configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
configurer.addEditorAreaTransfer(FileTransfer.getInstance());
configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
				configurer.getWindow()));
Comment 14 Dawid Pakula CLA 2020-01-06 16:20:26 EST
How can I help?
Comment 15 Nitin Dahyabhai CLA 2020-01-06 22:48:42 EST
(In reply to Dawid Pakula from comment #14)
> How can I help?

Comment 2 sort of explains the state of things--because our older extension point allows for *removing* drop listeners as well as adding them, an ideal design would somehow avoild losing that ability, and a solution hasn't been thought up, yet. It's likely that being able to cleanly remove drop listeners isn't a useful trait any more, but the code to support the existing internal extension point on top of the Platform's would still need to be written. I'm not keen on breaking the existing editors that hook in that way to use the StructuredTextEditor as their source page.
Comment 16 Dawid Pakula CLA 2020-01-07 08:27:43 EST
(In reply to Nitin Dahyabhai from comment #15)
> (In reply to Dawid Pakula from comment #14)
> > How can I help?
> 
> Comment 2 sort of explains the state of things--because our older extension
> point allows for *removing* drop listeners as well as adding them, an ideal
> design would somehow avoild losing that ability, and a solution hasn't been
> thought up, yet. It's likely that being able to cleanly remove drop
> listeners isn't a useful trait any more, but the code to support the
> existing internal extension point on top of the Platform's would still need
> to be written. I'm not keen on breaking the existing editors that hook in
> that way to use the StructuredTextEditor as their source page.

I'm not sure how drop listeners can be removed?

As I see StructuredTextEditor on startup register own drop adapter and read possible transfers via ExtendedEditorDropTargetAdapter.
Comment 17 Eclipse Genie CLA 2020-01-07 10:40:08 EST
New Gerrit change created: https://git.eclipse.org/r/155409
Comment 18 Nitin Dahyabhai CLA 2020-01-07 17:00:00 EST
(In reply to Dawid Pakula from comment #16)
> I'm not sure how drop listeners can be removed?

I might have been thinking of it as one of the features that could be reconfigured when the editor's input changes, but it doesn't seem to be wired up to do so. If our own text drop listener is still handling text drops when merged into the platform support, it could mimic what the platform does by remembering the previously selected text on a drag and removing it when dropping text (and forgetting about it afterward). That's the bulk of what users would care about, I suspect.
Comment 19 Dawid Pakula CLA 2020-01-07 17:07:41 EST
I prepared working solution on Gerrit. SSE IDropAction works like before and if IDropAction isn't configured for TextTransfer,  AbstractTextEditor implementation will be used
Comment 21 Dawid Pakula CLA 2020-01-08 13:41:45 EST
I think this also resolve: bug 173405
Comment 22 Nitin Dahyabhai CLA 2020-01-09 09:22:41 EST
Amended with one more commit to restore and incorporate a protected method we'll have to keep.

Thanks for the push on this one, Dawid.
Comment 23 Dawid Pakula CLA 2020-01-09 09:46:28 EST
I also created bug 558947 on Platform. After resolve we will be able to drop DefaultTextTransferDropTargetAdapterProxy