Changeset 5984 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2013-06-02T00:07:54+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r5958 r5984 66 66 import org.openstreetmap.josm.gui.SideButton; 67 67 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 68 import org.openstreetmap.josm.gui.util.GuiHelper; 68 69 import org.openstreetmap.josm.gui.widgets.ListPopupMenu; 69 70 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; … … 128 129 } 129 130 131 /** 132 * Constructs a new {@code SelectionListDialog}. 133 */ 130 134 public SelectionListDialog() { 131 135 super(tr("Selection"), "selectionlist", tr("Open a selection list window."), … … 219 223 } 220 224 225 /** 226 * Replies the selected OSM primitives. 227 * @return The selected OSM primitives 228 */ 221 229 public Collection<OsmPrimitive> getSelectedPrimitives() { 222 230 return model.getSelected(); … … 484 492 485 493 /** 486 * Replies the collection of OSM primitives in the view487 * of this model488 *489 * @return complete content of the view490 */491 public Collection<OsmPrimitive> getAllElements() {492 return selection;493 }494 495 /**496 494 * Sets the OSM primitives to be selected in the view of this model 497 495 * … … 521 519 * @param selection the collection of currently selected OSM objects 522 520 */ 523 public void setJOSMSelection( Collection<? extends OsmPrimitive> selection) {521 public void setJOSMSelection(final Collection<? extends OsmPrimitive> selection) { 524 522 this.selection.clear(); 525 if (selection == null) { 526 fireContentsChanged(this, 0, getSize()); 527 return; 528 } 529 this.selection.addAll(selection); 530 sort(); 531 fireContentsChanged(this, 0, getSize()); 532 remember(selection); 533 double dist = -1; 534 SubclassFilteredCollection<OsmPrimitive, Way> ways = new SubclassFilteredCollection<OsmPrimitive, Way>(selection, OsmPrimitive.wayPredicate); 535 // Compute total length of selected way(s) until an arbitrary limit set to 250 ways 536 // in order to prevent performance issue if a large number of ways are selected (old behaviour kept in that case, see #8403) 537 int maxWays = Math.max(1, Main.pref.getInteger("selection.max-ways-for-statusline", 250)); 538 if (!ways.isEmpty() && ways.size() <= maxWays) { 539 dist = 0.0; 540 for (Way w : ways) { 541 dist += w.getLength(); 523 if (selection != null) { 524 this.selection.addAll(selection); 525 sort(); 526 } 527 GuiHelper.runInEDTAndWait(new Runnable() { 528 @Override public void run() { 529 fireContentsChanged(this, 0, getSize()); 530 if (selection != null) { 531 remember(selection); 532 double dist = -1; 533 SubclassFilteredCollection<OsmPrimitive, Way> ways = new SubclassFilteredCollection<OsmPrimitive, Way>(selection, OsmPrimitive.wayPredicate); 534 // Compute total length of selected way(s) until an arbitrary limit set to 250 ways 535 // in order to prevent performance issue if a large number of ways are selected (old behaviour kept in that case, see #8403) 536 int maxWays = Math.max(1, Main.pref.getInteger("selection.max-ways-for-statusline", 250)); 537 if (!ways.isEmpty() && ways.size() <= maxWays) { 538 dist = 0.0; 539 for (Way w : ways) { 540 dist += w.getLength(); 541 } 542 } 543 Main.map.statusLine.setDist(dist); 544 } 542 545 } 543 } 544 Main.map.statusLine.setDist(dist); 546 }); 545 547 } 546 548 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r5975 r5984 85 85 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 86 86 import org.openstreetmap.josm.gui.tagging.TaggingPreset.PresetType; 87 import org.openstreetmap.josm.gui.util.GuiHelper; 87 88 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 88 89 import org.openstreetmap.josm.tools.GBC; … … 683 684 if (newLayer == null) editHelper.saveTagsIfNeeded(); 684 685 // it is time to save history of tags 685 686 updateSelection(); 686 GuiHelper.runInEDT(new Runnable() { 687 @Override public void run() { 688 updateSelection(); 689 } 690 }); 687 691 } 688 692
Note:
See TracChangeset
for help on using the changeset viewer.