Cannot drag items into an Eclipse editor

I'm using standalone Zotero for Linux. I recently discovered the excellent feature of dragging items to an outside text editor. For many simple editors (gedit, Chrome browser) this works fine.

But Eclipse editors do not accept the dragged content. Since they do accept plain text dragged from elsewhere, I assume the items dragged from Zotero have an unusual mime-type. Is this the case?

Anyway, I'd love to see a fix — or a way for me to fix it myself.

Thanks!

Some extra information: When I use Edit → Copy Bibliography, I am able to paste the content into Eclipse. (This surprised me somewhat, because as I recall, drag/dropping and copy/pasting often share the same API.) The Edit → Copy Citation entry doesn't seem to do anything for me.
  • Can you drag-drop text from a text editor into Eclipse?
  • Yes, certainly.
  • Which eclipse product are we talking about exactly?
  • edited September 14, 2013
    I'm talking about the standard text-editor provided by the Eclipse SDK (version 3.7.1). I write LaTeX in Eclipse using the TeXlipse plugin, but any other text-editor inside Eclipse (.txt, java, whatever) has the same issue. At least for me.
  • Looks to be an Eclipse issue. I cannot drag-drop text from Firefox or LibreOffice into Eclipse either.
  • edited September 14, 2013
    Hm... Do you happen to know how Zotero packages the content when it is dragged?

    I'm guessing that Eclipse only accepts content with a plain-text MIME type. Content dragged from Firefox or Libreoffice may not be accepted simply because it contains a formatted / rich text MIME type without a fallback to text/plain.

    But I could be completely off the mark. I've worked with various drag/drop API's (e.g., Qt, Android) but, truth be told, I don't know what protocol is used between applications in an Xorg environment.
  • edited September 14, 2013
    Looks to be 'text/html' (if you have the "Copy HTML" preference selected in Zotero -> Preferences -> Export) _and_ 'text/plain'. Changing the "Copy HTML" preference doesn't seem to make any difference for Eclipse.

    https://github.com/zotero/zotero/blob/master/chrome/content/zotero/xpcom/itemTreeView.js#L2514

    There are a few X Window DnD protocols listed here (XDND being the focus of the site) http://www.newplanetsoftware.com/xdnd/other_protocols.html I'm not sure which one(s) is used by XULRunner/Firefox or Eclipse.
  • Zotero includes plain text in the copy as "text/unicode", which is Firefox's internal "flavor" for copied text. It's up to Firefox/XULRunner to put that on the clipboard as proper Unicode text, and for other programs to read it. I can't tell you which one is responsible here, though the fact that dragging from LibreOffice doesn't work either sort of suggests that the problem is with Eclipse. It's possible the Eclipse isn't properly handling the presence of multiple data types. If you're inclined to experiment, you can run a Git installation of Zotero and modify fileInterface.js::copyItemsToClipboard() to include only the plain text.
  • Changing the "Copy HTML" preference doesn't seem to make any difference for Eclipse.
    That pref just puts the HTML markup into the text flavor in addition to putting it into the HTML flavor, so that plain-text editors get the HTML code instead of the plain text. So it doesn't affect which data types are transferred.
  • When I use Edit → Copy Bibliography, I am able to paste the content into Eclipse. (This surprised me somewhat, because as I recall, drag/dropping and copy/pasting often share the same API.)
    Oh, sorry, missed this. Yeah, there are actually two interfaces here—I was thinking of the clipboard one, but as aurimas points out, the drag and drop one does specify "text/plain" as per the Mozilla HTML 5 drag and drop instructions. If someone has a Git installation and Eclipse handy, they can check whether changing that to "text/unicode" makes a difference, though that would seem to indicate a bug in Mozilla's HTML 5 drag and drop code, since I imagine "text/plain" is correct for that.
  • edited September 15, 2013
    Hi Dan, thanks for your insights.
    If someone has a Git installation and Eclipse handy, they can check whether changing that to "text/unicode" makes a difference, though that would seem to indicate a bug in Mozilla's HTML 5 drag and drop code, since I imagine "text/plain" is correct for that.
    I'd be appreciative if someone could test this. It would take some time for me to set it up — time I don't have right now, unfortunately.

    I will point out, though, that a positive result would seem to contradict the established facts that Firefox uses the text/unicode flavor, and that text dragged from Firefox is not accepted. By the way, text dragged from Chrome is accepted (with formatting discarded at drop-time, not at drag-time).

    Does anyone know of some (Xorg) tool that accepts all clipboard-content and all drop-events and will show us the exact content of the data-package? That would make all of this a lot easier. I tried xev, but it doesn't seem to have that feature.
  • I will point out, though, that a positive result would seem to contradict the established facts that Firefox uses the text/unicode flavor, and that text dragged from Firefox is not accepted.
    I'm not sure what you mean by this.
  • Yeah, sorry. I think I made the same mistake you did. ;-) You said that text/unicode was what Firefox used for copied text, and I misinterpreted this as dragged text.

    What I meant was that if we already knew that drags from Firefox are not accepted, and that dragged text from Firefox was of type text/unicode, then trying to get Zotero to do the same thing would seem a bit futile.

    But we don't know that. So please ignore that comment.
  • OK, well, in any case, I tested this, and neither specifying "text/unicode" for HTML 5 drag and drop (which wouldn't be correct anyway) nor including just a single "text/plain" or "text/unicode" in the drag make a difference. Eclipse still doesn't accept the text, whereas gedit, LibreOffice, and Terminal do. I also can't drag text from gedit or LibreOffice to Eclipse, but I can drag from gedit to LibreOffice or Terminal. So I'm inclined to say that this is an Eclipse bug. For what it's worth, jEdit behaves the same. (Actually, dragging text to jEdit makes its dock icon dance for a while, but nothing else happens.)
  • I'm inclined to agree.

    Still strange, since dragging from gedit to Eclipse works fine for me.

    And interestingly, dragging from LibreOffice to Eclipse doesn't work, but in a different way. With Zotero I simply get no reaction at all. With LibreOffice the Eclipse text-cursor follows the mouse (as if it might work) but the mouse pointer becomes a 'forbidden' icon.

    Anyway, thanks for your effort! In the future I might explore the Eclipse side, but for now I'll be content with Ctrl-Shift-C.
Sign In or Register to comment.