Changeset 8510 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
- Timestamp:
- 2015-06-20T23:42:21+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r8509 r8510 199 199 private final HighlightHelper helper = new HighlightHelper(); 200 200 private boolean highlightEnabled = Main.pref.getBoolean("draw.target-highlight", true); 201 201 202 public MouseEventHandler() { 202 203 super(popupMenu); … … 295 296 putValue(NAME, tr("Search")); 296 297 putValue(SHORT_DESCRIPTION, tr("Search for objects")); 297 putValue(SMALL_ICON, ImageProvider.get("dialogs", "search"));298 putValue(SMALL_ICON, ImageProvider.get("dialogs", "search")); 298 299 updateEnabledState(); 299 300 } … … 330 331 public void actionPerformed(ActionEvent e) { 331 332 Collection<OsmPrimitive> sel = model.getSelected(); 332 if (sel.isEmpty()) return;333 if (sel.isEmpty()) return; 333 334 OsmDataLayer editLayer = Main.main.getEditLayer(); 334 335 if (editLayer == null) return; … … 395 396 396 397 public ZoomToJOSMSelectionAction() { 397 putValue(NAME, tr("Zoom to selection"));398 putValue(NAME, tr("Zoom to selection")); 398 399 putValue(SHORT_DESCRIPTION, tr("Zoom to selection")); 399 400 putValue(SMALL_ICON, ImageProvider.get("dialogs/autoscale", "selection")); … … 515 516 */ 516 517 public void remember(Collection<? extends OsmPrimitive> selection) { 517 if (selection == null) return;518 if (selection.isEmpty()) return;518 if (selection == null) return; 519 if (selection.isEmpty()) return; 519 520 if (history == null) return; 520 521 if (history.isEmpty()) { … … 524 525 if (history.getFirst().equals(selection)) return; 525 526 history.addFirst(selection); 526 for (int i = 1; i < history.size(); ++i) {527 if (history.get(i).equals(selection)) {527 for (int i = 1; i < history.size(); ++i) { 528 if (history.get(i).equals(selection)) { 528 529 history.remove(i); 529 530 break; … … 563 564 public synchronized Collection<OsmPrimitive> getSelected() { 564 565 Set<OsmPrimitive> sel = new HashSet<>(); 565 for (int i=0; i< getSize();i++) {566 for (int i = 0; i < getSize(); i++) { 566 567 if (selectionModel.isSelectedIndex(i)) { 567 568 sel.add(selection.get(i)); … … 579 580 selectionModel.clearSelection(); 580 581 if (sel == null) return; 581 for (OsmPrimitive p: sel) {582 for (OsmPrimitive p: sel) { 582 583 int i = selection.indexOf(p); 583 if (i >= 0) {584 if (i >= 0) { 584 585 selectionModel.addSelectionInterval(i, i); 585 586 } … … 643 644 if (toUpdate.isEmpty()) return; 644 645 Collection<OsmPrimitive> sel = getSelected(); 645 for (OsmPrimitive p: toUpdate) {646 for (OsmPrimitive p: toUpdate) { 646 647 int i = selection.indexOf(p); 647 648 if (i >= 0) { 648 super.fireContentsChanged(this, i, i);649 super.fireContentsChanged(this, i, i); 649 650 } 650 651 } … … 816 817 if (ways + nodes + relations == 0) { 817 818 text.append(tr("Unselectable now")); 818 this.sel =new ArrayList<>(); // empty selection819 this.sel = new ArrayList<>(); // empty selection 819 820 } 820 821 DefaultNameFormatter df = DefaultNameFormatter.getInstance(); 821 822 if (ways + nodes + relations == 1) { 822 823 text.append(": "); 823 for (OsmPrimitive o : sel) {824 for (OsmPrimitive o : sel) { 824 825 text.append(o.getDisplayName(df)); 825 826 }
Note:
See TracChangeset
for help on using the changeset viewer.