Changeset 27964 in osm for applications/editors/josm
- Timestamp:
- 2012-03-01T19:49:28+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/licensechange
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/licensechange/src/org/openstreetmap/josm/plugins/licensechange/LicenseChangeDialog.java
r27852 r27964 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 6 7 import java.awt.BorderLayout;8 import java.awt.GridLayout;9 7 import java.awt.event.ActionEvent; 10 8 import java.awt.event.ActionListener; … … 12 10 import java.awt.event.MouseAdapter; 13 11 import java.awt.event.MouseEvent; 14 import java.io.IOException;15 import java.lang.reflect.InvocationTargetException;16 12 import java.util.Arrays; 17 import java.util.ArrayList;18 13 import java.util.Collection; 19 14 import java.util.Enumeration; 20 15 import java.util.HashSet; 21 import java.util.LinkedList;22 16 import java.util.List; 23 import java.util.Set; 24 17 18 import javax.swing.AbstractAction; 25 19 import javax.swing.JMenuItem; 26 import javax.swing.JOptionPane;27 20 import javax.swing.JPopupMenu; 28 21 import javax.swing.JScrollPane; 29 import javax.swing.SwingUtilities;30 22 import javax.swing.event.TreeSelectionEvent; 31 23 import javax.swing.event.TreeSelectionListener; … … 35 27 import org.openstreetmap.josm.Main; 36 28 import org.openstreetmap.josm.actions.AutoScaleAction; 37 import org.openstreetmap.josm.command.Command;38 29 import org.openstreetmap.josm.data.osm.DataSet; 39 30 import org.openstreetmap.josm.data.osm.Node; … … 41 32 import org.openstreetmap.josm.data.osm.WaySegment; 42 33 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 43 import org.openstreetmap.josm.gui.PleaseWaitRunnable;44 34 import org.openstreetmap.josm.gui.SideButton; 45 35 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 46 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 47 import org.openstreetmap.josm.io.OsmTransferException; 36 import org.openstreetmap.josm.tools.ImageProvider; 48 37 import org.openstreetmap.josm.tools.Shortcut; 49 import org.xml.sax.SAXException;50 38 51 39 /** … … 54 42 * the list while single click will make the clicked entry the only selection. 55 43 */ 56 public class LicenseChangeDialog extends ToggleDialog implements ActionListener{44 public class LicenseChangeDialog extends ToggleDialog { 57 45 private LicenseChangePlugin plugin; 58 46 … … 72 60 * Constructor 73 61 */ 74 public LicenseChangeDialog(LicenseChangePlugin plugin) 62 public LicenseChangeDialog(LicenseChangePlugin plugin) 75 63 { 76 64 super(tr("Relicensing problems"), "licensechange", tr("Open the relicensing window."), … … 83 71 JMenuItem zoomTo = new JMenuItem(tr("Zoom to problem")); 84 72 zoomTo.addActionListener(new ActionListener() { 85 public void actionPerformed(ActionEvent e) { 73 @Override 74 public void actionPerformed(ActionEvent e) { 86 75 zoomToProblem(); 87 76 } … … 93 82 tree.addTreeSelectionListener(new SelectionWatch()); 94 83 95 selectButton = new SideButton(marktr("Select"), "select", "LicenseChange", 96 tr("Set the selected elements on the map to the selected items in the list above."), this); 84 selectButton = new SideButton(new AbstractAction() { 85 { 86 putValue(NAME, marktr("Select")); 87 putValue(SHORT_DESCRIPTION, tr("Set the selected elements on the map to the selected items in the list above.")); 88 putValue(SMALL_ICON, ImageProvider.get("dialogs", "select")); 89 putValue("help", "Dialog/LicenseChange/select"); 90 } 91 @Override 92 public void actionPerformed(ActionEvent e) { 93 setSelectedItems(); 94 } 95 }); 97 96 selectButton.setEnabled(false); 98 97 … … 103 102 104 103 @Override 105 public void showNotify() 104 public void showNotify() 106 105 { 107 106 DataSet ds = Main.main.getCurrentDataSet(); … … 112 111 113 112 @Override 114 public void setVisible(boolean v) 113 public void setVisible(boolean v) 115 114 { 116 115 if (tree != null) … … 121 120 122 121 @SuppressWarnings("unchecked") 123 private void showPopupMenu(MouseEvent e) 122 private void showPopupMenu(MouseEvent e) 124 123 { 125 124 if (!e.isPopupTrigger()) … … 136 135 } 137 136 138 private void zoomToProblem() 137 private void zoomToProblem() 139 138 { 140 139 if (popupMenuError == null) … … 152 151 */ 153 152 @SuppressWarnings("unchecked") 154 private void setSelectedItems() 153 private void setSelectedItems() 155 154 { 156 155 if (tree == null) … … 179 178 } 180 179 181 public void actionPerformed(ActionEvent e)182 {183 String actionCommand = e.getActionCommand();184 if (actionCommand.equals("Select"))185 setSelectedItems();186 }187 188 180 /** 189 181 * @param sel … … 230 222 * Watches for clicks. 231 223 */ 232 public class ClickWatch extends MouseAdapter 224 public class ClickWatch extends MouseAdapter 233 225 { 234 226 @Override … … 264 256 * Watches for tree selection. 265 257 */ 266 public class SelectionWatch implements TreeSelectionListener 267 { 268 public void valueChanged(TreeSelectionEvent e) { 258 public class SelectionWatch implements TreeSelectionListener 259 { 260 @Override 261 public void valueChanged(TreeSelectionEvent e) { 269 262 selectButton.setEnabled(false); 270 263 … … 279 272 } 280 273 281 public static class LicenseChangeBoundingXYVisitor extends BoundingXYVisitor implements LicenseChangeVisitor 282 { 283 public void visit(OsmPrimitive p) { 274 public static class LicenseChangeBoundingXYVisitor extends BoundingXYVisitor implements LicenseChangeVisitor 275 { 276 @Override 277 public void visit(OsmPrimitive p) { 284 278 if (p.isUsable()) { 285 279 p.visit(this); … … 294 288 } 295 289 296 public void visit(List<Node> nodes) { 290 @Override 291 public void visit(List<Node> nodes) { 297 292 for (Node n: nodes) { 298 293 visit(n); … … 301 296 } 302 297 303 public void updateSelection(Collection<? extends OsmPrimitive> newSelection) 298 public void updateSelection(Collection<? extends OsmPrimitive> newSelection) 304 299 { 305 300 if (newSelection.isEmpty())
Note:
See TracChangeset
for help on using the changeset viewer.