source: osm/applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/SelectIncompleteAddressesAction.java@ 24091

Last change on this file since 24091 was 24091, checked in by oliverw, 14 years ago

AddressNode -> OSMAddress

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Author Id Date Revision
  • Property svn:mime-type set to text/plain
File size: 1.9 KB
Line 
1/*
2 * This program is free software: you can redistribute it and/or modify it under
3 * the terms of the GNU General Public License as published by the
4 * Free Software Foundation, either version 3 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 * See the GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License along with this program.
12 * If not, see <http://www.gnu.org/licenses/>.
13 */
14package org.openstreetmap.josm.plugins.fixAddresses;
15
16import static org.openstreetmap.josm.tools.I18n.tr;
17
18import java.awt.event.ActionEvent;
19import java.util.ArrayList;
20import java.util.List;
21
22import org.openstreetmap.josm.actions.JosmAction;
23import org.openstreetmap.josm.data.osm.OsmPrimitive;
24
25@SuppressWarnings("serial")
26public class SelectIncompleteAddressesAction extends JosmAction {
27
28
29 private AddressEditContainer addressEditContainer;
30
31 public SelectIncompleteAddressesAction() {
32 super(tr("Select incomplete addresses"), "select_invaddr_24",
33 tr("Selects all addresses with incomplete data."), null, false);
34 }
35
36 @Override
37 public void actionPerformed(ActionEvent arg0) {
38 addressEditContainer = new AddressEditContainer();
39 addressEditContainer.invalidate();
40
41 if (addressEditContainer.getIncompleteAddresses() != null) {
42 List<OsmPrimitive> osms = new ArrayList<OsmPrimitive>();
43
44 for (OSMAddress aNode : addressEditContainer.getIncompleteAddresses()) {
45 osms.add(aNode.getOsmObject());
46 }
47 getCurrentDataSet().setSelected(osms);
48 }
49 }
50
51 /* (non-Javadoc)
52 * @see org.openstreetmap.josm.actions.JosmAction#updateEnabledState()
53 */
54 @Override
55 protected void updateEnabledState() {
56 setEnabled(getCurrentDataSet() != null);
57 }
58}
Note: See TracBrowser for help on using the repository browser.