- Timestamp:
- 2016-08-23T22:54:08+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r10634 r10881 24 24 import org.openstreetmap.josm.Main; 25 25 import org.openstreetmap.josm.data.Version; 26 import org.openstreetmap.josm.gui.datatransfer. FileTransferHandler;26 import org.openstreetmap.josm.gui.datatransfer.OpenTransferHandler; 27 27 import org.openstreetmap.josm.gui.preferences.server.ProxyPreference; 28 28 import org.openstreetmap.josm.gui.preferences.server.ProxyPreferenceListener; … … 133 133 getMOTD(); 134 134 135 setTransferHandler(new FileTransferHandler());135 setTransferHandler(new OpenTransferHandler()); 136 136 } 137 137 -
trunk/src/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandler.java
r10766 r10881 9 9 import java.util.Collection; 10 10 11 import javax.swing.TransferHandler;12 13 11 import org.openstreetmap.josm.Main; 14 12 import org.openstreetmap.josm.data.coor.EastNorth; … … 16 14 import org.openstreetmap.josm.gui.datatransfer.importers.AbstractOsmDataPaster; 17 15 import org.openstreetmap.josm.gui.datatransfer.importers.FilePaster; 16 import org.openstreetmap.josm.gui.datatransfer.importers.OsmLinkPaster; 18 17 import org.openstreetmap.josm.gui.datatransfer.importers.PrimitiveDataPaster; 19 18 import org.openstreetmap.josm.gui.datatransfer.importers.PrimitiveTagTransferPaster; … … 27 26 * @since 10604 28 27 */ 29 public class OsmTransferHandler extends TransferHandler {28 public class OsmTransferHandler extends AbstractStackTransferHandler { 30 29 31 30 private static final Collection<AbstractOsmDataPaster> SUPPORTED = Arrays.asList( 32 31 new FilePaster(), new PrimitiveDataPaster(), 33 32 new PrimitiveTagTransferPaster(), 34 new TagTransferPaster(), new TextTagPaster());33 new TagTransferPaster(), new OsmLinkPaster(), new TextTagPaster()); 35 34 36 35 @Override 37 public boolean canImport(TransferSupport support) { 38 // import everything for now, only support copy. 39 for (AbstractOsmDataPaster df : SUPPORTED) { 40 if (df.supports(support)) { 41 return true; 42 } 43 } 44 return false; 45 } 46 47 @Override 48 public boolean importData(TransferSupport support) { 49 return importData(support, Main.getLayerManager().getEditLayer(), null); 50 } 51 52 private boolean importData(TransferSupport support, OsmDataLayer layer, EastNorth center) { 53 for (AbstractOsmDataPaster df : SUPPORTED) { 54 if (df.supports(support)) { 55 try { 56 if (df.importData(support, layer, center)) { 57 return true; 58 } 59 } catch (UnsupportedFlavorException | IOException e) { 60 Main.warn(e); 61 } 62 } 63 } 64 return super.importData(support); 36 protected Collection<AbstractOsmDataPaster> getSupportedPasters() { 37 return SUPPORTED; 65 38 } 66 39 -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractOsmDataPaster.java
r10604 r10881 57 57 * Attempts to import the given transfer data. 58 58 * @param support The transfer support to import from. 59 * @param layer The layer to paste at. 59 * @param layer The layer to paste at. May be null. 60 60 * @param pasteAt The position to paste at. 61 61 * @return <code>true</code> if the import was successful.
Note:
See TracChangeset
for help on using the changeset viewer.