Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8042099

Drag and Drop of Files from GVFS locations (smb, ftp, etc) does not work

    Details

      Description

      A DESCRIPTION OF THE REQUEST :
      If you open an smb share with Nautilus and then try to drag files into your Java Swing application does not work because Java will not translate the GVFS URIs into paths for the file system abstraction in ~./gvfs that is provided for legacy applications.

      JUSTIFICATION :
      Drag and Drop of files from the network location (even if dragged from the file system abstraction in ~/.gvfs) is completely ignored as the uriList data will not countain file URIs but smb/ftp/etc URIs which are simply ignored rather than translated to the corresponding file paths that any Java application can understand.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When files from a networked location are dropped (uriListFlavour) the javaFileList flavour should, if possible, translate those smb/ftp/etc URIs to corresponding filepaths in ~/.gvfs
      ACTUAL -
      smb/ftp/etc URIs are simply ignored and drag-n-drop of files from these folders is impossible.

      CUSTOMER SUBMITTED WORKAROUND :
      libgio-2.0 provides a the function g_vfs_get_file_for_uri(gvfs, uri) that can translate GVFS URIs (from the drop data) into the corresponding ~/.gvfs filepaths that can be used in the Java application.

      I have solved this problem in my application this way using JNA to access libgio:

      JNA bindings for libgio-2.0:
      https://sourceforge.net/p/filebot/code/1330/tree/trunk/source/net/sourceforge/filebot/gio/GIOLibrary.java#l9
      https://sourceforge.net/p/filebot/code/1330/tree/trunk/source/net/sourceforge/filebot/gio/GVFS.java#l25

      Processing uriListFlavour and translate GVFS URIs to File objects:
      https://sourceforge.net/p/filebot/code/1330/tree/trunk/source/net/sourceforge/filebot/ui/transfer/FileTransferable.java#l100

        Attachments

          Activity

            People

            • Assignee:
              alexp Alexander Potochkin (Inactive)
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: