Changeset 8342 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2015-05-09T12:49:35+02:00 (9 years ago)
Author:
Don-vip
Message:

code style - Close curly brace and the next "else", "catch" and "finally" keywords should be located on the same line

Location:
trunk/src/org/openstreetmap/josm
Files:
47 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r8291 r8342  
    916916            try {
    917917                UIManager.setLookAndFeel(laf);
    918             }
    919             catch (final NoClassDefFoundError | ClassNotFoundException e) {
     918            } catch (final NoClassDefFoundError | ClassNotFoundException e) {
    920919                // Try to find look and feel in plugin classloaders
    921920                Class<?> klass = null;
     
    938937                    Main.pref.put("laf", defaultlaf);
    939938                }
    940             }
    941             catch (final UnsupportedLookAndFeelException e) {
     939            } catch (final UnsupportedLookAndFeelException e) {
    942940                info("Look and Feel not supported: " + laf);
    943941                Main.pref.put("laf", defaultlaf);
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r8308 r8342  
    119119                    tree.getSelectedLayers(), (String) formats.getSelectedItem());
    120120            return new ImageryInfo(info.getName(), url, "wms", info.getEulaAcceptanceRequired(), info.getCookies());
    121         } // exception handling from AddWMSLayerPanel.java
    122         catch (MalformedURLException ex) {
     121        } catch (MalformedURLException ex) {
    123122            JOptionPane.showMessageDialog(Main.parent, tr("Invalid service URL."),
    124123                    tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r8318 r8342  
    171171        try {
    172172            Command cmd = null;
    173             //// Decide what to align based on selection:
    174 
    175             /// Only ways selected -> For each way align their nodes taking care of intersection
     173            // Decide what to align based on selection:
     174
    176175            if(selectedNodes.isEmpty() && !selectedWays.isEmpty()) {
     176                // Only ways selected -> For each way align their nodes taking care of intersection
    177177                cmd = alignMultiWay(selectedWays);
    178             }
    179             /// Only 1 node selected -> align this node relative to referers way
    180             else if(selectedNodes.size() == 1) {
     178            } else if(selectedNodes.size() == 1) {
     179                // Only 1 node selected -> align this node relative to referers way
    181180                Node selectedNode = selectedNodes.get(0);
    182181                List<Way> involvedWays = null;
    183182                if(selectedWays.isEmpty())
    184                     /// No selected way, all way containing this node are used
     183                    // No selected way, all way containing this node are used
    185184                    involvedWays = OsmPrimitive.getFilteredList(selectedNode.getReferrers(), Way.class);
    186185                else
    187                     /// Selected way, use only these ways
     186                    // Selected way, use only these ways
    188187                    involvedWays = selectedWays;
    189188                List<Line> lines = getInvolvedLines(selectedNode, involvedWays);
     
    191190                    throw new InvalidSelection();
    192191                cmd = alignSingleNode(selectedNodes.get(0), lines);
    193             }
    194             // More than 3 nodes and way(s) selected -> align selected nodes. Don't care of way(s).
    195             else if(selectedNodes.size() >= 3) {
     192            } else if(selectedNodes.size() >= 3) {
     193                // More than 3 nodes and way(s) selected -> align selected nodes. Don't care of way(s).
    196194                cmd = alignOnlyNodes(selectedNodes);
    197             }
    198             /// All others cases are invalid
    199             else {
     195            } else {
     196                // All others cases are invalid
    200197                throw new InvalidSelection();
    201198            }
     
    257254                if(n == way.firstNode() || n == way.lastNode()) continue;
    258255                cmds.add(lines.get(way).projectionCommand(n));
    259             }
    260             else if(referers.size() == 2) {
     256            } else if(referers.size() == 2) {
    261257                Command cmd = lines.get(referers.get(0)).intersectionCommand(n, lines.get(referers.get(1)));
    262258                cmds.add(cmd);
    263             }
    264             else
     259            } else
    265260                throw new InvalidSelection(tr("Intersection of three or more ways can not be solved. Abort."));
    266261        }
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r8338 r8342  
    150150                        nodes.add(way.way.getNode(pos));
    151151                    }
    152                 }
    153                 else {
     152                } else {
    154153                    for (int pos = way.way.getNodesCount() - 1; pos > 0; pos--) {
    155154                        nodes.add(way.way.getNode(pos));
     
    12921291                    outerWays.add(rm.getWay());
    12931292                    hasKnownOuter |= selectedWays.contains(rm.getWay());
    1294                 }
    1295                 else if ("inner".equalsIgnoreCase(rm.getRole())) {
     1293                } else if ("inner".equalsIgnoreCase(rm.getRole())) {
    12961294                    innerWays.add(rm.getWay());
    12971295                }
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r8338 r8342  
    114114                    Main.map.repaint();
    115115                } else throw new InvalidUserInputException();
    116             }
    117             catch (InvalidUserInputException ex) {
     116            } catch (InvalidUserInputException ex) {
    118117                new Notification(
    119118                        tr("Orthogonalize Shape / Undo<br>"+
     
    154153                if (p instanceof Node) {
    155154                    nodeList.add((Node) p);
    156                 }
    157                 else if (p instanceof Way) {
     155                } else if (p instanceof Way) {
    158156                    wayDataList.add(new WayData((Way) p));
    159157                } else
     
    169167                    if (nodeList.size() == 2) {  // fixed direction
    170168                        commands.addAll(orthogonalize(wayDataList, nodeList));
    171                     }
    172                     else if (nodeList.isEmpty()) {
     169                    } else if (nodeList.isEmpty()) {
    173170                        List<List<WayData>> groups = buildGroups(wayDataList);
    174171                        for (List<WayData> g: groups) {
     
    267264                }
    268265                headingAll = EN.polar(new EastNorth(0., 0.), totSum);
    269             }
    270             else {
     266            } else {
    271267                headingAll = EN.polar(headingNodes.get(0).getEastNorth(), headingNodes.get(1).getEastNorth());
    272268                for (WayData w : wayDataList) {
     
    392388                        Math.abs(dy) > Math.abs(EPSILON * tmp.east()))
    393389                    throw new AssertionError();
    394             }
    395             else {
     390            } else {
    396391                OrthogonalizeAction.rememberMovements.put(n, new EastNorth(dx, dy));
    397392                commands.add(new MoveCommand(n, dx, dy));
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r8338 r8342  
    529529                    // double click adds a new node
    530530                    addNewNode(e);
    531                 }
    532                 else if (e.getPoint().distance(initialMousePos) > initialMoveThreshold && newN1en != null && selectedSegment != null) {
     531                } else if (e.getPoint().distance(initialMousePos) > initialMoveThreshold && newN1en != null && selectedSegment != null) {
    533532                    // main extrusion commands
    534533                    performExtrusion();
     
    11771176
    11781177            return new Line2D.Double(start, new Point2D.Double(start.getX() + (unitvector.getX() * linelength) , start.getY() + (unitvector.getY() * linelength)));
    1179         }
    1180         catch (NoninvertibleTransformException e) {
     1178        } catch (NoninvertibleTransformException e) {
    11811179            return new Line2D.Double(start, new Point2D.Double(start.getX() + (unitvector.getX() * 10) , start.getY() + (unitvector.getY() * 10)));
    11821180        }
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r8338 r8342  
    9797                        // new value is null and tag exists (will delete tag)
    9898                        modified = true;
    99                 }
    100                 else if (oldVal == null || !newVal.equals(oldVal))
     99                } else if (oldVal == null || !newVal.equals(oldVal))
    101100                    // new value is not null and is different from current value
    102101                    modified = true;
     
    121120                        if (oldVal != null)
    122121                            osm.remove(tag.getKey());
    123                     }
    124                     else if (oldVal == null || !newVal.equals(oldVal))
     122                    } else if (oldVal == null || !newVal.equals(oldVal))
    125123                        osm.put(tag.getKey(), newVal);
    126124                }
     
    130128            }
    131129            return true;
    132         }
    133         finally {
     130        } finally {
    134131            Main.main.getCurrentDataSet().endUpdate();
    135132        }
     
    171168                text = trn("Set {0}={1} for {2} object", "Set {0}={1} for {2} objects", objects.size(), entry.getKey(), entry.getValue(), objects.size());
    172169            }
    173         }
    174         else {
     170        } else {
    175171            boolean allnull = true;
    176172            for (Map.Entry<String, String> tag : this.tags.entrySet()) {
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r7005 r8342  
    9696                }
    9797            }
    98         }
    99         finally {
     98        } finally {
    10099            Main.main.getCurrentDataSet().endUpdate();
    101100        }
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r8155 r8342  
    228228        if (names.size() == 1) {
    229229            s.append(" name:").append(getName());
    230         }
    231         else if (names.size() > 1) {
     230        } else if (names.size() > 1) {
    232231            s.append(String.format(" %d names:%s", names.size(), getName()));
    233232        }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/LineClip.java

    r7040 r8342  
    7272                accept = true;
    7373                done = true;
    74             }
    75             else if ( (outcode0 & outcode1) > 0 ) {
     74            } else if ( (outcode0 & outcode1) > 0 ) {
    7675                done = true;
    77             }
    78             else {
     76            } else {
    7977                long x = 0, y = 0;
    8078                outcodeOut = outcode0 != 0 ? outcode0: outcode1;
     
    8280                    x = x1 + (x2 - x1) * (ymax - y1)/(y2 - y1);
    8381                    y = ymax;
    84                 }
    85                 else if ((outcodeOut & OUT_BOTTOM) > 0 ) {
     82                } else if ((outcodeOut & OUT_BOTTOM) > 0 ) {
    8683                    x = x1 + (x2 - x1) * (ymin - y1)/(y2 - y1);
    8784                    y = ymin;
    88                 }
    89                 else if ((outcodeOut & OUT_RIGHT)> 0) {
     85                } else if ((outcodeOut & OUT_RIGHT)> 0) {
    9086                    y = y1 + (y2 - y1) * (xmax - x1)/(x2 - x1);
    9187                    x = xmax;
    92                 }
    93                 else if ((outcodeOut & OUT_LEFT) > 0) {
     88                } else if ((outcodeOut & OUT_LEFT) > 0) {
    9489                    y = y1 + (y2 - y1) * (xmin - x1)/(x2 - x1);
    9590                    x = xmin;
     
    124119        if (y > ymax) {
    125120            code |= OUT_TOP;
    126         }
    127         else if (y < ymin) {
     121        } else if (y < ymin) {
    128122            code |= OUT_BOTTOM;
    129123        }
    130124        if (x > xmax) {
    131125            code |= OUT_RIGHT;
    132         }
    133         else if (x < xmin) {
     126        } else if (x < xmin) {
    134127            code |= OUT_LEFT;
    135128        }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r8318 r8342  
    946946
    947947        Node viaNode;
    948         if(via instanceof Node)
    949         {
     948        if(via instanceof Node) {
    950949            viaNode = (Node) via;
    951950            if(!fromWay.isFirstLastNode(viaNode))
    952951                return;
    953         }
    954         else
    955         {
     952        } else {
    956953            Way viaWay = (Way) via;
    957954            Node firstNode = viaWay.firstNode();
     
    960957
    961958            String onewayviastr = viaWay.get("oneway");
    962             if(onewayviastr != null)
    963             {
     959            if(onewayviastr != null) {
    964960                if("-1".equals(onewayviastr)) {
    965961                    onewayvia = true;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java

    r7005 r8342  
    189189                errors.add(new TestError(this, Severity.ERROR, tr("Unordered coastline"),
    190190                        UNORDERED_COASTLINE, primitives, highlight));
    191             }
    192             else if (reversed) {
     191            } else if (reversed) {
    193192                errors.add(new TestError(this, Severity.ERROR, tr("Reversed coastline"),
    194193                        REVERSED_COASTLINE, primitives));
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java

    r7005 r8342  
    132132                            type = OVERLAPPING_WAY_AREA;
    133133                        }
    134                     }
    135                     else if (highway == ways) {
     134                    } else if (highway == ways) {
    136135                        errortype = tr("Overlapping highways");
    137136                        type = OVERLAPPING_HIGHWAY;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r8338 r8342  
    323323                errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,
    324324                        tr(s, keyname), MessageFormat.format(s, keyname), ROLE_MISSING, n));
    325             }
    326             else if (vc > count) {
     325            } else if (vc > count) {
    327326                String s = marktr("Number of {0} roles too low ({1})");
    328327                errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r8126 r8342  
    168168                        before street for better visibility */
    169169                            n =  tr("House number {0} at {1}", s, t);
    170                         }
    171                         else {
     170                        } else {
    172171                            /* I18n: house number as parameter */
    173172                            n = tr("House number {0}", s);
     
    267266                        before street for better visibility */
    268267                            n =  tr("House number {0} at {1}", s, t);
    269                         }
    270                         else {
     268                        } else {
    271269                            /* I18n: house number as parameter */
    272270                            n = tr("House number {0}", s);
  • trunk/src/org/openstreetmap/josm/gui/FileDrop.java

    r8290 r8342  
    3434import org.openstreetmap.josm.Main;
    3535import org.openstreetmap.josm.actions.OpenFileAction;
     36import org.openstreetmap.josm.gui.FileDrop.TransferableObject;
    3637
    3738/**
     
    7576 * @since 1231
    7677 */
    77 public class FileDrop
    78 {
     78public class FileDrop {
     79
    7980    private Border normalBorder;
    8081    private DropTargetListener dropListener;
     
    123124            final Border dragBorder,
    124125            final boolean recursive,
    125             final Listener listener)
    126     {
    127 
    128         if( supportsDnD() )
    129         {   // Make a drop listener
    130             dropListener = new DropTargetListener()
    131             {   @Override
    132                 public void dragEnter( DropTargetDragEvent evt )
    133             {       Main.trace("FileDrop: dragEnter event." );
    134 
    135             // Is this an acceptable drag event?
    136             if( isDragOk( evt ) )
    137             {
    138                 // If it's a Swing component, set its border
    139                 if( c instanceof JComponent )
    140                 {   JComponent jc = (JComponent) c;
    141                 normalBorder = jc.getBorder();
    142                 Main.trace("FileDrop: normal border saved." );
    143                 jc.setBorder( dragBorder );
    144                 Main.trace("FileDrop: drag border set." );
    145                 }   // end if: JComponent
    146 
    147                 // Acknowledge that it's okay to enter
    148                 evt.acceptDrag( DnDConstants.ACTION_COPY );
    149                 Main.trace("FileDrop: event accepted." );
    150             }   // end if: drag ok
    151             else
    152             {   // Reject the drag event
    153                 evt.rejectDrag();
    154                 Main.trace("FileDrop: event rejected." );
    155             }   // end else: drag not ok
    156             }   // end dragEnter
    157 
    158             @Override
    159             public void dragOver( DropTargetDragEvent evt )
    160             {   // This is called continually as long as the mouse is
    161                 // over the drag target.
    162             }   // end dragOver
    163 
    164             @Override
    165             public void drop( DropTargetDropEvent evt )
    166             {   Main.trace("FileDrop: drop event." );
    167             try
    168             {   // Get whatever was dropped
    169                 Transferable tr = evt.getTransferable();
    170 
    171                 // Is it a file list?
    172                 if (tr.isDataFlavorSupported (DataFlavor.javaFileListFlavor))
    173                 {
    174                     // Say we'll take it.
    175                     evt.acceptDrop ( DnDConstants.ACTION_COPY );
    176                     Main.trace("FileDrop: file list accepted." );
    177 
    178                     // Get a useful list
    179                     List<?> fileList = (List<?>)tr.getTransferData(DataFlavor.javaFileListFlavor);
    180 
    181                     // Convert list to array
    182                     final File[] files = fileList.toArray(new File[fileList.size()]);
    183 
    184                     // Alert listener to drop.
    185                     if( listener != null ) {
    186                         listener.filesDropped( files );
     126            final Listener listener) {
     127
     128        if( supportsDnD() ) {
     129            // Make a drop listener
     130            dropListener = new DropTargetListener() {
     131                @Override
     132                public void dragEnter( DropTargetDragEvent evt ) {
     133                    Main.trace("FileDrop: dragEnter event." );
     134
     135                    // Is this an acceptable drag event?
     136                    if( isDragOk( evt ) ) {
     137                        // If it's a Swing component, set its border
     138                        if( c instanceof JComponent ) {
     139                           JComponent jc = (JComponent) c;
     140                            normalBorder = jc.getBorder();
     141                            Main.trace("FileDrop: normal border saved." );
     142                            jc.setBorder( dragBorder );
     143                            Main.trace("FileDrop: drag border set." );
     144                        }
     145
     146                        // Acknowledge that it's okay to enter
     147                        evt.acceptDrag( DnDConstants.ACTION_COPY );
     148                        Main.trace("FileDrop: event accepted." );
     149                    } else {
     150                        // Reject the drag event
     151                        evt.rejectDrag();
     152                        Main.trace("FileDrop: event rejected." );
    187153                    }
    188 
    189                     // Mark that drop is completed.
    190                     evt.getDropTargetContext().dropComplete(true);
    191                     Main.trace("FileDrop: drop complete." );
    192                 }   // end if: file list
    193                 else // this section will check for a reader flavor.
    194                 {
    195                     // Thanks, Nathan!
    196                     // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
    197                     DataFlavor[] flavors = tr.getTransferDataFlavors();
    198                     boolean handled = false;
    199                     for (DataFlavor flavor : flavors) {
    200                         if (flavor.isRepresentationClassReader()) {
     154                }
     155
     156                @Override
     157                public void dragOver( DropTargetDragEvent evt ) {
     158                    // This is called continually as long as the mouse is over the drag target.
     159                }
     160
     161                @Override
     162                public void drop( DropTargetDropEvent evt ) {
     163                   Main.trace("FileDrop: drop event." );
     164                    try {
     165                        // Get whatever was dropped
     166                        Transferable tr = evt.getTransferable();
     167
     168                        // Is it a file list?
     169                        if (tr.isDataFlavorSupported (DataFlavor.javaFileListFlavor)) {
     170
    201171                            // Say we'll take it.
    202                             evt.acceptDrop(DnDConstants.ACTION_COPY);
    203                             Main.trace("FileDrop: reader accepted.");
    204 
    205                             Reader reader = flavor.getReaderForText(tr);
    206 
    207                             BufferedReader br = new BufferedReader(reader);
    208 
    209                             if (listener != null) {
    210                                 listener.filesDropped(createFileArray(br));
     172                            evt.acceptDrop ( DnDConstants.ACTION_COPY );
     173                            Main.trace("FileDrop: file list accepted." );
     174
     175                            // Get a useful list
     176                            List<?> fileList = (List<?>)tr.getTransferData(DataFlavor.javaFileListFlavor);
     177
     178                            // Convert list to array
     179                            final File[] files = fileList.toArray(new File[fileList.size()]);
     180
     181                            // Alert listener to drop.
     182                            if( listener != null ) {
     183                                listener.filesDropped( files );
    211184                            }
    212185
    213186                            // Mark that drop is completed.
    214187                            evt.getDropTargetContext().dropComplete(true);
    215                             Main.trace("FileDrop: drop complete.");
    216                             handled = true;
    217                             break;
     188                            Main.trace("FileDrop: drop complete." );
     189                        } else {
     190                            // this section will check for a reader flavor.
     191                            // Thanks, Nathan!
     192                            // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
     193                            DataFlavor[] flavors = tr.getTransferDataFlavors();
     194                            boolean handled = false;
     195                            for (DataFlavor flavor : flavors) {
     196                                if (flavor.isRepresentationClassReader()) {
     197                                    // Say we'll take it.
     198                                    evt.acceptDrop(DnDConstants.ACTION_COPY);
     199                                    Main.trace("FileDrop: reader accepted.");
     200
     201                                    Reader reader = flavor.getReaderForText(tr);
     202
     203                                    BufferedReader br = new BufferedReader(reader);
     204
     205                                    if (listener != null) {
     206                                        listener.filesDropped(createFileArray(br));
     207                                    }
     208
     209                                    // Mark that drop is completed.
     210                                    evt.getDropTargetContext().dropComplete(true);
     211                                    Main.trace("FileDrop: drop complete.");
     212                                    handled = true;
     213                                    break;
     214                                }
     215                            }
     216                            if(!handled){
     217                                Main.trace("FileDrop: not a file list or reader - abort." );
     218                                evt.rejectDrop();
     219                            }
     220                            // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
     221                        }
     222                    } catch (IOException | UnsupportedFlavorException e) {
     223                        Main.warn("FileDrop: "+e.getClass().getSimpleName()+" - abort:" );
     224                        Main.error(e);
     225                        try {
     226                            evt.rejectDrop();
     227                        } catch (InvalidDnDOperationException ex) {
     228                            // Catch InvalidDnDOperationException to fix #11259
     229                            Main.error(ex);
     230                        }
     231                    } finally {
     232                        // If it's a Swing component, reset its border
     233                        if( c instanceof JComponent ) {
     234                           JComponent jc = (JComponent) c;
     235                            jc.setBorder( normalBorder );
     236                            Main.debug("FileDrop: normal border restored." );
    218237                        }
    219238                    }
    220                     if(!handled){
    221                         Main.trace("FileDrop: not a file list or reader - abort." );
    222                         evt.rejectDrop();
     239                }
     240
     241                @Override
     242                public void dragExit( DropTargetEvent evt ) {
     243                    Main.debug("FileDrop: dragExit event." );
     244                    // If it's a Swing component, reset its border
     245                    if( c instanceof JComponent ) {
     246                       JComponent jc = (JComponent) c;
     247                        jc.setBorder( normalBorder );
     248                        Main.debug("FileDrop: normal border restored." );
    223249                    }
    224                     // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
    225                 }   // end else: not a file list
    226             }   // end try
    227             catch (IOException | UnsupportedFlavorException e) {
    228                 Main.warn("FileDrop: "+e.getClass().getSimpleName()+" - abort:" );
    229                 Main.error(e);
    230                 try {
    231                     evt.rejectDrop();
    232                 } catch (InvalidDnDOperationException ex) {
    233                     // Catch InvalidDnDOperationException to fix #11259
    234                     Main.error(ex);
    235                 }
    236             } finally {
    237                 // If it's a Swing component, reset its border
    238                 if( c instanceof JComponent )
    239                 {   JComponent jc = (JComponent) c;
    240                 jc.setBorder( normalBorder );
    241                 Main.debug("FileDrop: normal border restored." );
    242                 }   // end if: JComponent
    243             }   // end finally
    244             }   // end drop
    245 
    246             @Override
    247             public void dragExit( DropTargetEvent evt )
    248             {   Main.debug("FileDrop: dragExit event." );
    249             // If it's a Swing component, reset its border
    250             if( c instanceof JComponent )
    251             {   JComponent jc = (JComponent) c;
    252             jc.setBorder( normalBorder );
    253             Main.debug("FileDrop: normal border restored." );
    254             }   // end if: JComponent
    255             }   // end dragExit
    256 
    257             @Override
    258             public void dropActionChanged( DropTargetDragEvent evt )
    259             {   Main.debug("FileDrop: dropActionChanged event." );
    260             // Is this an acceptable drag event?
    261             if( isDragOk( evt ) )
    262             {
    263                 evt.acceptDrag( DnDConstants.ACTION_COPY );
    264                 Main.debug("FileDrop: event accepted." );
    265             }   // end if: drag ok
    266             else
    267             {   evt.rejectDrag();
    268             Main.debug("FileDrop: event rejected." );
    269             }   // end else: drag not ok
    270             }   // end dropActionChanged
    271             }; // end DropTargetListener
     250                }
     251
     252                @Override
     253                public void dropActionChanged( DropTargetDragEvent evt ) {
     254                    Main.debug("FileDrop: dropActionChanged event." );
     255                    // Is this an acceptable drag event?
     256                    if( isDragOk( evt ) ) {
     257                        evt.acceptDrag( DnDConstants.ACTION_COPY );
     258                        Main.debug("FileDrop: event accepted." );
     259                    } else {
     260                        evt.rejectDrag();
     261                        Main.debug("FileDrop: event rejected." );
     262                    }
     263                }
     264            };
    272265
    273266            // Make the component (and possibly children) drop targets
    274267            makeDropTarget( c, recursive );
    275         }   // end if: supports dnd
    276         else
    277         {   Main.info("FileDrop: Drag and drop is not supported with this JVM" );
    278         }   // end else: does not support DnD
    279     }   // end constructor
    280 
    281     private static synchronized boolean supportsDnD()
    282     {   // Static Boolean
    283         if( supportsDnD == null )
    284         {
     268        } else {
     269            Main.info("FileDrop: Drag and drop is not supported with this JVM" );
     270        }
     271    }
     272
     273    private static synchronized boolean supportsDnD() {
     274        if( supportsDnD == null ) {
    285275            boolean support = false;
    286276            try {
     
    291281            }
    292282            supportsDnD = support;
    293         }   // end if: first time through
     283        }
    294284        return supportsDnD.booleanValue();
    295     }   // end supportsDnD
     285    }
    296286
    297287    // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
    298288    private static final String ZERO_CHAR_STRING = "" + (char)0;
    299     private static File[] createFileArray(BufferedReader bReader)
    300     {
     289    private static File[] createFileArray(BufferedReader bReader) {
    301290        try {
    302291            List<File> list = new ArrayList<>();
     
    324313    // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
    325314
    326     private void makeDropTarget( final Component c, boolean recursive )
    327     {
     315    private void makeDropTarget( final Component c, boolean recursive ) {
    328316        // Make drop target
    329317        final DropTarget dt = new DropTarget();
    330         try
    331         {   dt.addDropTargetListener( dropListener );
    332         }   // end try
    333         catch( TooManyListenersException e )
    334         {   Main.error(e);
    335         Main.warn("FileDrop: Drop will not work due to previous error. Do you have another listener attached?" );
    336         }   // end catch
     318        try {
     319            dt.addDropTargetListener( dropListener );
     320        } catch( TooManyListenersException e ) {
     321            Main.error(e);
     322            Main.warn("FileDrop: Drop will not work due to previous error. Do you have another listener attached?" );
     323        }
    337324
    338325        // Listen for hierarchy changes and remove the drop target when the parent gets cleared out.
    339         c.addHierarchyListener( new HierarchyListener()
    340         {   @Override
    341             public void hierarchyChanged( HierarchyEvent evt )
    342         {   Main.trace("FileDrop: Hierarchy changed." );
    343         Component parent = c.getParent();
    344         if( parent == null )
    345         {   c.setDropTarget( null );
    346         Main.trace("FileDrop: Drop target cleared from component." );
    347         }   // end if: null parent
    348         else
    349         {   new DropTarget(c, dropListener);
    350         Main.trace("FileDrop: Drop target added to component." );
    351         }   // end else: parent not null
    352         }   // end hierarchyChanged
    353         }); // end hierarchy listener
     326        c.addHierarchyListener( new HierarchyListener() {
     327            @Override
     328            public void hierarchyChanged( HierarchyEvent evt ) {
     329                Main.trace("FileDrop: Hierarchy changed." );
     330                Component parent = c.getParent();
     331                if( parent == null ) {
     332                    c.setDropTarget( null );
     333                    Main.trace("FileDrop: Drop target cleared from component." );
     334                } else {
     335                    new DropTarget(c, dropListener);
     336                    Main.trace("FileDrop: Drop target added to component." );
     337                }
     338            }
     339        });
    354340        if( c.getParent() != null ) {
    355341            new DropTarget(c, dropListener);
    356342        }
    357343
    358         if( recursive && (c instanceof Container ) )
    359         {
     344        if( recursive && (c instanceof Container ) ) {
    360345            // Get the container
    361346            Container cont = (Container) c;
     
    368353                makeDropTarget( comp, recursive);
    369354            }
    370         }   // end if: recursively set components as listener
    371     }   // end dropListener
     355        }
     356    }
    372357
    373358    /** Determine if the dragged data is a file list. */
    374     private boolean isDragOk( final DropTargetDragEvent evt )
    375     {   boolean ok = false;
    376 
    377     // Get data flavors being dragged
    378     DataFlavor[] flavors = evt.getCurrentDataFlavors();
    379 
    380     // See if any of the flavors are a file list
    381     int i = 0;
    382     while( !ok && i < flavors.length )
    383     {
    384         // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
    385         // Is the flavor a file list?
    386         final DataFlavor curFlavor = flavors[i];
    387         if( curFlavor.equals( DataFlavor.javaFileListFlavor ) ||
    388                 curFlavor.isRepresentationClassReader()){
    389             ok = true;
    390         }
    391         // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
    392         i++;
    393     }   // end while: through flavors
    394 
    395     // show data flavors
    396     if( flavors.length == 0 ) {
    397         Main.trace("FileDrop: no data flavors." );
    398     }
    399     for( i = 0; i < flavors.length; i++ ) {
    400         Main.trace(flavors[i].toString() );
    401     }
    402 
    403     return ok;
    404     }   // end isDragOk
     359    private boolean isDragOk( final DropTargetDragEvent evt ) {
     360        boolean ok = false;
     361
     362        // Get data flavors being dragged
     363        DataFlavor[] flavors = evt.getCurrentDataFlavors();
     364
     365        // See if any of the flavors are a file list
     366        int i = 0;
     367        while( !ok && i < flavors.length ) {
     368            // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
     369            // Is the flavor a file list?
     370            final DataFlavor curFlavor = flavors[i];
     371            if( curFlavor.equals( DataFlavor.javaFileListFlavor ) ||
     372                    curFlavor.isRepresentationClassReader()){
     373                ok = true;
     374            }
     375            // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
     376            i++;
     377        }
     378
     379        // show data flavors
     380        if( flavors.length == 0 ) {
     381            Main.trace("FileDrop: no data flavors." );
     382        }
     383        for( i = 0; i < flavors.length; i++ ) {
     384            Main.trace(flavors[i].toString() );
     385        }
     386
     387        return ok;
     388    }
    405389
    406390    /**
     
    414398     * @return {@code true} if at least one item has been removed, {@code false} otherwise
    415399     */
    416     public static boolean remove( Component c)
    417     {   return remove( c, true );
    418     }   // end remove
     400    public static boolean remove( Component c) {
     401        return remove( c, true );
     402    }
    419403
    420404    /**
     
    427411     * @return {@code true} if at least one item has been removed, {@code false} otherwise
    428412     */
    429     public static boolean remove( Component c, boolean recursive )
    430     {   // Make sure we support dnd.
     413    public static boolean remove( Component c, boolean recursive ) {
     414        // Make sure we support dnd.
    431415        if (supportsDnD()) {
    432416            Main.trace("FileDrop: Removing drag-and-drop hooks.");
     
    437421                }
    438422                return true;
    439             }   // end if: recursive
    440             else return false;
    441         }   // end if: supports DnD
    442         else return false;
    443     }   // end remove
     423            } else
     424                return false;
     425        } else
     426            return false;
     427    }
    444428
    445429    /* ********  I N N E R   I N T E R F A C E   L I S T E N E R  ******** */
     
    466450         */
    467451        public abstract void filesDropped( File[] files );
    468 
    469     }   // end inner-interface Listener
     452    }
    470453
    471454    /* ********  I N N E R   C L A S S  ******** */
     
    545528         * @param data The data to transfer
    546529         */
    547         public TransferableObject( Object data )
    548         {   this.data = data;
     530        public TransferableObject( Object data ) {
     531            this.data = data;
    549532            this.customFlavor = new DataFlavor( data.getClass(), MIME_TYPE );
    550         }   // end constructor
     533        }
    551534
    552535        /**
     
    559542         * @param fetcher The {@link Fetcher} that will return the data object
    560543         */
    561         public TransferableObject( Fetcher fetcher )
    562         {   this.fetcher = fetcher;
    563         }   // end constructor
     544        public TransferableObject( Fetcher fetcher ) {
     545            this.fetcher = fetcher;
     546        }
    564547
    565548        /**
     
    575558         * @param fetcher The {@link Fetcher} that will return the data object
    576559         */
    577         public TransferableObject(Class<?> dataClass, Fetcher fetcher )
    578         {   this.fetcher = fetcher;
    579         this.customFlavor = new DataFlavor( dataClass, MIME_TYPE );
    580         }   // end constructor
     560        public TransferableObject(Class<?> dataClass, Fetcher fetcher ) {
     561            this.fetcher = fetcher;
     562            this.customFlavor = new DataFlavor( dataClass, MIME_TYPE );
     563        }
    581564
    582565        /**
     
    587570         * @return The custom data flavor for the encapsulated object
    588571         */
    589         public DataFlavor getCustomDataFlavor()
    590         {   return customFlavor;
    591         }   // end getCustomDataFlavor
     572        public DataFlavor getCustomDataFlavor() {
     573            return customFlavor;
     574        }
    592575
    593576        /* ********  T R A N S F E R A B L E   M E T H O D S  ******** */
     
    603586         */
    604587        @Override
    605         public DataFlavor[] getTransferDataFlavors()
    606         {
     588        public DataFlavor[] getTransferDataFlavors() {
    607589            if( customFlavor != null )
    608                 return new DataFlavor[]
    609                                                             {   customFlavor,
     590                return new DataFlavor[] {
     591                    customFlavor,
    610592                    DATA_FLAVOR,
    611                     DataFlavor.stringFlavor
    612                                                             };  // end flavors array
     593                    DataFlavor.stringFlavor};
    613594            else
    614                 return new DataFlavor[]
    615                                                             {   DATA_FLAVOR,
    616                     DataFlavor.stringFlavor
    617                                                             };  // end flavors array
    618         }   // end getTransferDataFlavors
     595                return new DataFlavor[] {
     596                    DATA_FLAVOR,
     597                    DataFlavor.stringFlavor};
     598        }
    619599
    620600        /**
     
    630610        @Override
    631611        public Object getTransferData( DataFlavor flavor )
    632         throws UnsupportedFlavorException, IOException
    633         {
     612        throws UnsupportedFlavorException, IOException {
    634613            // Native object
    635614            if( flavor.equals( DATA_FLAVOR ) )
     
    640619                return fetcher == null ? data.toString() : fetcher.getObject().toString();
    641620
    642                 // We can't do anything else
    643                 throw new UnsupportedFlavorException(flavor);
    644         }   // end getTransferData
     621            // We can't do anything else
     622            throw new UnsupportedFlavorException(flavor);
     623        }
    645624
    646625        /**
     
    652631         */
    653632        @Override
    654         public boolean isDataFlavorSupported( DataFlavor flavor )
    655         {
     633        public boolean isDataFlavorSupported( DataFlavor flavor ) {
    656634            // Native object
    657635            if( flavor.equals( DATA_FLAVOR ) )
     
    664642            // We can't do anything else
    665643            return false;
    666         }   // end isDataFlavorSupported
     644        }
    667645
    668646        /* ********  I N N E R   I N T E R F A C E   F E T C H E R  ******** */
     
    678656         * @author Robert Harder
    679657         */
    680         public static interface Fetcher
    681         {
     658        public static interface Fetcher {
    682659            /**
    683660             * Return the object being encapsulated in the
     
    687664             */
    688665            public abstract Object getObject();
    689         }   // end inner interface Fetcher
    690 
    691     }   // end class TransferableObject
    692 
    693 }   // end class FileDrop
     666        }
     667    }
     668}
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r8338 r8342  
    432432        double lat = cl.lat();
    433433        double lon = cl.lon();
    434         if(lat < b.getMinLat()) {changed = true; lat = b.getMinLat(); }
    435         else if(lat > b.getMaxLat()) {changed = true; lat = b.getMaxLat(); }
    436         if(lon < b.getMinLon()) {changed = true; lon = b.getMinLon(); }
    437         else if(lon > b.getMaxLon()) {changed = true; lon = b.getMaxLon(); }
     434        if(lat < b.getMinLat()) {changed = true; lat = b.getMinLat();
     435        } else if(lat > b.getMaxLat()) {changed = true; lat = b.getMaxLat(); }
     436        if(lon < b.getMinLon()) {changed = true; lon = b.getMinLon();
     437        } else if(lon > b.getMaxLon()) {changed = true; lon = b.getMaxLon(); }
    438438        if(changed) {
    439439            newCenter = Projections.project(new LatLon(lat,lon));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java

    r8308 r8342  
    137137                p.add(dlg, 0);
    138138                p.setVisible(true);
    139             }
    140             else if (dlg.isDialogInCollapsedView()) {
     139            } else if (dlg.isDialogInCollapsedView()) {
    141140                p.add(dlg, 0);
    142141                p.setVisible(true);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r8308 r8342  
    399399            setMinimumSize(new Dimension(Integer.MAX_VALUE,20));
    400400            titleBar.lblMinimized.setIcon(ImageProvider.get("misc", "minimized"));
    401         }
    402         else throw new IllegalStateException();
     401        } else
     402            throw new IllegalStateException();
    403403    }
    404404
     
    413413            setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    414414            titleBar.lblMinimized.setIcon(ImageProvider.get("misc", "normal"));
    415         }
    416         else throw new IllegalStateException();
     415        } else
     416            throw new IllegalStateException();
    417417    }
    418418
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r8338 r8342  
    791791                    tagTable.clearSelection();
    792792                }
    793             }
    794             // double click, edit or add tag
    795             else if (e.getSource() == tagTable) {
     793            } else if (e.getSource() == tagTable) {
     794                // double click, edit or add tag
    796795                int row = tagTable.rowAtPoint(e.getPoint());
    797796                if (row > -1) {
     
    807806                    editMembership(row);
    808807                }
    809             }
    810             else {
     808            } else {
    811809                editHelper.addTag();
    812810                btnAdd.requestFocusInWindow();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRenderer.java

    r8308 r8342  
    7979                g.drawImage(corners,xoff+xloop-2,y1-3,xoff+xloop+1,y1, 2,0,5,3, new Color(0,0,0,0), null);
    8080                g.drawLine(xoff+3,y1-3,xoff+xloop-3,y1-3);
    81             }
    82             else {
     81            } else {
    8382                g.setColor(Color.red);
    8483                if(value.isOnewayHead) {
     
    107106                g.drawImage(corners,xoff+xloop-2,y2+1,xoff+xloop+1,y2+4, 2,2,5,5, new Color(0,0,0,0), null);
    108107                g.drawLine(xoff+3-1,y2+3,xoff+xloop-3,y2+3);
    109             }
    110             else {
     108            } else {
    111109                g.setColor(Color.red);
    112110                if(value.isOnewayTail) {
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java

    r8338 r8342  
    162162                try {
    163163                    bookmarks.add(new Bookmark(entry));
    164                 }
    165                 catch (Exception e) {
     164                } catch (Exception e) {
    166165                    Main.error(tr("Error reading bookmark entry: %s", e.getMessage()));
    167166                }
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java

    r8308 r8342  
    381381            );
    382382            boundingBoxChanged(currentBounds,null);
    383         }
    384         else {
     383        } else {
    385384            Bounds bounds = getSavedDownloadBounds();
    386385            if (bounds != null) {
  • trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java

    r7509 r8342  
    6060            Dimension iScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
    6161
    62             // enlarge
    63             if(iDownloadDialogDimension == null) {
    64                 // make the each dimension 90% of the absolute display size
     62            if (iDownloadDialogDimension == null) {
     63                // enlarge: make the each dimension 90% of the absolute display size
    6564                w = iScreenSize.width * 90 / 100;
    6665                h = iScreenSize.height * 90 / 100;
    6766                iDownloadDialogDimension = iGui.getSize();
    68             }
    69             // shrink
    70             else {
    71                 // set the size back to the initial dimensions
     67            } else {
     68                // shrink: set the size back to the initial dimensions
    7269                w = iDownloadDialogDimension.width;
    7370                h = iDownloadDialogDimension.height;
  • trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java

    r7299 r8342  
    320320        if (e instanceof OsmApiException) {
    321321            OsmApiException ex = (OsmApiException)e;
    322             // There was an upload conflict. Let the user decide whether
    323             // and how to resolve it
    324             //
    325322            if(ex.getResponseCode() == HttpURLConnection.HTTP_CONFLICT) {
     323                // There was an upload conflict. Let the user decide whether and how to resolve it
    326324                handleUploadConflict(ex);
    327325                return;
     326            } else if (ex.getResponseCode() == HttpURLConnection.HTTP_PRECON_FAILED) {
     327                // There was a precondition failed. Notify the user.
     328                handlePreconditionFailed(ex);
     329                return;
     330            } else if (ex.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
     331                // Tried to update or delete a primitive which never existed on the server?
     332                ExceptionDialogUtil.explainNotFound(ex);
     333                return;
    328334            }
    329             // There was a precondition failed. Notify the user.
    330             //
    331             else if (ex.getResponseCode() == HttpURLConnection.HTTP_PRECON_FAILED) {
    332                 handlePreconditionFailed(ex);
    333                 return;
    334             }
    335             // Tried to update or delete a primitive which never existed on
    336             // the server?
    337             //
    338             else if (ex.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
    339                 ExceptionDialogUtil.explainNotFound(ex);
    340                 return;
    341             }
    342335        }
    343336
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r8318 r8342  
    499499                            tempG.drawImage(e.thumbnail, target.x, target.y, target.width, target.height, null);
    500500                        }
    501                     }
    502                     else { // thumbnail not loaded yet
     501                    } else { // thumbnail not loaded yet
    503502                        icon.paintIcon(mv, tempG,
    504503                                p.x - icon.getIconWidth() / 2,
     
    509508            }
    510509            g.drawImage(offscreenBuffer, 0, 0, null);
    511         }
    512         else {
     510        } else {
    513511            for (ImageEntry e : data) {
    514512                if (e.getPos() == null) {
     
    534532                    imgWidth = d.width;
    535533                    imgHeight = d.height;
    536                 }
    537                 else {
     534                } else {
    538535                    imgWidth = selectedIcon.getIconWidth();
    539536                    imgHeight = selectedIcon.getIconHeight();
     
    694691                cal.set(Calendar.MONTH, Integer.parseInt(dateStampComps[1]) - 1);
    695692                cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dateStampComps[2]));
    696             }
    697             else {
     693            } else {
    698694                // No GPS date stamp in EXIF data. Copy it from EXIF time.
    699695                // Date is not set if EXIF time is not available.
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java

    r7673 r8342  
    212212                    }
    213213                    return new Marker(wpt.getCoor(), wpt, symbolName, parentLayer, time, offset);
    214                 }
    215                 else if (url.toString().endsWith(".wav")) {
     214                } else if (url.toString().endsWith(".wav")) {
    216215                    AudioMarker audioMarker = new AudioMarker(wpt.getCoor(), wpt, url, parentLayer, time, offset);
    217216                    Extensions exts = (Extensions) wpt.get(GpxConstants.META_EXTENSIONS);
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r8308 r8342  
    421421                        return previousMarker;
    422422                    }
    423                 }
    424                 else if (marker.getClass() == AudioMarker.class)
    425                 {
     423                } else if (marker.getClass() == AudioMarker.class) {
    426424                    if(nextTime || startMarker == null)
    427425                        return marker;
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java

    r8126 r8342  
    103103        wasPlaying = AudioPlayer.playing();
    104104        if (wasPlaying) {
    105             try { AudioPlayer.pause(); }
    106             catch (Exception ex) { AudioPlayer.audioMalfunction(ex);}
     105            try { AudioPlayer.pause();
     106            } catch (Exception ex) { AudioPlayer.audioMalfunction(ex);}
    107107        }
    108108    }
     
    113113    private void endDrag(boolean reset) {
    114114        if (! wasPlaying || reset) {
    115             try { AudioPlayer.pause(); }
    116             catch (Exception ex) { AudioPlayer.audioMalfunction(ex);}
     115            try { AudioPlayer.pause();
     116            } catch (Exception ex) { AudioPlayer.audioMalfunction(ex);}
    117117        }
    118118        if (reset) {
     
    243243                    );
    244244            endDrag(true);
    245         }
    246         else if (recent.parentLayer.synchronizeAudioMarkers(ca)) {
     245        } else if (recent.parentLayer.synchronizeAudioMarkers(ca)) {
    247246            JOptionPane.showMessageDialog(
    248247                    Main.parent,
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r8133 r8342  
    274274            }
    275275            return p;
    276         }
    277         else if (osm instanceof Relation)
    278         {
     276        } else if (osm instanceof Relation) {
    279277            Pair<StyleList, Range> p = generateStyles(osm, scale, true);
    280278            if (drawMultipolygon && ((Relation)osm).isMultipolygon()) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java

    r8318 r8342  
    170170                throw new AssertionError("the new range must be within a subrange that has no data");
    171171
    172             //  --|-------|--------|--
    173             //   i-1      i       i+1
    174             //            (--------]
    175172            if (bd.get(i+1) == upper) {
     173                //  --|-------|--------|--
     174                //   i-1      i       i+1
     175                //            (--------]
    176176                data.set(i, sl);
    177             }
    178             //  --|-------|--------|--
    179             //   i-1      i       i+1
    180             //            (-----]
    181             else {
     177            } else {
     178                //  --|-------|--------|--
     179                //   i-1      i       i+1
     180                //            (-----]
    182181                bd.add(i+1, upper);
    183182                data.add(i, sl);
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r8285 r8342  
    394394                        }
    395395                    }
    396                 }
    397                 else if (e.osm instanceof Relation) {
     396                } else if (e.osm instanceof Relation) {
    398397                    List<RelationMember> members = ((Relation) e.osm).getMembers();
    399398                    for (int i=0; i<members.size(); i++) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java

    r8338 r8342  
    269269
    270270    public void add(XmlCondition c, Collection<XmlCondition> conditions, Prototype prot) {
    271          if(conditions != null)
    272          {
     271         if(conditions != null) {
    273272            prot.conditions = conditions;
    274273            if (prot instanceof IconPrototype) {
     
    282281            } else
    283282                throw new RuntimeException();
    284          }
    285          else {
     283         } else {
    286284             String key = c.getKey();
    287285            prot.code = key;
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r8338 r8342  
    614614                        comp.setText(tr("Separator"));
    615615                        comp.setIcon(ImageProvider.get("preferences/separator"));
    616                     }
    617                     else if (node.getUserObject() instanceof Action) {
     616                    } else if (node.getUserObject() instanceof Action) {
    618617                        Action action = (Action) node.getUserObject();
    619618                        comp.setText((String) action.getValue(Action.NAME));
     
    783782                        if (obj == null) {
    784783                            dragActions.add(ActionDefinition.getSeparator());
    785                         }
    786                         else if (obj instanceof Action) {
     784                        } else if (obj instanceof Action) {
    787785                            dragActions.add(new ActionDefinition((Action) obj));
    788786                        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/DrawingPreference.java

    r6764 r8342  
    190190                vn = 8;
    191191            }
    192         }
    193         else {
     192        } else {
    194193            vn = 0;
    195194        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java

    r8308 r8342  
    148148                // Alert user if plugin requirements are not met
    149149                PluginHandler.checkRequiredPluginsPreconditions(PluginListPanel.this, model.getAvailablePlugins(), cb.pi, false);
    150             }
    151             // If the plugin has been unselected, was it required by other plugins still selected ?
    152             else if (!cb.isSelected()) {
     150            } else if (!cb.isSelected()) {
     151                // If the plugin has been unselected, was it required by other plugins still selected ?
    153152                Set<String> otherPlugins = new HashSet<>();
    154153                for (PluginInformation pi : model.getAvailablePlugins()) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r8338 r8342  
    648648                        // Ignore - cannot auto-increment if last was non-numeric
    649649                    }
    650                 }
    651                 else if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) {
     650                } else if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) {
    652651                    // selected osm primitives are untagged or filling default values feature is enabled
    653652                    if (!"false".equals(use_last_as_default) && LAST_VALUES.containsKey(key) && !presetInitiallyMatches) {
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r8308 r8342  
    252252            int dividerSize = getDividerSize();
    253253            return new Dimension(dividerSize, dividerSize);
    254         }
    255         else {
     254        } else {
    256255            Split split = (Split)root;
    257256            List<Node> splitChildren = split.getChildren();
     
    264263                    height = Math.max(height, size.height);
    265264                }
    266             }
    267             else {
     265            } else {
    268266                for(Node splitChild : splitChildren) {
    269267                    Dimension size = preferredNodeSize(splitChild);
     
    280278            Component child = childForNode(root);
    281279            return (child != null) ? child.getMinimumSize() : new Dimension(0, 0);
    282         }
    283         else if (root instanceof Divider) {
     280        } else if (root instanceof Divider) {
    284281            int dividerSize = getDividerSize();
    285282            return new Dimension(dividerSize, dividerSize);
    286         }
    287         else {
     283        } else {
    288284            Split split = (Split)root;
    289285            List<Node> splitChildren = split.getChildren();
     
    296292                    height = Math.max(height, size.height);
    297293                }
    298             }
    299             else {
     294            } else {
    300295                for(Node splitChild : splitChildren) {
    301296                    Dimension size = minimumNodeSize(splitChild);
     
    347342            int lastChildMaxX = lastChildBounds.x + lastChildBounds.width;
    348343            splitBounds.add(lastChildMaxX, bounds.y + bounds.height);
    349         }
    350         else {
     344        } else {
    351345            int lastChildMaxY = lastChildBounds.y + lastChildBounds.height;
    352346            splitBounds.add(bounds.x + bounds.width, lastChildMaxY);
     
    379373                (totalWeightedWidth - minWeightedWidth) > extraWidth;
    380374
    381                 while(splitChildren.hasNext()) {
    382                     Node splitChild = splitChildren.next();
    383                     Rectangle splitChildBounds = splitChild.getBounds();
    384                     double minSplitChildWidth = minimumNodeSize(splitChild).getWidth();
    385                     double splitChildWeight = (onlyShrinkWeightedComponents)
    386                     ? splitChild.getWeight()
    387                             : (splitChildBounds.getWidth() / totalWidth);
    388 
    389                     if (!splitChildren.hasNext()) {
    390                         double newWidth =  Math.max(minSplitChildWidth, bounds.getMaxX() - x);
    391                         Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, newWidth);
    392                         layout2(splitChild, newSplitChildBounds);
    393                     }
    394                     else if ((availableWidth > 0.0) && (splitChildWeight > 0.0)) {
    395                         double allocatedWidth = Math.rint(splitChildWeight * extraWidth);
    396                         double oldWidth = splitChildBounds.getWidth();
    397                         double newWidth = Math.max(minSplitChildWidth, oldWidth - allocatedWidth);
    398                         Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, newWidth);
    399                         layout2(splitChild, newSplitChildBounds);
    400                         availableWidth -= (oldWidth - splitChild.getBounds().getWidth());
    401                     }
    402                     else {
    403                         double existingWidth = splitChildBounds.getWidth();
    404                         Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, existingWidth);
    405                         layout2(splitChild, newSplitChildBounds);
    406                     }
    407                     x = splitChild.getBounds().getMaxX();
    408                 }
    409         }
    410 
    411         else {
     375            while(splitChildren.hasNext()) {
     376                Node splitChild = splitChildren.next();
     377                Rectangle splitChildBounds = splitChild.getBounds();
     378                double minSplitChildWidth = minimumNodeSize(splitChild).getWidth();
     379                double splitChildWeight = (onlyShrinkWeightedComponents)
     380                ? splitChild.getWeight()
     381                        : (splitChildBounds.getWidth() / totalWidth);
     382
     383                if (!splitChildren.hasNext()) {
     384                    double newWidth =  Math.max(minSplitChildWidth, bounds.getMaxX() - x);
     385                    Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, newWidth);
     386                    layout2(splitChild, newSplitChildBounds);
     387                } else if ((availableWidth > 0.0) && (splitChildWeight > 0.0)) {
     388                    double allocatedWidth = Math.rint(splitChildWeight * extraWidth);
     389                    double oldWidth = splitChildBounds.getWidth();
     390                    double newWidth = Math.max(minSplitChildWidth, oldWidth - allocatedWidth);
     391                    Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, newWidth);
     392                    layout2(splitChild, newSplitChildBounds);
     393                    availableWidth -= (oldWidth - splitChild.getBounds().getWidth());
     394                } else {
     395                    double existingWidth = splitChildBounds.getWidth();
     396                    Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, existingWidth);
     397                    layout2(splitChild, newSplitChildBounds);
     398                }
     399                x = splitChild.getBounds().getMaxX();
     400            }
     401        } else {
    412402            int totalHeight = 0;          // sum of the children's heights
    413403            int minWeightedHeight = 0;    // sum of the weighted childrens' min heights
     
    429419                (totalWeightedHeight - minWeightedHeight) > extraHeight;
    430420
    431                 while(splitChildren.hasNext()) {
    432                     Node splitChild = splitChildren.next();
    433                     Rectangle splitChildBounds = splitChild.getBounds();
    434                     double minSplitChildHeight = minimumNodeSize(splitChild).getHeight();
    435                     double splitChildWeight = (onlyShrinkWeightedComponents)
    436                     ? splitChild.getWeight()
    437                             : (splitChildBounds.getHeight() / totalHeight);
    438 
    439                     if (!splitChildren.hasNext()) {
    440                         double oldHeight = splitChildBounds.getHeight();
    441                         double newHeight =  Math.max(minSplitChildHeight, bounds.getMaxY() - y);
    442                         Rectangle newSplitChildBounds = boundsWithYandHeight(bounds, y, newHeight);
    443                         layout2(splitChild, newSplitChildBounds);
    444                         availableHeight -= (oldHeight - splitChild.getBounds().getHeight());
    445                     }
    446                     else if ((availableHeight > 0.0) && (splitChildWeight > 0.0)) {
    447                         double allocatedHeight = Math.rint(splitChildWeight * extraHeight);
    448                         double oldHeight = splitChildBounds.getHeight();
    449                         double newHeight = Math.max(minSplitChildHeight, oldHeight - allocatedHeight);
    450                         Rectangle newSplitChildBounds = boundsWithYandHeight(bounds, y, newHeight);
    451                         layout2(splitChild, newSplitChildBounds);
    452                         availableHeight -= (oldHeight - splitChild.getBounds().getHeight());
    453                     }
    454                     else {
    455                         double existingHeight = splitChildBounds.getHeight();
    456                         Rectangle newSplitChildBounds = boundsWithYandHeight(bounds, y, existingHeight);
    457                         layout2(splitChild, newSplitChildBounds);
    458                     }
    459                     y = splitChild.getBounds().getMaxY();
    460                 }
     421            while(splitChildren.hasNext()) {
     422                Node splitChild = splitChildren.next();
     423                Rectangle splitChildBounds = splitChild.getBounds();
     424                double minSplitChildHeight = minimumNodeSize(splitChild).getHeight();
     425                double splitChildWeight = (onlyShrinkWeightedComponents)
     426                ? splitChild.getWeight()
     427                        : (splitChildBounds.getHeight() / totalHeight);
     428
     429                if (!splitChildren.hasNext()) {
     430                    double oldHeight = splitChildBounds.getHeight();
     431                    double newHeight =  Math.max(minSplitChildHeight, bounds.getMaxY() - y);
     432                    Rectangle newSplitChildBounds = boundsWithYandHeight(bounds, y, newHeight);
     433                    layout2(splitChild, newSplitChildBounds);
     434                    availableHeight -= (oldHeight - splitChild.getBounds().getHeight());
     435                } else if ((availableHeight > 0.0) && (splitChildWeight > 0.0)) {
     436                    double allocatedHeight = Math.rint(splitChildWeight * extraHeight);
     437                    double oldHeight = splitChildBounds.getHeight();
     438                    double newHeight = Math.max(minSplitChildHeight, oldHeight - allocatedHeight);
     439                    Rectangle newSplitChildBounds = boundsWithYandHeight(bounds, y, newHeight);
     440                    layout2(splitChild, newSplitChildBounds);
     441                    availableHeight -= (oldHeight - splitChild.getBounds().getHeight());
     442                } else {
     443                    double existingHeight = splitChildBounds.getHeight();
     444                    Rectangle newSplitChildBounds = boundsWithYandHeight(bounds, y, existingHeight);
     445                    layout2(splitChild, newSplitChildBounds);
     446                }
     447                y = splitChild.getBounds().getMaxY();
     448            }
    461449        }
    462450
     
    476464        Node lastWeightedChild = split.lastWeightedChild();
    477465
    478         /* Layout the Split's child Nodes' along the X axis.  The bounds
    479          * of each child will have the same y coordinate and height as the
    480          * layoutGrow() bounds argument.  Extra width is allocated to the
    481          * to each child with a non-zero weight:
    482          *     newWidth = currentWidth + (extraWidth * splitChild.getWeight())
    483          * Any extraWidth "left over" (that's availableWidth in the loop
    484          * below) is given to the last child.  Note that Dividers always
    485          * have a weight of zero, and they're never the last child.
    486          */
    487466        if (split.isRowLayout()) {
     467            /* Layout the Split's child Nodes' along the X axis.  The bounds
     468             * of each child will have the same y coordinate and height as the
     469             * layoutGrow() bounds argument.  Extra width is allocated to the
     470             * to each child with a non-zero weight:
     471             *     newWidth = currentWidth + (extraWidth * splitChild.getWeight())
     472             * Any extraWidth "left over" (that's availableWidth in the loop
     473             * below) is given to the last child.  Note that Dividers always
     474             * have a weight of zero, and they're never the last child.
     475             */
    488476            double x = bounds.getX();
    489477            double extraWidth = bounds.getWidth() - splitBounds.getWidth();
     
    499487                    Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, newWidth);
    500488                    layout2(splitChild, newSplitChildBounds);
    501                 }
    502                 else if ((availableWidth > 0.0) && (splitChildWeight > 0.0)) {
     489                } else if ((availableWidth > 0.0) && (splitChildWeight > 0.0)) {
    503490                    double allocatedWidth = (splitChild.equals(lastWeightedChild))
    504491                    ? availableWidth
     
    508495                    layout2(splitChild, newSplitChildBounds);
    509496                    availableWidth -= allocatedWidth;
    510                 }
    511                 else {
     497                } else {
    512498                    double existingWidth = splitChildBounds.getWidth();
    513499                    Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, existingWidth);
     
    516502                x = splitChild.getBounds().getMaxX();
    517503            }
    518         }
    519 
    520         /* Layout the Split's child Nodes' along the Y axis.  The bounds
    521          * of each child will have the same x coordinate and width as the
    522          * layoutGrow() bounds argument.  Extra height is allocated to the
    523          * to each child with a non-zero weight:
    524          *     newHeight = currentHeight + (extraHeight * splitChild.getWeight())
    525          * Any extraHeight "left over" (that's availableHeight in the loop
    526          * below) is given to the last child.  Note that Dividers always
    527          * have a weight of zero, and they're never the last child.
    528          */
    529         else {
     504        } else {
     505            /* Layout the Split's child Nodes' along the Y axis.  The bounds
     506             * of each child will have the same x coordinate and width as the
     507             * layoutGrow() bounds argument.  Extra height is allocated to the
     508             * to each child with a non-zero weight:
     509             *     newHeight = currentHeight + (extraHeight * splitChild.getWeight())
     510             * Any extraHeight "left over" (that's availableHeight in the loop
     511             * below) is given to the last child.  Note that Dividers always
     512             * have a weight of zero, and they're never the last child.
     513             */
    530514            double y = bounds.getY();
    531515            double extraHeight = bounds.getMaxY() - splitBounds.getHeight();
     
    571555            }
    572556            root.setBounds(bounds);
    573         }
    574         else if (root instanceof Divider) {
     557        } else if (root instanceof Divider) {
    575558            root.setBounds(bounds);
    576         }
    577         else if (root instanceof Split) {
     559        } else if (root instanceof Split) {
    578560            Split split = (Split)root;
    579561            boolean grow = split.isRowLayout()
     
    583565                layoutGrow(split, bounds);
    584566                root.setBounds(bounds);
    585             }
    586             else {
     567            } else {
    587568                layoutShrink(split, bounds);
    588569                // split.setBounds() called in layoutShrink()
     
    608589        if (root instanceof Leaf) {
    609590            root.setBounds(bounds);
    610         }
    611         else if (root instanceof Split) {
     591        } else if (root instanceof Split) {
    612592            Split split = (Split)root;
    613593            Iterator<Node> splitChildren = split.getChildren().iterator();
     
    629609                        (splitChildren.hasNext()) ? (Divider)(splitChildren.next()) : null;
    630610
    631                         double childWidth = 0.0;
    632                         if (getFloatingDividers()) {
    633                             childWidth = preferredNodeSize(splitChild).getWidth();
     611                    double childWidth = 0.0;
     612                    if (getFloatingDividers()) {
     613                        childWidth = preferredNodeSize(splitChild).getWidth();
     614                    }
     615                    else {
     616                        if (dividerChild != null) {
     617                            childWidth = dividerChild.getBounds().getX() - x;
    634618                        }
    635619                        else {
    636                             if (dividerChild != null) {
    637                                 childWidth = dividerChild.getBounds().getX() - x;
    638                             }
    639                             else {
    640                                 childWidth = split.getBounds().getMaxX() - x;
    641                             }
     620                            childWidth = split.getBounds().getMaxX() - x;
    642621                        }
    643                         childBounds = boundsWithXandWidth(bounds, x, childWidth);
    644                         layout1(splitChild, childBounds);
    645 
    646                         if (getFloatingDividers() && (dividerChild != null)) {
    647                             double dividerX = childBounds.getMaxX();
    648                             Rectangle dividerBounds = boundsWithXandWidth(bounds, dividerX, dividerSize);
    649                             dividerChild.setBounds(dividerBounds);
    650                         }
    651                         if (dividerChild != null) {
    652                             x = dividerChild.getBounds().getMaxX();
    653                         }
    654                 }
    655             }
    656 
    657             /* Layout the Split's child Nodes' along the Y axis.  The bounds
    658              * of each child will have the same x coordinate and width as the
    659              * layout1() bounds argument.  The algorithm is identical to what's
    660              * explained above, for the X axis case.
    661              */
    662             else {
     622                    }
     623                    childBounds = boundsWithXandWidth(bounds, x, childWidth);
     624                    layout1(splitChild, childBounds);
     625
     626                    if (getFloatingDividers() && (dividerChild != null)) {
     627                        double dividerX = childBounds.getMaxX();
     628                        Rectangle dividerBounds = boundsWithXandWidth(bounds, dividerX, dividerSize);
     629                        dividerChild.setBounds(dividerBounds);
     630                    }
     631                    if (dividerChild != null) {
     632                        x = dividerChild.getBounds().getMaxX();
     633                    }
     634                }
     635            } else {
     636                /* Layout the Split's child Nodes' along the Y axis.  The bounds
     637                 * of each child will have the same x coordinate and width as the
     638                 * layout1() bounds argument.  The algorithm is identical to what's
     639                 * explained above, for the X axis case.
     640                 */
    663641                double y = bounds.getY();
    664642                while(splitChildren.hasNext()) {
     
    670648                        if (getFloatingDividers()) {
    671649                            childHeight = preferredNodeSize(splitChild).getHeight();
    672                         }
    673                         else {
     650                        } else {
    674651                            if (dividerChild != null) {
    675652                                childHeight = dividerChild.getBounds().getY() - y;
    676                             }
    677                             else {
     653                            } else {
    678654                                childHeight = split.getBounds().getMaxY() - y;
    679655                            }
     
    772748            Divider divider = (Divider)root;
    773749            return (divider.getBounds().contains(x, y)) ? divider : null;
    774         }
    775         else if (root instanceof Split) {
     750        } else if (root instanceof Split) {
    776751            Split split = (Split)root;
    777752            for(Node child : split.getChildren()) {
     
    810785                        dividers.add((Divider)child);
    811786                    }
    812                 }
    813                 else if (child instanceof Split) {
     787                } else if (child instanceof Split) {
    814788                    dividers.addAll(dividersThatOverlap(child, r));
    815789                }
     
    982956         * children are to be laid out in a row: all the same height,
    983957         * each node's left edge equal to the previous Node's right
    984          * edge.  If false, children are laid on in a column.  Default
    985          * value is true.
     958         * edge. If false, children are laid on in a column. Default value is true.
    986959         *
    987960         * @param rowLayout true for horizontal row layout, false for column
     
    1007980         * of each new child is set to this Split node, and the parent
    1008981         * of each old child (if any) is set to null.  This method
    1009          * defensively copies the incoming List.  Default value is
    1010          * an empty List.
     982         * defensively copies the incoming List. Default value is an empty List.
    1011983         *
    1012984         * @param children List of children
     
    11561128            if (st.nextToken() == StreamTokenizer.TT_NUMBER) {
    11571129                node.setWeight(st.nval);
    1158             }
    1159             else {
     1130            } else {
    11601131                throwParseException(st, "invalid weight");
    11611132            }
    1162         }
    1163         else if ("NAME".equalsIgnoreCase(name)) {
     1133        } else if ("NAME".equalsIgnoreCase(name)) {
    11641134            if (st.nextToken() == StreamTokenizer.TT_WORD) {
    11651135                if (node instanceof Leaf) {
    11661136                    ((Leaf)node).setName(st.sval);
    1167                 }
    1168                 else {
     1137                } else {
    11691138                    throwParseException(st, "can't specify name for " + node);
    11701139                }
    1171             }
    1172             else {
     1140            } else {
    11731141                throwParseException(st, "invalid name");
    11741142            }
    1175         }
    1176         else {
     1143        } else {
    11771144            throwParseException(st, "unrecognized attribute \"" + name + "\"");
    11781145        }
     
    11831150        if (children.isEmpty()) {
    11841151            children.add(child);
    1185         }
    1186         else {
     1152        } else {
    11871153            children.add(new Divider());
    11881154            children.add(child);
     
    12001166            if (token == StreamTokenizer.TT_WORD) {
    12011167                parseAttribute(st.sval, st, leaf);
    1202             }
    1203             else {
     1168            } else {
    12041169                throwParseException(st, "Bad Leaf: " + leaf);
    12051170            }
     
    12131178            if (token == ')') {
    12141179                break;
    1215             }
    1216             else if (token == StreamTokenizer.TT_WORD) {
     1180            } else if (token == StreamTokenizer.TT_WORD) {
    12171181                if ("WEIGHT".equalsIgnoreCase(st.sval)) {
    12181182                    parseAttribute(st.sval, st, parent);
    1219                 }
    1220                 else {
     1183                } else {
    12211184                    addSplitChild(parent, new Leaf(st.sval));
    12221185                }
    1223             }
    1224             else if (token == '(') {
     1186            } else if (token == '(') {
    12251187                if ((token = st.nextToken()) != StreamTokenizer.TT_WORD) {
    12261188                    throwParseException(st, "invalid node type");
     
    12291191                if ("LEAF".equals(nodeType)) {
    12301192                    parseLeaf(st, parent);
    1231                 }
    1232                 else if ("ROW".equals(nodeType) || "COLUMN".equals(nodeType)) {
     1193                } else if ("ROW".equals(nodeType) || "COLUMN".equals(nodeType)) {
    12331194                    Split split = new Split();
    12341195                    split.setRowLayout("ROW".equals(nodeType));
    12351196                    addSplitChild(parent, split);
    12361197                    parseSplit(st, split);
    1237                 }
    1238                 else {
     1198                } else {
    12391199                    throwParseException(st, "unrecognized node type '" + nodeType + "'");
    12401200                }
     
    12491209            parseSplit(st, root);
    12501210            return root.getChildren().get(0);
    1251         }
    1252         catch (Exception e) {
     1211        } catch (Exception e) {
    12531212            Main.error(e);
    1254         }
    1255         finally {
     1213        } finally {
    12561214            Utils.close(r);
    12571215        }
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitPane.java

    r8318 r8342  
    214214                    dp.paint(dpg, divider);
    215215                }
    216             }
    217             finally {
     216            } finally {
    218217                dpg.dispose();
    219218            }
     
    239238            if ((prevNode == null) || (nextNode == null)) {
    240239                dragUnderway = false;
    241             }
    242             else {
     240            } else {
    243241                initialDividerBounds = divider.getBounds();
    244242                dragOffsetX = mx - initialDividerBounds.x;
     
    251249                    dragMax = nextNodeBounds.x + nextNodeBounds.width;
    252250                    dragMax -= dragDivider.getBounds().width;
    253                 }
    254                 else {
     251                } else {
    255252                    dragMin = prevNodeBounds.y;
    256253                    dragMax = nextNodeBounds.y + nextNodeBounds.height;
     
    261258                dragUnderway = true;
    262259            }
    263         }
    264         else {
     260        } else {
    265261            dragUnderway = false;
    266262        }
     
    272268            damageR.x = dragMin;
    273269            damageR.width = dragMax - dragMin;
    274         }
    275         else {
     270        } else {
    276271            damageR.y = dragMin;
    277272            damageR.height = dragMax - dragMin;
     
    290285            bounds.x = Math.max(bounds.x, dragMin);
    291286            bounds.x = Math.min(bounds.x, dragMax);
    292         }
    293         else {
     287        } else {
    294288            bounds.y = my - dragOffsetY;
    295289            bounds.y = Math.max(bounds.y, dragMin);
     
    300294            revalidate();
    301295            repaintDragLimits();
    302         }
    303         else {
     296        } else {
    304297            repaint(oldBounds.union(bounds));
    305298        }
  • trunk/src/org/openstreetmap/josm/io/NmeaReader.java

    r7596 r8342  
    376376                    currentwp.put(GpxConstants.PT_PDOP, Float.parseFloat(accu));
    377377                }
    378             }
    379             else if("$GPRMC".equals(e[0]) || "$GNRMC".equals(e[0])) {
     378            } else if("$GPRMC".equals(e[0]) || "$GNRMC".equals(e[0])) {
    380379                // coordinates
    381380                LatLon latLon = parseLatLon(
  • trunk/src/org/openstreetmap/josm/io/OsmApiException.java

    r7205 r8342  
    130130        .append(responseCode);
    131131        String eh = "";
    132         try
    133         {
     132        try {
    134133            if(errorHeader != null)
    135134                eh = tr(errorHeader.trim());
     
    139138                .append(">");
    140139            }
    141         }
    142         catch (Exception e) {
     140        } catch (Exception e) {
    143141            // Ignored
    144142        }
    145         try
    146         {
     143        try {
    147144            String eb = errorBody != null ? tr(errorBody.trim()) : "";
    148145            if (!eb.isEmpty() && !eb.equals(eh)) {
     
    151148                .append(">");
    152149            }
    153         }
    154         catch (Exception e) {
     150        } catch (Exception e) {
    155151            // Ignored
    156152        }
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r8291 r8342  
    187187                            }
    188188                        }
    189                     }
    190                     catch(Exception e) {
     189                    } catch(Exception e) {
    191190                        errorBody.append(tr("Reading error text failed."));
    192191                    }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpServer.java

    r8340 r8342  
    55
    66import java.io.IOException;
    7 import java.net.BindException;
    87import java.net.ServerSocket;
    98import java.net.Socket;
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java

    r8341 r8342  
    77import java.io.InputStream;
    88import java.math.BigInteger;
    9 import java.net.BindException;
    109import java.net.ServerSocket;
    1110import java.net.Socket;
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r8291 r8342  
    273273                        }
    274274                    }
    275                 }
    276                 catch(Exception e) {
     275                } catch(Exception e) {
    277276                    Main.error(e);
    278277                }
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r8285 r8342  
    764764                           or until the first nonprovisional at least 8 lines in.
    765765                           Until that point, cancel any provisionals.  */
    766                         for (j = 0, consec = 0; j < length; j++)
    767                         {
     766                        for (j = 0, consec = 0; j < length; j++) {
    768767                            if (j >= 8 && discards[i + j] == 1) {
    769768                                break;
     
    771770                            if (discards[i + j] == 2) {
    772771                                consec = 0; discards[i + j] = 0;
    773                             }
    774                             else if (discards[i + j] == 0) {
     772                            } else if (discards[i + j] == 0) {
    775773                                consec = 0;
    776774                            } else {
     
    786784
    787785                        /* Same thing, from end.  */
    788                         for (j = 0, consec = 0; j < length; j++)
    789                         {
     786                        for (j = 0, consec = 0; j < length; j++) {
    790787                            if (j >= 8 && discards[i - j] == 1) {
    791788                                break;
     
    793790                            if (discards[i - j] == 2) {
    794791                                consec = 0; discards[i - j] = 0;
    795                             }
    796                             else if (discards[i - j] == 0) {
     792                            } else if (discards[i - j] == 0) {
    797793                                consec = 0;
    798794                            } else {
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r8303 r8342  
    183183                                }
    184184                            }
    185                         }
    186                         else if (test && !intersectionNodes.isEmpty())
     185                        } else if (test && !intersectionNodes.isEmpty())
    187186                            return intersectionNodes;
    188187                    }
Note: See TracChangeset for help on using the changeset viewer.