Ignore:
Timestamp:
2013-07-25T21:57:38+02:00 (11 years ago)
Author:
akks
Message:

[josm_plugins]: see #josm6355 - Move most of the other plugins to suitable menus, add Netbeans projects

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  
    66import org.openstreetmap.josm.plugins.PluginInformation;
    77
    8 public class HouseNumberTaggingToolPlugin extends Plugin
    9 {
     8public class HouseNumberTaggingToolPlugin extends Plugin {
    109   LaunchAction action;
    1110
     
    1312    * constructor
    1413    */
    15    public HouseNumberTaggingToolPlugin(PluginInformation info)
    16    {
     14   public HouseNumberTaggingToolPlugin(PluginInformation info) {
    1715      super(info);
    1816      action = new LaunchAction(getPluginDir());
    19       MainMenu.add(Main.main.menu.editMenu, action);
     17      MainMenu.add(Main.main.menu.dataMenu, action, false,0);
    2018   }
    2119}
  • applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/LaunchAction.java

    r29475 r29778  
    4848   }
    4949
     50   @Override
    5051   public void actionPerformed(ActionEvent e)
    5152   {
     
    5354   }
    5455
     56   @Override
    5557   public void selectionChanged(Collection<? extends OsmPrimitive> newSelection)
    5658   {
  • applications/editors/josm/plugins/HouseNumberTaggingTool/src/org/openstreetmap/josm/plugins/housenumbertool/TagDialog.java

    r29487 r29778  
    102102      setLocationRelativeTo(null);
    103103
    104       SwingUtilities.invokeLater(new Runnable()
    105       {
    106          public void run()
    107          {
     104      SwingUtilities.invokeLater(new Runnable()  {
     105         @Override
     106         public void run() {
    108107            housnumber.requestFocus();
    109108            housnumber.selectAll();
     
    112111   }
    113112
    114    private JPanel createContentPane()
    115    {
     113   private JPanel createContentPane() {
    116114      acm = selection.getDataSet().getAutoCompletionManager();
    117115
     
    267265     
    268266      int number = 0;
    269       try
    270       {
     267      try {
    271268         number = Integer.valueOf(dto.getHousenumber()) + dto.getHousenumberChangeValue();
    272269      }
    273       catch (NumberFormatException e)
    274       {
    275       }
    276       if (number > 0)
    277       {
     270      catch (NumberFormatException e)  { }
     271      if (number > 0) {
    278272         housnumber.setText(String.valueOf(number));
    279273      }
     
    310304   protected void buttonAction(int buttonIndex, ActionEvent evt)
    311305   {
    312       if (buttonIndex == 0)
    313       {
     306      if (buttonIndex == 0)  {
    314307         Dto dto = new Dto();
    315308         dto.setSaveBuilding(buildingEnabled.isSelected());
     
    339332   {
    340333      Object item = box.getSelectedItem();
    341       if (item != null)
    342       {
    343          if (item instanceof String)
    344          {
     334      if (item != null) {
     335         if (item instanceof String) {
    345336            return (String) item;
    346337         }
    347          if (item instanceof AutoCompletionListItem)
    348          {
     338         if (item instanceof AutoCompletionListItem) {
    349339            return ((AutoCompletionListItem) item).getValue();
    350340         }
    351341         return item.toString();
    352       }
    353       else
    354       {
     342      } else {
    355343         return "";
    356344      }
     
    362350      File fileName = new File(pluginDir + TagDialog.TEMPLATE_DATA);
    363351
    364       try
    365       {
     352      try {
    366353         path.mkdirs();
    367354
     
    370357         o.writeObject(dto);
    371358         o.close();
    372       }
    373       catch (Exception ex)
    374       {
     359      } catch (Exception ex) {
    375360         logger.log(Level.SEVERE, ex.getMessage());
    376 
    377          if (fileName != null)
    378          {
    379             fileName.delete();
    380          }
     361         fileName.delete();
    381362      }
    382363   }
     
    386367      ArrayList<Command> commands = new ArrayList<Command>();
    387368
    388       if (dto.isSaveBuilding())
    389       {
     369      if (dto.isSaveBuilding()) {
    390370         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()))) {
    393372            ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_BUILDING, dto.getBuilding());
    394373            commands.add(command);
     
    396375      }
    397376
    398       if (dto.isSaveCity())
    399       {
     377      if (dto.isSaveCity()) {
    400378         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()))) {
    403380            ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_ADDR_CITY, dto.getCity());
    404381            commands.add(command);
     
    406383      }
    407384
    408       if (dto.isSaveCountry())
    409       {
     385      if (dto.isSaveCountry())  {
    410386         String value = selection.get(TagDialog.TAG_ADDR_COUNTRY);
    411387         if (value == null || (value != null && !value.equals(dto.getCountry())))
     
    416392      }
    417393
    418       if (dto.isSaveHousenumber())
    419       {
     394      if (dto.isSaveHousenumber())  {
    420395         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())))  {
    423397            ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_ADDR_HOUSENUMBER, dto.getHousenumber());
    424398            commands.add(command);
     
    426400      }
    427401
    428       if (dto.isSavePostcode())
    429       {
     402      if (dto.isSavePostcode()) {
    430403         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()))) {
    433405            ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_ADDR_POSTCODE, dto.getPostcode());
    434406            commands.add(command);
     
    436408      }
    437409
    438       if (dto.isSaveStreet())
    439       {
     410      if (dto.isSaveStreet()) {
    440411         String value = selection.get(TagDialog.TAG_ADDR_STREET);
    441412         if (value == null || (value != null && !value.equals(dto.getStreet())))
     
    446417      }
    447418
    448       if (dto.isSaveState())
    449       {
     419      if (dto.isSaveState()) {
    450420         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())))  {
    453422            ChangePropertyCommand command = new ChangePropertyCommand(selection, TagDialog.TAG_ADDR_STATE, dto.getState());
    454423            commands.add(command);
     
    456425      }
    457426
    458       if (commands.size() > 0)
    459       {
     427      if (commands.size() > 0) {
    460428         SequenceCommand sequenceCommand = new SequenceCommand(trn("Updating properties of up to {0} object", "Updating properties of up to {0} objects", commands.size(), commands.size()), commands);
    461429
     
    465433   }
    466434
    467    private Collection<String> getPossibleStreets()
    468    {
     435   private Collection<String> getPossibleStreets() {
    469436      /**
    470437       * Generates a list of all visible names of highways in order to do autocompletion on the road name.
     
    481448   }
    482449
    483    private Dto loadDto()
    484    {
     450   private Dto loadDto() {
    485451      Dto dto = new Dto();
    486452      File fileName = new File(pluginDir + TagDialog.TEMPLATE_DATA);
    487453
    488       try
    489       {
    490 
    491          if (fileName.exists())
    492          {
     454      try {
     455
     456         if (fileName.exists()) {
    493457            FileInputStream file = new FileInputStream(fileName);
    494458            ObjectInputStream o = new ObjectInputStream(file);
     
    496460            dto = (Dto) o.readObject();
    497461            o.close();
    498          }
    499          else
    500          {
     462         } else {
    501463            dto.setCity(selection.get(TagDialog.TAG_ADDR_CITY));
    502464            dto.setCountry(selection.get(TagDialog.TAG_ADDR_COUNTRY));
     
    506468            dto.setState(selection.get(TagDialog.TAG_ADDR_STATE));
    507469         }
    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());
    515472            fileName.delete();
    516          }
    517       }
    518 
     473      }
    519474      return dto;
    520475
Note: See TracChangeset for help on using the changeset viewer.