Ignore:
Timestamp:
2014-09-23T11:46:57+02:00 (10 years ago)
Author:
donvip
Message:

[josm_commandline] code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/CommandLine/src/CommandLine/CommandLine.java

    r30669 r30670  
    101101                            if (commandText.isEmpty()) {
    102102                                commandText = history.getLastItem();
    103                             }
    104                             else {
     103                            } else {
    105104                                history.addItem(commandText);
    106105                            }
     
    108107                            if (command != null) {
    109108                                startCommand(command);
     109                            } else {
     110                                setMode(Mode.IDLE);
    110111                            }
    111                             else
    112                                 setMode(Mode.IDLE);
    113112                            break;
    114113                        case SELECTION:
     
    189188        };
    190189
    191         if ( Main.main.menu != null ) {
     190        if (Main.main.menu != null) {
    192191            commandMenu = Main.main.menu.addMenu(marktr("Commands") , KeyEvent.VK_O, Main.main.menu.getDefaultMenuPos(), ht("/Plugin/CommandLine"));
    193192            MainMenu.add(commandMenu, new CommandLineAction(this));
     
    259258                    return commands.get(i);
    260259                }
    261             }
    262             else {
    263                 if ( commands.get(i).name.toLowerCase().startsWith( text.toLowerCase() ) && text.length() > 1 ) {
    264                     return commands.get(i);
    265                 }
     260            } else if ( commands.get(i).name.toLowerCase().startsWith( text.toLowerCase() ) && text.length() > 1 ) {
     261                return commands.get(i);
    266262            }
    267263        }
     
    340336                Layer olayer = Main.map.mapView.getActiveLayer();
    341337                if (olayer != null) {
    342                     if (olayer instanceof ImageryLayer) {
    343                     }
    344                     else {
     338                    if (!(olayer instanceof ImageryLayer)) {
    345339                        List<ImageryLayer> imageryLayers = Main.map.mapView.getLayersOfType(ImageryLayer.class);
    346340                        if (imageryLayers.size() == 1) {
     
    404398                    setMode(Mode.SELECTION);
    405399                }
    406             }
    407             else {
     400            } else {
    408401                runTool();
    409402            }
    410         }
    411         else {
     403        } else {
    412404            Main.info("Invalid argument");
    413405            endInput();
     
    424416        if (ok) {
    425417            currentCommand.nextParameter();
    426         }
    427         else {
     418        } else {
    428419            currentCommand.resetLoading();
    429420        }
     
    463454            debugstr.append(s + " ");
    464455        debugstr.append("\n");
    465         System.out.print(debugstr.toString());
     456        Main.info(debugstr.toString());
    466457
    467458        final ToolProcess tp = new ToolProcess();
     
    469460            tp.process = builder.start();
    470461        } catch (final IOException e) {
    471             e.printStackTrace();
    472462            synchronized (debugstr) {
    473                 System.out.print(
     463                Main.error(
    474464                        tr("Error executing the script: ") +
    475465                        debugstr.toString() + e.getMessage() + "\n" + e.getStackTrace());
     
    577567                    final OsmToCmd osmToCmd = new OsmToCmd(that, currentDataSet);
    578568                    String commandName = currentCommand.name;
    579                     //HashMap<Long, Long> inexiDMap = new HashMap<Long, Long>();
    580569                    final InputStream inputStream = tp.process.getInputStream();
    581570                    osmToCmd.parseStream(inputStream);
     
    590579                        });
    591580                    }
    592                 }
    593                 catch (Exception e) {}
     581                } catch (Exception e) {
     582                }
    594583                finally {
    595584                    synchronized (syncObj) {
Note: See TracChangeset for help on using the changeset viewer.