Changeset 2894 in josm


Ignore:
Timestamp:
2010-01-25T23:05:57+01:00 (14 years ago)
Author:
bastiK
Message:

make selected relation visible (jump to it) for:
properties dialog -> rightclick on a relation in the lower half -> 'select in relation list'

File:
1 edited

Legend:

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

    r2885 r2894  
    221221        } else {
    222222            model.setSelectedRelations(Collections.singletonList(relation));
     223            Integer i = model.getRelationIndex(relation);
     224            if (i == null)
     225                throw new AssertionError(); /* the relation list should contain *all* relations */
     226            displaylist.scrollRectToVisible(displaylist.getCellBounds(i, i));
    223227        }
    224228    }
     
    685689            }
    686690        }
     691
     692        /**
     693         * Returns the index of the relation
     694         *
     695         * @return index of relation (null if it cannot be found)
     696         */
     697        public Integer getRelationIndex(Relation rel) {
     698            int i = relations.indexOf(rel);
     699            if (i<0) {
     700                return null;
     701            }
     702            return i;
     703        }
     704           
    687705    }
    688706
Note: See TracChangeset for help on using the changeset viewer.