001 // License: GPL. For details, see LICENSE file. 002 package org.openstreetmap.josm.gui.widgets; 003 004 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 005 006 /** 007 * A Combo box containing OSM primitive types (Node, Way, Relation). 008 * @author Matthias Julius 009 * @see OsmPrimitiveType#dataValues 010 * @since 2923 011 */ 012 public class OsmPrimitiveTypesComboBox extends JosmComboBox { 013 014 /** 015 * Constructs a new {@code OsmPrimitiveTypesComboBox}. 016 */ 017 public OsmPrimitiveTypesComboBox() { 018 super(OsmPrimitiveType.dataValues().toArray()); 019 } 020 021 /** 022 * Replies the currently selected {@code OsmPrimitiveType}. 023 * @return the currently selected {@code OsmPrimitiveType}. 024 */ 025 public OsmPrimitiveType getType() { 026 Object selectedItem = this.getSelectedItem(); 027 return selectedItem instanceof OsmPrimitiveType ? (OsmPrimitiveType) selectedItem : null; 028 } 029 }