Changeset 5354 in josm for trunk/src/org
- Timestamp:
- 2012-07-20T18:14:54+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java
r5211 r5354 181 181 dialog.configureContextsensitiveHelp("/Action/DownloadObject", true /* show help button */); 182 182 cbType.setSelectedIndex(Main.pref.getInteger("downloadprimitive.lasttype", 0)); 183 tfId.setType(cbType.getType()); 184 if (Main.pref.getBoolean("downloadprimitive.autopaste", true)) { 185 tryToPasteFromClipboard(tfId, cbType); 186 } 187 183 188 dialog.showDialog(); 184 189 if (dialog.getValue() != 1) return; … … 310 315 .setContent(p, false); 311 316 } 317 318 private void tryToPasteFromClipboard(OsmIdTextField tfId, OsmPrimitiveTypesComboBox cbType) { 319 String buf = Utils.getClipboardContent(); 320 if (buf.contains("node")) cbType.setSelectedIndex(0); 321 if (buf.contains("way")) cbType.setSelectedIndex(1); 322 if (buf.contains("relation")) cbType.setSelectedIndex(2); 323 String[] res = buf.split("/"); 324 String txt; 325 if (res.length>0) { 326 txt = res[res.length-1]; 327 if (txt.isEmpty() && txt.length()>1) txt=res[res.length-2]; 328 } else { 329 txt=buf; 330 } 331 tfId.setText(txt); 332 tfId.clearTextIfInvalid(); 333 } 312 334 } -
trunk/src/org/openstreetmap/josm/gui/widgets/OsmIdTextField.java
r5266 r5354 14 14 import org.openstreetmap.josm.data.osm.PrimitiveId; 15 15 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 16 import org.openstreetmap.josm.tools.Utils; 16 17 17 18 /** … … 43 44 44 45 public void performValidation() { 46 validator.validate(); 47 } 48 49 public void clearTextIfInvalid() { 50 if (!validator.isValid()) 51 setText(""); 45 52 validator.validate(); 46 53 }
Note:
See TracChangeset
for help on using the changeset viewer.