Changeset 34069 in osm for applications
- Timestamp:
- 2018-02-18T15:26:07+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/HouseNumberTaggingTool
- Files:
-
- 8 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/HouseNumberTaggingTool/.classpath
r32680 r34069 2 2 <classpath> 3 3 <classpathentry kind="src" path="src"/> 4 <classpathentry kind="src" path="test/unit"/> 4 5 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> 6 <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> 5 7 <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/> 6 8 <classpathentry kind="output" path="bin"/> -
applications/editors/josm/plugins/HouseNumberTaggingTool/.settings/org.eclipse.core.resources.prefs
r29859 r34069 1 1 eclipse.preferences.version=1 2 encoding/test=UTF-8 2 3 encoding/src=UTF-8 -
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/Dto.java
r30775 r34069 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.housenumbertool; 2 3 -
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/HouseNumberTaggingToolPlugin.java
r33904 r34069 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.housenumbertool; 2 3 … … 10 11 */ 11 12 public class HouseNumberTaggingToolPlugin extends Plugin { 12 private final LaunchAction action;13 13 14 14 /** … … 18 18 public HouseNumberTaggingToolPlugin(PluginInformation info) { 19 19 super(info); 20 action = new LaunchAction(getPluginDirs().getUserDataDirectory(false));21 MainMenu.add(MainApplication.getMenu().dataMenu, action, false, 0);20 LaunchAction action = new LaunchAction(getPluginDirs().getUserDataDirectory(false)); 21 MainMenu.add(MainApplication.getMenu().dataMenu, action, false, 0); 22 22 } 23 23 } -
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/LaunchAction.java
r33904 r34069 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.housenumbertool; 2 3 -
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/TagDialog.java
r33904 r34069 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.housenumbertool; 2 3 … … 23 24 import java.util.logging.Level; 24 25 import java.util.logging.Logger; 26 import java.util.regex.Matcher; 27 import java.util.regex.Pattern; 25 28 26 29 import javax.swing.ButtonGroup; … … 320 323 housnumber.setPreferredSize(new Dimension(200, 24)); 321 324 322 int number = 0; 323 try { 324 number = Integer.valueOf(dto.getHousenumber()) + dto.getHousenumberChangeValue(); 325 } catch (NumberFormatException e) { 326 // Do nothing 327 } 328 if (number > 0) { 329 housnumber.setText(String.valueOf(number)); 325 String number = incrementHouseNumber(dto.getHousenumber(), dto.getHousenumberChangeValue()); 326 if (number != null) { 327 housnumber.setText(number); 330 328 } 331 329 … … 358 356 359 357 return editPanel; 358 } 359 360 static String incrementHouseNumber(String number, int increment) { 361 try { 362 Matcher m = Pattern.compile("([^\\pN]+)?(\\pN+)([^\\pN]+)?").matcher(number); 363 if (m.matches()) { 364 String prefix = m.group(1) != null ? m.group(1) : ""; 365 int n = Integer.valueOf(m.group(2)) + increment; 366 String suffix = m.group(3) != null ? m.group(3) : ""; 367 return prefix + n + suffix; 368 } 369 } catch (NumberFormatException e) { 370 // Do nothing 371 } 372 return null; 360 373 } 361 374
Note:
See TracChangeset
for help on using the changeset viewer.