- Timestamp:
- 2009-11-22T18:01:56+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r2497 r2503 511 511 */ 512 512 private static class RelationListModel extends AbstractListModel { 513 /** the list of relations managaged by this model. Should never be null */ 513 514 private ArrayList<Relation> relations; 514 515 private DefaultListSelectionModel selectionModel; … … 516 517 public RelationListModel(DefaultListSelectionModel selectionModel) { 517 518 this.selectionModel = selectionModel; 519 relations = new ArrayList<Relation>(); 518 520 } 519 521 … … 525 527 List<Relation> sel = getSelectedRelations(); 526 528 if (relations == null) { 527 this.relations = null;529 this.relations.clear(); 528 530 } else { 529 531 this.relations = new ArrayList<Relation>(relations.size()); … … 540 542 541 543 public synchronized void sort() { 542 if (relations == null) return;543 544 Collections.sort( 544 545 relations, … … 563 564 if (addedPrimitives == null || addedPrimitives.isEmpty()) return; 564 565 boolean added = false; 566 if (relations == null) { 567 relations = new ArrayList<Relation>(); 568 } 565 569 for (OsmPrimitive p: addedPrimitives) { 566 570 if (! (p instanceof Relation)) { … … 611 615 612 616 public Object getElementAt(int index) { 613 if (relations == null) return null;614 617 return relations.get(index); 615 618 } 616 619 617 620 public int getSize() { 618 if (relations == null) return 0;619 621 return relations.size(); 620 622 } … … 628 630 public List<Relation> getSelectedNonNewRelations() { 629 631 ArrayList<Relation> ret = new ArrayList<Relation>(); 630 if (relations == null) return ret;631 632 for (int i=0; i<getSize();i++) { 632 633 if (!selectionModel.isSelectedIndex(i)) { … … 649 650 public List<Relation> getSelectedRelations() { 650 651 ArrayList<Relation> ret = new ArrayList<Relation>(); 651 if (relations == null) return ret;652 652 for (int i=0; i<getSize();i++) { 653 653 if (!selectionModel.isSelectedIndex(i)) {
Note:
See TracChangeset
for help on using the changeset viewer.