I'm writing a Java application and I want to integrate a feature to somewhat modify bookmark data from Mozilla. This sounds very complicated, but it's only a drag and drop issue:
1) I can't really drop more than one bookmark entry from Mozilla library to my Java application, because there are no DataFlavors available. Thus, obviously, I cannot read the raw data from the Transferable I get... Single entries come with 78 DataFlavors. Is there any way to enable multiple bookmark dropping?
I can circumvent this issue by exporting all bookmarks to HTML and importing it from inside my app, but it's not very pleasant.
2) It's also quite hard to figure out how to export any URL to Mozilla bookmarks. For instance, the best behaviour would be that Mozilla recognizes my data the same way it does with hyperlinks. Dropping a link, e.g. Google, from inside the browser into the bookmark library immediately creates an entry with name "Google" and URL "http://www.google.com". My application though is forced to return an implementation of java.io.Reader because Mozilla Firefox library apparently doesn't accept anything else.
TL;DR: Is there any way (via drag and drop) so I can 1) import multiple bookmarks from Mozilla to Java App and 2) export any kind of Transferable data to Mozilla bookmarks library so both name and URL are directly recognized by Firefox?
I hope my question is clear.
Regards and thanks in advance!
As of January 2013, on current versions of Java (7u10) / Firefox (17.0.1) for Windows 7, there doesn't seem a way to do what I want to.
Dragging multiple bookmarks into a Java Application comes without any DataFlavors, so reading from them is impossible.
Dropping a bookmark into Firefox seems impossible too - specifying only text/x-moz-url
will make Firefox "accept" the data, but Firefox never attempts to read from it (the methods are never called). Specifying more than only text/x-moz-url
(e.g. text/x-moz-url; class=java.io.Reader
) leads to Firefox not accepting the Data at all.
Unless someone can provide a stable solution, this question is technically answered:
It's not possible.