Changeset 18665 in josm for trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/FilePaster.java
- Timestamp:
- 2023-02-16T16:01:49+01:00 (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/FilePaster.java
r17556 r18665 4 4 import java.awt.datatransfer.DataFlavor; 5 5 import java.awt.datatransfer.UnsupportedFlavorException; 6 import java.io.Closeable; 6 7 import java.io.File; 7 8 import java.io.IOException; … … 15 16 import org.openstreetmap.josm.gui.io.importexport.Options; 16 17 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 18 import org.openstreetmap.josm.tools.Utils; 17 19 18 20 /** … … 32 34 public boolean importData(TransferSupport support, OsmDataLayer layer, EastNorth pasteAt) 33 35 throws UnsupportedFlavorException, IOException { 34 @SuppressWarnings("unchecked") 35 List<File> files = (List<File>) support.getTransferable().getTransferData(df); 36 OpenFileAction.OpenFileTask task = new OpenFileAction.OpenFileTask(files, null); 37 task.setOptions(Options.RECORD_HISTORY); 38 MainApplication.worker.submit(task); 39 return true; 36 final Object data = support.getTransferable().getTransferData(df); 37 if (data instanceof List) { 38 @SuppressWarnings("unchecked") 39 List<File> files = (List<File>) data; 40 OpenFileAction.OpenFileTask task = new OpenFileAction.OpenFileTask(files, null); 41 task.setOptions(Options.RECORD_HISTORY); 42 MainApplication.worker.submit(task); 43 return true; 44 } 45 // We should never hit this code -- Coverity thinks that it is possible for this to be called with a 46 // StringSelection transferable, which is not currently possible with our code. It *could* be done from 47 // a plugin though. 48 if (data instanceof Closeable) { 49 Utils.close((Closeable) data); 50 } 51 throw new UnsupportedFlavorException(df); 40 52 } 41 53 }
Note:
See TracChangeset
for help on using the changeset viewer.