Changeset 2504 in josm for trunk


Ignore:
Timestamp:
2009-11-22T18:26:54+01:00 (12 years ago)
Author:
Gubaer
Message:

see #4009 : further update as proposed by jttt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r2503 r2504  
    511511     */
    512512    private static  class RelationListModel extends AbstractListModel {
    513         /** the list of relations managaged by this model. Should never be null */
    514         private ArrayList<Relation> relations;
     513        private final ArrayList<Relation> relations = new ArrayList<Relation>();
    515514        private DefaultListSelectionModel selectionModel;
    516515
    517516        public RelationListModel(DefaultListSelectionModel selectionModel) {
    518517            this.selectionModel = selectionModel;
    519             relations = new ArrayList<Relation>();
    520518        }
    521519
     
    526524        public synchronized void setRelations(Collection<Relation> relations) {
    527525            List<Relation> sel =  getSelectedRelations();
    528             if (relations == null) {
    529                 this.relations.clear();
    530             } else {
    531                 this.relations = new ArrayList<Relation>(relations.size());
    532                 for (Relation r: relations) {
    533                     if (! r.isDeleted() && r.isVisible() && !r.incomplete) {
    534                         this.relations.add(r);
    535                     }
     526            this.relations.clear();
     527            for (Relation r: relations) {
     528                if (! r.isDeleted() && r.isVisible() && !r.incomplete) {
     529                    this.relations.add(r);
    536530                }
    537531            }
     
    564558            if (addedPrimitives == null || addedPrimitives.isEmpty()) return;
    565559            boolean added = false;
    566             if (relations == null) {
    567                 relations = new ArrayList<Relation>();
    568             }
    569560            for (OsmPrimitive p: addedPrimitives) {
    570561                if (! (p instanceof Relation)) {
Note: See TracChangeset for help on using the changeset viewer.