Ignore:
Timestamp:
2012-08-18T21:10:08+02:00 (12 years ago)
Author:
Don-vip
Message:

fix OsmPrimitiveTypesComboBox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/OsmPrimitiveTypesComboBox.java

    r5450 r5453  
    55
    66/**
     7 * A Combo box containing OSM primitive types (Node, Way, Relation).
    78 * @author Matthias Julius
     9 * @see OsmPrimitiveType#dataValues
     10 * @since 2923
    811 */
    912public class OsmPrimitiveTypesComboBox extends JosmComboBox {
    1013
     14    /**
     15     * Constructs a new {@code OsmPrimitiveTypesComboBox}.
     16     */
    1117    public OsmPrimitiveTypesComboBox() {
    12         super(OsmPrimitiveType.dataValues());
     18        super(OsmPrimitiveType.dataValues().toArray());
    1319    }
    1420
     21    /**
     22     * Replies the currently selected {@code OsmPrimitiveType}.
     23     * @return the currently selected {@code OsmPrimitiveType}.
     24     */
    1525    public OsmPrimitiveType getType() {
    16         try {
    17             return (OsmPrimitiveType)this.getSelectedItem();
    18         } catch (Exception e) {
    19             return null;
    20         }
     26        Object selectedItem = this.getSelectedItem();
     27        return selectedItem instanceof OsmPrimitiveType ? (OsmPrimitiveType) selectedItem : null;
    2128    }
    2229}
Note: See TracChangeset for help on using the changeset viewer.