Closed davevint closed 3 years ago
I've investigated this now.
It depends on the OS and how Eclipse creates DnD Transfer
types.
On Windows, when dropping an image from an embedded or external browser onto Archi a FileTranfer
protocol is used by Eclipse. The image's file path is a string and set to the image's path in Windows' local file webcache and added to the FileTranfer
instance. Therefore we can add the image to the Canvas because it exists as file.
On Linux, a FileTransfer
protocol is also created when dropping an image from the embedded browser but the image file path is null
. That's why it doesn't work.
There is also a URLTransfer
transfer protocol that contains a URL path as a string. This can be used for dragging an image from a browser. One can then manually download the image from the URL, create a temporary file then add that to the Canvas. This can be used on Mac in the embedded and external browser but not the embedded browser on Linux because that does not use the URLTransfer
protocol.
So adding URLTransfer
doesn't solve the OP because the transfer type is FileTransfer
which returns a null file path on Linux.
@jbsarrodie I spent some more time on this and there's a new branch dnd-canvas
.
I implemented URLTransfer
but this doesn't solve the issue of dragging an image from an online URL from the embedded browser on Linux. This is because Linux is using FileTransfer
and returning null for the path.
But implementing support for URLTransfer
does add these features:
I don't think the OP is fixable for Linux so suggest waiting for this implementation and using an external browser on Linux and drag the image onto the Canvas from that. Or, for now, use an external browser, drag the image to desktop and from there to the Canvas.
I've done what I can to support DnD from a browser and committed to master
. As I said, DnD from an online image URL in the embedded browser on Linux can't be fixed because of the way it's implemented in Eclipse. Suggest to use external browser.
Any objections to closing this now?
@Phillipus thanks for doing this. Since raising the call, I have noticed that Firefox and Chrome behave differently with DnD to the desktop - (external) Firefox drags a link, (external) Chrome drags a file. On my system, dragging from embedded browser to the desktop always drags a link. I think you've done as much as you can however, so happy to close.
Once again, thanks.
Log file was empty
Version of Archi
4.8.0
Archi Plug-ins
jArchi 1.0.0 coArchi 0.6.2 lightbox/vista 1.0.0
Operating System
Ubuntu 18.04.5 LTS
Expected Behaviour
Drag and drop of image from PlantUML server displayed in embedded browser, into Canvas, should create a new image object on the Canvas. This is the actual behaviour on a Windows 10 machine using the same versions of Archi and plugins
Actual Behaviour
Drag and drop of image from PlantUML server displayed in embedded browser, into Canvas, silently fails with no image object created, not error message displayed and no error added to the log. Drag and drop of an image from an HTML Preview report works as expected, although this HTML Preview is referencing the dragged image from a local file rather than an http URL. "Inspect Source" of the 2 different images shows:
From HTML preview (works):
<img class="diagram" src="../images/0784c9ef-1928-4b1d-a489-128fdb014912.png" alt="05 ABB: Interface Profiles" usemap="#0784c9ef-1928-4b1d-a489-128fdb014912map">
From local install of PlantUML server (does not work):
<img src="http://dev-cspence:8080/plantuml/png/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000" alt="PlantUML diagram">
Steps to Reproduce the Behaviour (on Ubuntu 18.04 machine - works on Windows 10)
Browser.open(“https://www.planttext.com/”, “PlantUML”)