Changeset 14500 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2018-12-03T01:53:41+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/datatransfer/ClipboardUtils.java
r13647 r14500 166 166 } 167 167 } 168 169 /** 170 * Clears the system clipboard. 171 * @return True if the clear was successful 172 * @since 14500 173 */ 174 public static boolean clear() { 175 // Cannot simply set clipboard contents to null, see https://stackoverflow.com/a/18254949/2257172 176 return copy(new StringSelection("")); 177 } 168 178 } -
trunk/src/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandler.java
r12642 r14500 24 24 25 25 /** 26 * This transfer han lder provides the ability to transfer OSM data. It allows you to receive files, primitives or tags.26 * This transfer handler provides the ability to transfer OSM data. It allows you to receive files, primitives or tags. 27 27 * @author Michael Zangl 28 28 * @since 10604 -
trunk/src/org/openstreetmap/josm/gui/datatransfer/PrimitiveTransferable.java
r13206 r14500 30 30 TagTransferData.FLAVOR, DataFlavor.stringFlavor); 31 31 private final PrimitiveTransferData primitives; 32 private OsmDataLayer sourceLayer;32 private final OsmDataLayer sourceLayer; 33 33 34 34 /** -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r14456 r14500 14 14 import java.awt.Rectangle; 15 15 import java.awt.TexturePaint; 16 import java.awt.datatransfer.Transferable; 17 import java.awt.datatransfer.UnsupportedFlavorException; 16 18 import java.awt.event.ActionEvent; 17 19 import java.awt.geom.Area; … … 20 22 import java.awt.image.BufferedImage; 21 23 import java.io.File; 24 import java.io.IOException; 22 25 import java.util.ArrayList; 23 26 import java.util.Arrays; … … 95 98 import org.openstreetmap.josm.gui.MapView; 96 99 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint; 100 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 101 import org.openstreetmap.josm.gui.datatransfer.data.OsmLayerTransferData; 97 102 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 98 103 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; … … 1054 1059 data.removeSelectionListener(this); 1055 1060 data.removeHighlightUpdateListener(this); 1061 removeClipboardDataFor(this); 1062 } 1063 1064 protected static void removeClipboardDataFor(OsmDataLayer osm) { 1065 Transferable clipboardContents = ClipboardUtils.getClipboardContent(); 1066 if (clipboardContents != null) { 1067 try { 1068 Object o = clipboardContents.getTransferData(OsmLayerTransferData.OSM_FLAVOR); 1069 if (o instanceof OsmLayerTransferData && osm.equals(((OsmLayerTransferData) o).getLayer())) { 1070 ClipboardUtils.clear(); 1071 } 1072 } catch (UnsupportedFlavorException | IOException e) { 1073 Logging.error(e); 1074 } 1075 } 1056 1076 } 1057 1077
Note:
See TracChangeset
for help on using the changeset viewer.