Changeset 34487 in osm
- Timestamp:
- 2018-08-18T02:25:36+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/addrinterpolation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/addrinterpolation/build.xml
r33692 r34487 4 4 <property name="commit.message" value="Impoved Icon"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 2726"/>6 <property name="plugin.main.version" value="14153"/> 7 7 8 8 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationAction.java
r33692 r34487 6 6 import java.awt.event.ActionEvent; 7 7 import java.awt.event.KeyEvent; 8 import java.util.Collection;9 8 10 9 import org.openstreetmap.josm.actions.JosmAction; 11 import org.openstreetmap.josm.data.SelectionChangedListener; 12 import org.openstreetmap.josm.data.osm.DataSet; 10 import org.openstreetmap.josm.data.osm.DataSelectionListener; 13 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 12 import org.openstreetmap.josm.data.osm.Way; 13 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 15 14 import org.openstreetmap.josm.tools.Shortcut; 16 15 17 @SuppressWarnings("serial") 18 public class AddrInterpolationAction extends JosmAction implements 19 SelectionChangedListener { 16 /** 17 * Handy Address Interpolation Functions 18 */ 19 public class AddrInterpolationAction extends JosmAction implements DataSelectionListener { 20 20 21 21 public AddrInterpolationAction() { … … 24 24 KeyEvent.VK_Z, Shortcut.ALT_CTRL), false); 25 25 setEnabled(false); 26 DataSet.addSelectionListener(this);26 SelectionEventManager.getInstance().addSelectionListener(this); 27 27 } 28 28 … … 33 33 34 34 @Override 35 public void selectionChanged( 36 Collection<? extends OsmPrimitive> newSelection) { 35 public void selectionChanged(SelectionChangeEvent event) { 37 36 38 for (OsmPrimitive osm : newSelection) {37 for (OsmPrimitive osm : event.getSelection()) { 39 38 if (osm instanceof Way) { 40 39 setEnabled(true); -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationDialog.java
r34095 r34487 9 9 import java.awt.Container; 10 10 import java.awt.Dimension; 11 import java.awt.Frame;12 11 import java.awt.GridBagConstraints; 13 12 import java.awt.GridBagLayout; … … 43 42 import javax.swing.border.TitledBorder; 44 43 45 import org.openstreetmap.josm.Main;46 44 import org.openstreetmap.josm.command.AddCommand; 47 45 import org.openstreetmap.josm.command.ChangeCommand; … … 50 48 import org.openstreetmap.josm.command.DeleteCommand; 51 49 import org.openstreetmap.josm.command.SequenceCommand; 50 import org.openstreetmap.josm.data.UndoRedoHandler; 52 51 import org.openstreetmap.josm.data.coor.LatLon; 53 52 import org.openstreetmap.josm.data.osm.DataSet; … … 61 60 import org.openstreetmap.josm.tools.ImageProvider; 62 61 62 /** 63 * Address Interpolation dialog 64 */ 63 65 public class AddrInterpolationDialog extends JDialog implements ActionListener { 64 66 … … 123 125 124 126 private void ShowDialog(JPanel editControlsPane, String name) { 125 dialog = new EscapeDialog( (Frame) Main.parent, name, true);127 dialog = new EscapeDialog(MainApplication.getMainFrame(), name, true); 126 128 127 129 dialog.add(editControlsPane); … … 619 621 if (namedWayCount != 1) { 620 622 JOptionPane.showMessageDialog( 621 Main .parent,623 MainApplication.getMainFrame(), 622 624 tr("Please select a street to associate with address interpolation way"), 623 625 tr("Error"), … … 632 634 } else { 633 635 JOptionPane.showMessageDialog( 634 Main .parent,636 MainApplication.getMainFrame(), 635 637 tr("Please select address interpolation way for this street"), 636 638 tr("Error"), … … 1002 1004 } 1003 1005 if (!errorMessage.equals("")) { 1004 JOptionPane.showMessageDialog(Main .parent, errorMessage, tr("Error"), JOptionPane.ERROR_MESSAGE);1006 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), errorMessage, tr("Error"), JOptionPane.ERROR_MESSAGE); 1005 1007 return false; 1006 1008 } … … 1009 1011 if (country != null) { 1010 1012 if (country.length() != 2) { 1011 JOptionPane.showMessageDialog(Main .parent,1013 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 1012 1014 tr("Country code must be 2 letters"), tr("Error"), JOptionPane.ERROR_MESSAGE); 1013 1015 return false; … … 1096 1098 1097 1099 if (!commandGroup.isEmpty()) { 1098 Main.main.undoRedo.add(new SequenceCommand(tr("Address Interpolation"), commandGroup));1100 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Address Interpolation"), commandGroup)); 1099 1101 MainApplication.getLayerManager().getEditLayer().invalidate(); 1100 1102 } … … 1240 1242 1241 1243 } else { 1242 JOptionPane.showMessageDialog(Main .parent, errorMessage, tr("Error"), JOptionPane.ERROR_MESSAGE);1244 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), errorMessage, tr("Error"), JOptionPane.ERROR_MESSAGE); 1243 1245 return false; 1244 1246 } -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/AddrInterpolationPlugin.java
r34061 r34487 7 7 import org.openstreetmap.josm.plugins.PluginInformation; 8 8 9 /** 10 * Address Interpolation plugin 11 */ 9 12 public class AddrInterpolationPlugin extends Plugin { 10 13 -
applications/editors/josm/plugins/addrinterpolation/src/org/openstreetmap/josm/plugins/AddrInterpolation/EscapeDialog.java
r33692 r34487 2 2 package org.openstreetmap.josm.plugins.AddrInterpolation; 3 3 4 import java.awt.Dialog;5 4 import java.awt.Frame; 6 import java.awt.event.ActionEvent;7 5 import java.awt.event.ActionListener; 8 6 import java.awt.event.KeyEvent; … … 14 12 15 13 public class EscapeDialog extends JDialog { 16 public EscapeDialog() {17 this((Frame) null, false);18 }19 20 public EscapeDialog(Frame owner) {21 this(owner, false);22 }23 24 public EscapeDialog(Frame owner, boolean modal) {25 this(owner, null, modal);26 }27 28 public EscapeDialog(Frame owner, String title) {29 this(owner, title, false);30 }31 14 32 15 public EscapeDialog(Frame owner, String title, boolean modal) { … … 34 17 } 35 18 36 public EscapeDialog(Dialog owner) {37 this(owner, false);38 }39 40 public EscapeDialog(Dialog owner, boolean modal) {41 this(owner, null, modal);42 }43 44 public EscapeDialog(Dialog owner, String title) {45 this(owner, title, false);46 }47 48 public EscapeDialog(Dialog owner, String title, boolean modal) {49 super(owner, title, modal);50 }51 52 19 @Override 53 20 protected JRootPane createRootPane() { 54 ActionListener escapeActionListener = new ActionListener() { 55 @Override 56 public void actionPerformed(ActionEvent actionEvent) { 57 dispose(); 58 } 59 }; 21 ActionListener escapeActionListener = actionEvent -> dispose(); 60 22 JRootPane rootPane = new JRootPane(); 61 23 KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); … … 65 27 } 66 28 } 67
Note:
See TracChangeset
for help on using the changeset viewer.