Changeset 29778 in osm for applications/editors/josm/plugins/HouseNumberTaggingTool/src
- Timestamp:
- 2013-07-25T21:57:38+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/HouseNumberTaggingToolPlugin.java
r27510 r29778 6 6 import org.openstreetmap.josm.plugins.PluginInformation; 7 7 8 public class HouseNumberTaggingToolPlugin extends Plugin 9 { 8 public class HouseNumberTaggingToolPlugin extends Plugin { 10 9 LaunchAction action; 11 10 … … 13 12 * constructor 14 13 */ 15 public HouseNumberTaggingToolPlugin(PluginInformation info) 16 { 14 public HouseNumberTaggingToolPlugin(PluginInformation info) { 17 15 super(info); 18 16 action = new LaunchAction(getPluginDir()); 19 MainMenu.add(Main.main.menu. editMenu, action);17 MainMenu.add(Main.main.menu.dataMenu, action, false,0); 20 18 } 21 19 } -
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/LaunchAction.java
r29475 r29778 48 48 } 49 49 50 @Override 50 51 public void actionPerformed(ActionEvent e) 51 52 { … … 53 54 } 54 55 56 @Override 55 57 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) 56 58 { -
applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/TagDialog.java
r29487 r29778 102 102 setLocationRelativeTo(null); 103 103 104 SwingUtilities.invokeLater(new Runnable() 105 { 106 public void run() 107 { 104 SwingUtilities.invokeLater(new Runnable() { 105 @Override 106 public void run() { 108 107 housnumber.requestFocus(); 109 108 housnumber.selectAll(); … … 112 111 } 113 112 114 private JPanel createContentPane() 115 { 113 private JPanel createContentPane() { 116 114 acm = selection.getDataSet().getAutoCompletionManager(); 117 115 … … 267 265 268 266 int number = 0; 269 try 270 { 267 try { 271 268 number = Integer.valueOf(dto.getHousenumber()) + dto.getHousenumberChangeValue(); 272 269 } 273 catch (NumberFormatException e) 274 { 275 } 276 if (number > 0) 277 { 270 catch (NumberFormatException e) { } 271 if (number > 0) { 278 272 housnumber.setText(String.valueOf(number)); 279 273 } … … 310 304 protected void buttonAction(int buttonIndex, ActionEvent evt) 311 305 { 312 if (buttonIndex == 0) 313 { 306 if (buttonIndex == 0) { 314 307 Dto dto = new Dto(); 315 308 dto.setSaveBuilding(buildingEnabled.isSelected()); … … 339 332 { 340 333 Object item = box.getSelectedItem(); 341 if (item != null) 342 { 343 if (item instanceof String) 344 { 334 if (item != null) { 335 if (item instanceof String) { 345 336 return (String) item; 346 337 } 347 if (item instanceof AutoCompletionListItem) 348 { 338 if (item instanceof AutoCompletionListItem) { 349 339 return ((AutoCompletionListItem) item).getValue(); 350 340 } 351 341 return item.toString(); 352 } 353 else 354 { 342 } else { 355 343 return ""; 356 344 } … … 362 350 File fileName = new File(pluginDir + TagDialog.TEMPLATE_DATA); 363 351 364 try 365 { 352 try { 366 353 path.mkdirs(); 367 354 … … 370 357 o.writeObject(dto); 371 358 o.close(); 372 } 373 catch (Exception ex) 374 { 359 } catch (Exception ex) { 375 360 logger.log(Level.SEVERE, ex.getMessage()); 376 377 if (fileName != null) 378 { 379 fileName.delete(); 380 } 361 fileName.delete(); 381 362 } 382 363 } … … 386 367 ArrayList<Command> commands = new ArrayList<Command>(); 387 368 388 if (dto.isSaveBuilding()) 389 { 369 if (dto.isSaveBuilding()) { 390 370 String value = selection.get(TagDialog.TAG_BUILDING); 391 if (value == null || (value != null && !value.equals(dto.getBuilding()))) 392 { 371 if (value == null || (value != null && !value.equals(dto.getBuilding()))) { 393 372 ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_BUILDING, dto.getBuilding()); 394 373 commands.add(command); … … 396 375 } 397 376 398 if (dto.isSaveCity()) 399 { 377 if (dto.isSaveCity()) { 400 378 String value = selection.get(TagDialog.TAG_ADDR_CITY); 401 if (value == null || (value != null && !value.equals(dto.getCity()))) 402 { 379 if (value == null || (value != null && !value.equals(dto.getCity()))) { 403 380 ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_ADDR_CITY, dto.getCity()); 404 381 commands.add(command); … … 406 383 } 407 384 408 if (dto.isSaveCountry()) 409 { 385 if (dto.isSaveCountry()) { 410 386 String value = selection.get(TagDialog.TAG_ADDR_COUNTRY); 411 387 if (value == null || (value != null && !value.equals(dto.getCountry()))) … … 416 392 } 417 393 418 if (dto.isSaveHousenumber()) 419 { 394 if (dto.isSaveHousenumber()) { 420 395 String value = selection.get(TagDialog.TAG_ADDR_HOUSENUMBER); 421 if (value == null || (value != null && !value.equals(dto.getHousenumber()))) 422 { 396 if (value == null || (value != null && !value.equals(dto.getHousenumber()))) { 423 397 ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_ADDR_HOUSENUMBER, dto.getHousenumber()); 424 398 commands.add(command); … … 426 400 } 427 401 428 if (dto.isSavePostcode()) 429 { 402 if (dto.isSavePostcode()) { 430 403 String value = selection.get(TagDialog.TAG_ADDR_POSTCODE); 431 if (value == null || (value != null && !value.equals(dto.getPostcode()))) 432 { 404 if (value == null || (value != null && !value.equals(dto.getPostcode()))) { 433 405 ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_ADDR_POSTCODE, dto.getPostcode()); 434 406 commands.add(command); … … 436 408 } 437 409 438 if (dto.isSaveStreet()) 439 { 410 if (dto.isSaveStreet()) { 440 411 String value = selection.get(TagDialog.TAG_ADDR_STREET); 441 412 if (value == null || (value != null && !value.equals(dto.getStreet()))) … … 446 417 } 447 418 448 if (dto.isSaveState()) 449 { 419 if (dto.isSaveState()) { 450 420 String value = selection.get(TagDialog.TAG_ADDR_STATE); 451 if (value == null || (value != null && !value.equals(dto.getState()))) 452 { 421 if (value == null || (value != null && !value.equals(dto.getState()))) { 453 422 ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_ADDR_STATE, dto.getState()); 454 423 commands.add(command); … … 456 425 } 457 426 458 if (commands.size() > 0) 459 { 427 if (commands.size() > 0) { 460 428 SequenceCommand sequenceCommand = new SequenceCommand(trn("Updating properties of up to {0} object", "Updating properties of up to {0} objects", commands.size(), commands.size()), commands); 461 429 … … 465 433 } 466 434 467 private Collection<String> getPossibleStreets() 468 { 435 private Collection<String> getPossibleStreets() { 469 436 /** 470 437 * Generates a list of all visible names of highways in order to do autocompletion on the road name. … … 481 448 } 482 449 483 private Dto loadDto() 484 { 450 private Dto loadDto() { 485 451 Dto dto = new Dto(); 486 452 File fileName = new File(pluginDir + TagDialog.TEMPLATE_DATA); 487 453 488 try 489 { 490 491 if (fileName.exists()) 492 { 454 try { 455 456 if (fileName.exists()) { 493 457 FileInputStream file = new FileInputStream(fileName); 494 458 ObjectInputStream o = new ObjectInputStream(file); … … 496 460 dto = (Dto) o.readObject(); 497 461 o.close(); 498 } 499 else 500 { 462 } else { 501 463 dto.setCity(selection.get(TagDialog.TAG_ADDR_CITY)); 502 464 dto.setCountry(selection.get(TagDialog.TAG_ADDR_COUNTRY)); … … 506 468 dto.setState(selection.get(TagDialog.TAG_ADDR_STATE)); 507 469 } 508 509 } 510 catch (Exception ex) 511 { 512 logger.log(Level.SEVERE, ex.getMessage()); 513 if (fileName != null) 514 { 470 } catch (Exception ex) { 471 logger.log(Level.SEVERE, ex.getMessage()); 515 472 fileName.delete(); 516 } 517 } 518 473 } 519 474 return dto; 520 475
Note:
See TracChangeset
for help on using the changeset viewer.