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


Ignore:
Timestamp:
2009-12-13T11:48:12+01:00 (14 years ago)
Author:
jttt
Message:

Fixed some of the warnings found by FindBugs

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

Legend:

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

    r2548 r2626  
    1919import java.text.ParsePosition;
    2020import java.util.Locale;
    21 import java.util.logging.Logger;
    2221
    2322import javax.swing.AbstractAction;
     
    5251 */
    5352public final class AddNodeAction extends JosmAction {
    54     static private final Logger logger = Logger.getLogger(AddNodeAction.class.getName());
     53    //static private final Logger logger = Logger.getLogger(AddNodeAction.class.getName());
    5554
    5655    public AddNodeAction() {
     
    311310        }
    312311
    313         class TextFieldFocusHandler implements FocusListener {
     312        static class TextFieldFocusHandler implements FocusListener {
    314313            public void focusGained(FocusEvent e) {
    315314                Component c = e.getComponent();
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r2610 r2626  
    5656    // HelperClass
    5757    // Saves a node and two positions where to insert the node into the ways
    58     private class NodeToSegs implements Comparable<NodeToSegs> {
     58    private static class NodeToSegs implements Comparable<NodeToSegs> {
    5959        public int pos;
    6060        public Node n;
     
    7171                return this.pos - o.pos;
    7272        }
     73
     74        @Override
     75        public int hashCode() {
     76            return pos;
     77        }
     78
     79        @Override
     80        public boolean equals(Object o) {
     81            if (o instanceof NodeToSegs)
     82                return compareTo((NodeToSegs) o) == 0;
     83            else
     84                return false;
     85        }
    7386    }
    7487
    7588    // HelperClass
    7689    // Saves a relation and a role an OsmPrimitve was part of until it was stripped from all relations
    77     private class RelationRole {
     90    private static class RelationRole {
    7891        public final Relation rel;
    7992        public final String role;
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r2596 r2626  
    3737public final class OrthogonalizeAction extends JosmAction {
    3838    String USAGE = "<h3>"+
    39             "When one or more ways are selected, the shape is adjusted, such that all angles are 90 or 180 degrees.<h3>"+
    40             "You can add two nodes to the selection. Then the direction is fixed by these two reference nodes.<h3>"+
    41             "(Afterwards, you can undo the movement for certain nodes:<br>"+
    42             "Select them and press the shortcut for Orthogonalize / Undo. The default is Shift-Q.)";
     39    "When one or more ways are selected, the shape is adjusted, such that all angles are 90 or 180 degrees.<h3>"+
     40    "You can add two nodes to the selection. Then the direction is fixed by these two reference nodes.<h3>"+
     41    "(Afterwards, you can undo the movement for certain nodes:<br>"+
     42    "Select them and press the shortcut for Orthogonalize / Undo. The default is Shift-Q.)";
    4343
    4444    public OrthogonalizeAction() {
     
    7272     * This action can be triggered by shortcut only.
    7373     */
    74     public class Undo extends JosmAction {
     74    public static class Undo extends JosmAction {
    7575        public Undo() {
    7676            super(tr("Orthogonalize Shape / Undo"),
    77                 "ortho",
    78                 tr("Undo orthogonalization for certain nodes"),
    79                 Shortcut.registerShortcut("tools:orthogonalizeUndo", tr("Tool: {0}", tr("Orthogonalize Shape / Undo")),
    80                         KeyEvent.VK_Q,
    81                         Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
     77                    "ortho",
     78                    tr("Undo orthogonalization for certain nodes"),
     79                    Shortcut.registerShortcut("tools:orthogonalizeUndo", tr("Tool: {0}", tr("Orthogonalize Shape / Undo")),
     80                            KeyEvent.VK_Q,
     81                            Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
    8282        }
    8383        public void actionPerformed(ActionEvent e) {
     
    103103            catch (InvalidUserInputException ex) {
    104104                JOptionPane.showMessageDialog(
    105                     Main.parent,
    106                     tr("Orthogonalize Shape / Undo\n"+
     105                        Main.parent,
     106                        tr("Orthogonalize Shape / Undo\n"+
    107107                        "Please select nodes that were moved by the previous Orthogonalize Shape action!"),
    108                     tr("Undo Orthogonalize Shape"),
    109                     JOptionPane.INFORMATION_MESSAGE);
     108                        tr("Undo Orthogonalize Shape"),
     109                        JOptionPane.INFORMATION_MESSAGE);
    110110            }
    111111        }
     
    143143                else if (p instanceof Way) {
    144144                    wayDataList.add(new WayData((Way) p));
    145                 }
    146                 else {      // maybe a relation got selected...
     145                } else
    147146                    throw new InvalidUserInputException("Selection must consist only of ways and nodes.");
    148                 }
    149             }
    150             if (wayDataList.isEmpty()) {
     147            }
     148            if (wayDataList.isEmpty())
    151149                throw new InvalidUserInputException("usage");
    152             }
    153150            else  {
    154151                if (nodeList.size() == 2 || nodeList.isEmpty()) {
     
    186183                    } else
    187184                        throw new IllegalStateException();
    188                    
     185
    189186                    Main.main.undoRedo.add(new SequenceCommand(tr("Orthogonalize"), commands));
    190187                    Main.map.repaint();
    191                    
     188
    192189                } else
    193190                    throw new InvalidUserInputException("usage");
     
    196193            if (ex.getMessage().equals("usage")) {
    197194                JOptionPane.showMessageDialog(
    198                     Main.parent,
    199                     "<html><h2>"+tr("Usage")+tr(USAGE),
    200                     tr("Orthogonalize Shape"),
    201                     JOptionPane.INFORMATION_MESSAGE);
     195                        Main.parent,
     196                        "<html><h2>"+tr("Usage")+tr(USAGE),
     197                        tr("Orthogonalize Shape"),
     198                        JOptionPane.INFORMATION_MESSAGE);
    202199            }
    203200            else {
    204201                JOptionPane.showMessageDialog(
    205                     Main.parent,
    206                     "<html><h3>"+tr(ex.getMessage())+"<br><hr><h3>"+tr("Usage")+tr(USAGE),
    207                     tr("Selected Elements cannot be orthogonalized"),
    208                     JOptionPane.INFORMATION_MESSAGE);
     202                        Main.parent,
     203                        "<html><h3>"+tr(ex.getMessage())+"<br><hr><h3>"+tr("Usage")+tr(USAGE),
     204                        tr("Selected Elements cannot be orthogonalized"),
     205                        JOptionPane.INFORMATION_MESSAGE);
    209206            }
    210207        }
     
    232229     **/
    233230    private static Collection<Command> orthogonalize(ArrayList<WayData> wayDataList, ArrayList<Node> headingNodes)
    234         throws InvalidUserInputException
     231    throws InvalidUserInputException
    235232    {
    236233        // find average heading
     
    263260        } catch (RejectedAngleException ex) {
    264261            throw new InvalidUserInputException(
    265                 "<html>Please make sure all selected ways head in a similar direction<br>"+
    266                 "or orthogonalize them one by one.");
     262                    "<html>Please make sure all selected ways head in a similar direction<br>"+
     263            "or orthogonalize them one by one.");
    267264        }
    268265
     
    302299            int s_size = s.size();
    303300            for (int dummy = 0; dummy < s_size; ++ dummy) {
    304                 if (s.isEmpty()) break;
     301                if (s.isEmpty()) {
     302                    break;
     303                }
    305304                final Node dummy_n = s.iterator().next();     // pick arbitrary element of s
    306305
     
    357356        // rotate back and log the change
    358357        final Collection<Command> commands = new LinkedList<Command>();
    359 //        OrthogonalizeAction.rememberMovements.clear();
     358        //        OrthogonalizeAction.rememberMovements.clear();
    360359        for (Node n: allNodes) {
    361360            EastNorth tmp = new EastNorth(nX.get(n), nY.get(n));
     
    366365                final double EPSILON = 1E-6;
    367366                if (Math.abs(dx) > Math.abs(EPSILON * tmp.east()) ||
    368                     Math.abs(dy) > Math.abs(EPSILON * tmp.east())) {
     367                        Math.abs(dy) > Math.abs(EPSILON * tmp.east()))
    369368                    throw new AssertionError();
    370                 }
    371369            }
    372370            else {
     
    386384        final public int nNode;           // Number of Nodes of the Way
    387385        public Direction[] segDirections; // Direction of the segments
    388                                           // segment i goes from node i to node (i+1)
     386        // segment i goes from node i to node (i+1)
    389387        public EastNorth segSum;          // (Vector-)sum of all horizontal segments plus the sum of all vertical
    390                                           //     segments turned by 90 degrees
     388        //     segments turned by 90 degrees
    391389        public double heading;            // heading of segSum == approximate heading of the way
    392390        public WayData(Way pWay) {
     
    422420            // sum up segments
    423421            EastNorth h = new EastNorth(0.,0.);
    424             double lh = EN.abs(h);
     422            //double lh = EN.abs(h);
    425423            EastNorth v = new EastNorth(0.,0.);
    426             double lv = EN.abs(v);
     424            //double lv = EN.abs(v);
    427425            for (int i = 0; i < nSeg; ++i) {
    428426                EastNorth segment = EN.diff(en[i+1], en[i]);
    429                 if      (segDirections[i] == Direction.RIGHT) h = EN.sum(h,segment);
    430                 else if (segDirections[i] == Direction.UP)    v = EN.sum(v,segment);
    431                 else if (segDirections[i] == Direction.LEFT)  h = EN.diff(h,segment);
    432                 else if (segDirections[i] == Direction.DOWN)  v = EN.diff(v,segment);
    433                 else throw new IllegalStateException();
     427                if      (segDirections[i] == Direction.RIGHT) {
     428                    h = EN.sum(h,segment);
     429                } else if (segDirections[i] == Direction.UP) {
     430                    v = EN.sum(v,segment);
     431                } else if (segDirections[i] == Direction.LEFT) {
     432                    h = EN.diff(h,segment);
     433                } else if (segDirections[i] == Direction.DOWN) {
     434                    v = EN.diff(v,segment);
     435                } else throw new IllegalStateException();
    434436                /**
    435437                 * When summing up the length of the sum vector should increase.
     
    437439                 * So only uncomment this for testing
    438440                 **/
    439 //                if (segDirections[i].ordinal() % 2 == 0) {
    440 //                    if (EN.abs(h) < lh) throw new AssertionError();
    441 //                    lh = EN.abs(h);
    442 //                } else {
    443 //                    if (EN.abs(v) < lv) throw new AssertionError();
    444 //                    lv = EN.abs(v);
    445 //                }
     441                //                if (segDirections[i].ordinal() % 2 == 0) {
     442                //                    if (EN.abs(h) < lh) throw new AssertionError();
     443                //                    lh = EN.abs(h);
     444                //                } else {
     445                //                    if (EN.abs(v) < lv) throw new AssertionError();
     446                //                    lv = EN.abs(v);
     447                //                }
    446448            }
    447449            // rotate the vertical vector by 90 degrees (clockwise) and add it to the horizontal vector
    448450            segSum = EN.sum(h, new EastNorth(v.north(), - v.east()));
    449 //            if (EN.abs(segSum) < lh) throw new AssertionError();
     451            //            if (EN.abs(segSum) < lh) throw new AssertionError();
    450452            this.heading = EN.polar(new EastNorth(0.,0.), segSum);
    451453        }
     
    456458        public Direction changeBy(int directionChange) {
    457459            int tmp = (this.ordinal() + directionChange) % 4;
    458             if (tmp < 0) tmp += 4;          // the % operator can return negative value
     460            if (tmp < 0) {
     461                tmp += 4;          // the % operator can return negative value
     462            }
    459463            return Direction.values()[tmp];
    460464        }
     
    465469     */
    466470    private static double standard_angle_0_to_2PI(double a) {
    467         while (a >= 2 * Math.PI) a -= 2 * Math.PI;
    468         while (a < 0)            a += 2 * Math.PI;
     471        while (a >= 2 * Math.PI) {
     472            a -= 2 * Math.PI;
     473        }
     474        while (a < 0) {
     475            a += 2 * Math.PI;
     476        }
    469477        return a;
    470478    }
     
    474482     */
    475483    private static double standard_angle_mPI_to_PI(double a) {
    476         while (a > Math.PI)    a -= 2 * Math.PI;
    477         while (a <= - Math.PI) a += 2 * Math.PI;
     484        while (a > Math.PI) {
     485            a -= 2 * Math.PI;
     486        }
     487        while (a <= - Math.PI) {
     488            a += 2 * Math.PI;
     489        }
    478490        return a;
    479491    }
     
    499511            return new EastNorth(en1.east() - en2.east(), en1.north() - en2.north());
    500512        }
    501         public static double abs(EastNorth en) {
    502             return Math.sqrt(en.east() * en.east() + en.north() * en.north());
    503         }
    504         public static String toString(EastNorth en) {
    505             return "["+u(en.east())+","+u(en.north())+"]";
    506         }
    507         public static long u(double d) {
    508             return Math.round(d * 1000000.);
    509         }
    510513        public static double polar(EastNorth en1, EastNorth en2) {
    511514            return Math.atan2(en2.north() - en1.north(), en2.east() -  en1.east());
     
    523526        double d_m90 = Math.abs(a + Math.PI / 2);
    524527        int dirChange;
    525         if (d0 < deltaMax)         dirChange =  0;
    526         else if (d90 < deltaMax)   dirChange =  1;
    527         else if (d_m90 < deltaMax) dirChange = -1;
    528         else {
     528        if (d0 < deltaMax) {
     529            dirChange =  0;
     530        } else if (d90 < deltaMax) {
     531            dirChange =  1;
     532        } else if (d_m90 < deltaMax) {
     533            dirChange = -1;
     534        } else {
    529535            a = standard_angle_0_to_2PI(a);
    530536            double d180 = Math.abs(a - Math.PI);
    531             if (d180 < deltaMax)   dirChange = 2;
    532             else {
     537            if (d180 < deltaMax) {
     538                dirChange = 2;
     539            } else
    533540                throw new RejectedAngleException();
    534             }
    535541        }
    536542        return dirChange;
  • trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java

    r2598 r2626  
    3838        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    3939        reader.append(getCurrentDataSet(),id, type);
    40         DataSet ds = null;
    4140        try {
    42             ds = reader.parseOsm(NullProgressMonitor.INSTANCE);
     41            DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE);
     42            Main.map.mapView.getEditLayer().mergeFrom(ds);
    4343        } catch(Exception e) {
    4444            ExceptionDialogUtil.explainException(e);
    4545        }
    46         Main.map.mapView.getEditLayer().mergeFrom(ds);
    4746    }
    4847
  • trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java

    r2609 r2626  
    244244            OsmPrimitive targetMember = getMergeTarget(sourceMember.getMember());
    245245            if (targetMember == null)
    246                 throw new IllegalStateException(tr("Missing merge target of type {0} with id {1}", targetMember.getType(), targetMember.getUniqueId()));
     246                throw new IllegalStateException(tr("Missing merge target of type {0} with id {1}", sourceMember.getType(), sourceMember.getUniqueId()));
    247247            if (! targetMember.isDeleted() && targetMember.isVisible()) {
    248248                RelationMember newMember = new RelationMember(sourceMember.getRole(), targetMember);
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r2512 r2626  
    636636                }
    637637                if (!canRemove()) {
    638                     abort("attempt to remove non-empty child: " + this.content + " " + this.children);
     638                    abort("attempt to remove non-empty child: " + this.content + " " + Arrays.toString(this.children));
    639639                }
    640640                parent.children[i] = null;
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

    r2512 r2626  
    113113        if (this.id != o.id)
    114114            throw new ClassCastException(tr("Can''t compare primitive with ID ''{0}'' to primitive with ID ''{1}''.", o.id, this.id));
    115         return new Long(this.version).compareTo(o.version);
     115        return Long.valueOf(this.version).compareTo(o.version);
    116116    }
    117117
     
    159159        if (this == obj)
    160160            return true;
    161         if (obj == null)
     161        if (!(obj instanceof HistoryOsmPrimitive))
    162162            return false;
    163163        // equal semantics is valid for subclasses like {@see HistoryOsmNode} etc. too.
  • trunk/src/org/openstreetmap/josm/gui/BookmarkList.java

    r2512 r2626  
    8383    }
    8484
    85     class BookmarkCellRenderer extends JLabel implements ListCellRenderer {
     85    static class BookmarkCellRenderer extends JLabel implements ListCellRenderer {
    8686
    8787        private ImageIcon icon;
  • trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java

    r2602 r2626  
    282282    protected Dimension findMaxDialogSize() {
    283283        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    284         Dimension x = new Dimension(Math.round(screenSize.width*2/3),
    285                 Math.round(screenSize.height*2/3));
     284        Dimension x = new Dimension(screenSize.width*2/3, screenSize.height*2/3);
    286285        try {
    287286            if(parent != null) {
     
    420419        // Make it not wider than 1/2 of the screen
    421420        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    422         lbl.setMaxWidth(Math.round(screenSize.width*1/2));
     421        lbl.setMaxWidth(screenSize.width/2);
    423422        return lbl;
    424423    }
  • trunk/src/org/openstreetmap/josm/gui/FileDrop.java

    r2512 r2626  
    1616import org.openstreetmap.josm.Main;
    1717import org.openstreetmap.josm.actions.OpenFileAction;
    18 
    19 import org.openstreetmap.josm.gui.FileDrop.TransferableObject;
    2018
    2119/**
     
    438436            {   support = false;
    439437            }   // end catch
    440             supportsDnD = new Boolean( support );
     438            supportsDnD = support;
    441439        }   // end if: first time through
    442440        return supportsDnD.booleanValue();
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r2358 r2626  
    2727        + "body { font-family: sans-serif; font-weight: bold; }\n" + "h1 {text-align: center;}\n" + "</style>\n";
    2828
    29     public class LinkGeneral extends JEditorPane implements HyperlinkListener {
     29    public static class LinkGeneral extends JEditorPane implements HyperlinkListener {
    3030        public LinkGeneral(String text) {
    3131            setContentType("text/html");
     
    4646     * Grabs current MOTD from cache or webpage and parses it.
    4747     */
    48     private class MotdContent extends CacheCustomContent {
     48    private static class MotdContent extends CacheCustomContent {
    4949        public MotdContent() {
    5050            super("motd.html", CacheCustomContent.INTERVAL_DAILY);
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r2621 r2626  
    6969import org.openstreetmap.josm.actions.ZoomInAction;
    7070import org.openstreetmap.josm.actions.ZoomOutAction;
     71import org.openstreetmap.josm.actions.OrthogonalizeAction.Undo;
    7172import org.openstreetmap.josm.actions.audio.AudioBackAction;
    7273import org.openstreetmap.josm.actions.audio.AudioFasterAction;
     
    132133    public final JosmAction distribute = new DistributeAction();
    133134    public final OrthogonalizeAction ortho = new OrthogonalizeAction();
    134     public final JosmAction orthoUndo = ortho.new Undo();  // action is not shown in the menu. Only triggered by shortcut
     135    public final JosmAction orthoUndo = new Undo();  // action is not shown in the menu. Only triggered by shortcut
    135136    public final JosmAction mirror = new MirrorAction();
    136137    public final AddNodeAction addnode = new AddNodeAction();
     
    306307    }
    307308
    308     class PresetsMenuEnabler implements MapView.LayerChangeListener {
     309    static class PresetsMenuEnabler implements MapView.LayerChangeListener {
    309310        private JMenu presetsMenu;
    310311        public PresetsMenuEnabler(JMenu presetsMenu) {
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r2575 r2626  
    7474     * a fixed text content to the right of the image.
    7575     */
    76     class ImageLabel extends JPanel {
     76    static class ImageLabel extends JPanel {
    7777        private JLabel tf;
    7878        private int chars;
     
    486486     * @author imi
    487487     */
    488     class MouseState {
     488    static class MouseState {
    489489        Point mousePos;
    490490        int modifiers;
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r2622 r2626  
    398398                            if (l1 == getActiveLayer()) return -1;
    399399                            if (l2 == getActiveLayer()) return 1;
    400                             return new Integer(layers.indexOf(l1)).compareTo(layers.indexOf(l2));
     400                            return Integer.valueOf(layers.indexOf(l1)).compareTo(layers.indexOf(l2));
    401401                        } else
    402                             return new Integer(layers.indexOf(l1)).compareTo(layers.indexOf(l2));
     402                            return Integer.valueOf(layers.indexOf(l1)).compareTo(layers.indexOf(l2));
    403403                    }
    404404                }
  • trunk/src/org/openstreetmap/josm/gui/actionsupport/DeleteFromRelationConfirmationDialog.java

    r2565 r2626  
    220220                            cmp = o1.getParent().getDisplayName(nf).compareTo(o2.getParent().getDisplayName(nf));
    221221                            if (cmp != 0) return cmp;
    222                             return new Integer(o1.getPosition()).compareTo(o2.getPosition());
     222                            return Integer.valueOf(o1.getPosition()).compareTo(o2.getPosition());
    223223                        }
    224224                    }
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java

    r2512 r2626  
    2020import java.util.Observable;
    2121import java.util.Observer;
    22 import java.util.logging.Logger;
    2322
    2423import javax.swing.AbstractAction;
     
    774773        mergedEntriesTable.getSelectionModel().clearSelection();
    775774        mergedEntriesTable.setEnabled(!newValue);
    776         if (freezeAction != null) {
    777             freezeAction.putValue(FreezeActionProperties.PROP_SELECTED, newValue);
    778         }
     775        freezeAction.putValue(FreezeActionProperties.PROP_SELECTED, newValue);
    779776        if (newValue) {
    780777            lblFrozenState.setText(
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java

    r2512 r2626  
    307307     *
    308308     */
    309     class AdjustmentSynchronizer implements AdjustmentListener {
     309    static class AdjustmentSynchronizer implements AdjustmentListener {
    310310        private final ArrayList<Adjustable> synchronizedAdjustables;
    311311
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java

    r2512 r2626  
    11package org.openstreetmap.josm.gui.conflict.tags;
    22
     3import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    34import static org.openstreetmap.josm.tools.I18n.tr;
    4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    55
    66import java.awt.BorderLayout;
     
    399399    }
    400400
    401     class AutoAdjustingSplitPane extends JSplitPane implements PropertyChangeListener, HierarchyBoundsListener {
     401    static class AutoAdjustingSplitPane extends JSplitPane implements PropertyChangeListener, HierarchyBoundsListener {
    402402        private double dividerLocation;
    403403
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModel.java

    r2565 r2626  
    160160        references = references == null ? new LinkedList<RelationToChildReference>() : references;
    161161        decisions.clear();
    162         if (references.isEmpty()) {
    163             this.relations = new HashSet<Relation>(references.size());
    164         } else {
    165             this.relations = new HashSet<Relation>(references.size());
    166         }
     162        this.relations = new HashSet<Relation>(references.size());
    167163        for (RelationToChildReference reference: references) {
    168164            decisions.add(new RelationMemberConflictDecision(reference.getParent(), reference.getPosition()));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java

    r2621 r2626  
    179179     * Action for canceling conflict resolution
    180180     */
    181     class HelpAction extends AbstractAction {
     181    static class HelpAction extends AbstractAction {
    182182        public HelpAction() {
    183183            putValue(Action.SHORT_DESCRIPTION, tr("Show help information"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java

    r2621 r2626  
    3030import org.openstreetmap.josm.gui.MapView;
    3131import org.openstreetmap.josm.gui.SideButton;
    32 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    3332import org.openstreetmap.josm.gui.layer.DataChangeListener;
    3433import org.openstreetmap.josm.gui.layer.Layer;
     
    204203    }
    205204
    206     class StringRenderer extends DefaultTableCellRenderer {
     205    static class StringRenderer extends DefaultTableCellRenderer {
    207206        @Override
    208207        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,int row,int column) {
     
    214213    }
    215214
    216     class BooleanRenderer extends JCheckBox implements TableCellRenderer {
     215    static class BooleanRenderer extends JCheckBox implements TableCellRenderer {
    217216        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,int row,int column) {
    218217            Filters model = (Filters)table.getModel();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r2621 r2626  
    4343import org.openstreetmap.josm.gui.MapView;
    4444import org.openstreetmap.josm.gui.SideButton;
    45 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    4645import org.openstreetmap.josm.gui.io.SaveLayersDialog;
    4746import org.openstreetmap.josm.gui.layer.Layer;
     
    497496     *
    498497     */
    499     class LayerListCellRenderer extends DefaultListCellRenderer {
     498    static class LayerListCellRenderer extends DefaultListCellRenderer {
    500499
    501500        protected boolean isActiveLayer(Layer layer) {
     
    621620     * the properties {@see Layer#VISIBLE_PROP} and {@see Layer#NAME_PROP}.
    622621     */
    623     public class LayerListModel extends DefaultListModel implements MapView.LayerChangeListener, PropertyChangeListener{
     622    public static class LayerListModel extends DefaultListModel implements MapView.LayerChangeListener, PropertyChangeListener{
    624623
    625624        /** manages list selection state*/
     
    10101009    }
    10111010
    1012     class LayerList extends JList {
     1011    static class LayerList extends JList {
    10131012        public LayerList(ListModel dataModel) {
    10141013            super(dataModel);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r2623 r2626  
    339339     *
    340340     */
    341     class NewAction extends AbstractAction implements MapView.LayerChangeListener{
     341    static class NewAction extends AbstractAction implements MapView.LayerChangeListener{
    342342        public NewAction() {
    343343            putValue(SHORT_DESCRIPTION,tr("Create a new relation"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r2621 r2626  
    4646import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
    4747import org.openstreetmap.josm.gui.SideButton;
    48 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    4948import org.openstreetmap.josm.gui.layer.Layer;
    5049import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    356355     * @author Jan Peter Stotz
    357356     */
    358     protected class SearchMenuItem extends JMenuItem implements ActionListener {
     357    protected static class SearchMenuItem extends JMenuItem implements ActionListener {
    359358        protected SearchSetting s;
    360359
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r2621 r2626  
    4343import org.openstreetmap.josm.gui.MapView;
    4444import org.openstreetmap.josm.gui.SideButton;
    45 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    4645import org.openstreetmap.josm.gui.layer.Layer;
    4746import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    273272     *
    274273     */
    275     class UserTableModel extends DefaultTableModel {
     274    static class UserTableModel extends DefaultTableModel {
    276275        private ArrayList<UserInfo> data;
    277276
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetInSelectionListModel.java

    r2621 r2626  
    99import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1010import org.openstreetmap.josm.gui.MapView;
    11 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    1211import org.openstreetmap.josm.gui.layer.Layer;
    1312import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    3130        if (newLayer == null || ! (newLayer instanceof OsmDataLayer)) {
    3231            setChangesets(null);
    33         } else if (newLayer instanceof OsmDataLayer){
     32        } else {
    3433            initFromPrimitives(((OsmDataLayer) newLayer).data.getSelected());
    3534        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r2621 r2626  
    582582    }
    583583
    584     class AddAbortException extends Exception  {
     584    static class AddAbortException extends Exception  {
    585585    }
    586586
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java

    r2512 r2626  
    152152                    currentArea.getMax().latToString(CoordinateFormat.DECIMAL_DEGREES),
    153153                    currentArea.getMax().lonToString(CoordinateFormat.DECIMAL_DEGREES)
    154                     )
     154            )
    155155            );
    156156        }
     
    167167        bookmarks.clearSelection();
    168168        updateDownloadAreaLabel();
    169         actAdd.setEnabled(area != null);
     169        actAdd.setEnabled(true);
    170170    }
    171171
     
    194194            b.setName(
    195195                    JOptionPane.showInputDialog(
    196                     Main.parent,tr("Please enter a name for the bookmarked download area."),
    197                     tr("Name of location"),
    198                     JOptionPane.QUESTION_MESSAGE)
     196                            Main.parent,tr("Please enter a name for the bookmarked download area."),
     197                            tr("Name of location"),
     198                            JOptionPane.QUESTION_MESSAGE)
    199199            );
    200200            b.setArea(currentArea);
     
    208208    class RemoveAction extends AbstractAction implements ListSelectionListener{
    209209        public RemoveAction() {
    210            //putValue(NAME, tr("Remove"));
     210            //putValue(NAME, tr("Remove"));
    211211            putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
    212212            putValue(SHORT_DESCRIPTION, tr("Remove the currently selected bookmarks"));
     
    216216        public void actionPerformed(ActionEvent e) {
    217217            Object[] sels = bookmarks.getSelectedValues();
    218             if (sels == null || sels.length == 0) {
    219                 return;
    220             }
     218            if (sels == null || sels.length == 0)
     219                return;
    221220            for (Object sel: sels) {
    222221                ((DefaultListModel)bookmarks.getModel()).removeElement(sel);
     
    234233    class RenameAction extends AbstractAction implements ListSelectionListener{
    235234        public RenameAction() {
    236            //putValue(NAME, tr("Remove"));
     235            //putValue(NAME, tr("Remove"));
    237236            putValue(SMALL_ICON, ImageProvider.get("dialogs", "edit"));
    238237            putValue(SHORT_DESCRIPTION, tr("Rename the currently selected bookmark"));
     
    242241        public void actionPerformed(ActionEvent e) {
    243242            Object[] sels = bookmarks.getSelectedValues();
    244             if (sels == null || sels.length != 1) {
    245                 return;
    246             }
     243            if (sels == null || sels.length != 1)
     244                return;
    247245            Bookmark b = (Bookmark)sels[0];
    248246            Object value =
    249                     JOptionPane.showInputDialog(
    250                     Main.parent,tr("Please enter a name for the bookmarked download area."),
    251                     tr("Name of location"),
    252                     JOptionPane.QUESTION_MESSAGE,
    253                     null,
    254                     null,
    255                     b.getName()
    256                     );
     247                JOptionPane.showInputDialog(
     248                        Main.parent,tr("Please enter a name for the bookmarked download area."),
     249                        tr("Name of location"),
     250                        JOptionPane.QUESTION_MESSAGE,
     251                        null,
     252                        null,
     253                        b.getName()
     254                );
    257255            if (value != null) {
    258256                b.setName(value.toString());
  • trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java

    r2512 r2626  
    269269    }
    270270
    271     class SelectAllOnFocusHandler extends FocusAdapter {
     271    static class SelectAllOnFocusHandler extends FocusAdapter {
    272272        private JTextComponent tfTarget;
    273273        public SelectAllOnFocusHandler(JTextComponent tfTarget) {
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r2512 r2626  
    144144
    145145    public void setDownloadArea(Bounds area) {
    146        tblSearchResults.clearSelection();
     146        tblSearchResults.clearSelection();
    147147    }
    148148
     
    166166                    new LatLon(lat - size / 2, lon - size),
    167167                    new LatLon(lat + size / 2, lon+ size)
    168                     );
     168            );
    169169            return b;
    170170        }
     
    176176     *
    177177     */
    178     private class NameFinderResultParser extends DefaultHandler {
     178    private static class NameFinderResultParser extends DefaultHandler {
    179179        private SearchResult currentResult = null;
    180180        private StringBuffer description = null;
     
    188188        @Override
    189189        public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
    190                 throws SAXException {
     190        throws SAXException {
    191191            depth++;
    192192            try {
     
    323323            try {
    324324                getProgressMonitor().indeterminateSubTask(tr("Querying name server ..."));
    325                     URL url = new URL("http://gazetteer.openstreetmap.org/namefinder/search.xml?find="
    326                             +java.net.URLEncoder.encode(searchExpression, "UTF-8"));
    327                     synchronized(this) {
    328                         connection = (HttpURLConnection)url.openConnection();
    329                     }
    330                     connection.setConnectTimeout(15000);
    331                     InputStream inputStream = connection.getInputStream();
    332                     InputSource inputSource = new InputSource(new InputStreamReader(inputStream, "UTF-8"));
    333                     NameFinderResultParser parser = new NameFinderResultParser();
    334                     SAXParserFactory.newInstance().newSAXParser().parse(inputSource, parser);
    335                     this.data = parser.getResult();
     325                URL url = new URL("http://gazetteer.openstreetmap.org/namefinder/search.xml?find="
     326                        +java.net.URLEncoder.encode(searchExpression, "UTF-8"));
     327                synchronized(this) {
     328                    connection = (HttpURLConnection)url.openConnection();
     329                }
     330                connection.setConnectTimeout(15000);
     331                InputStream inputStream = connection.getInputStream();
     332                InputSource inputSource = new InputSource(new InputStreamReader(inputStream, "UTF-8"));
     333                NameFinderResultParser parser = new NameFinderResultParser();
     334                SAXParserFactory.newInstance().newSAXParser().parse(inputSource, parser);
     335                this.data = parser.getResult();
    336336            } catch(Exception e) {
    337                 if (canceled) {
     337                if (canceled)
    338338                    // ignore exception
    339339                    return;
    340                 }
    341340                lastException = e;
    342341            }
     
    344343    }
    345344
    346     class NamedResultTableModel extends DefaultTableModel {
     345    static class NamedResultTableModel extends DefaultTableModel {
    347346        private ArrayList<SearchResult> data;
    348347        private ListSelectionModel selectionModel;
     
    378377
    379378        public SearchResult getSelectedSearchResult() {
    380             if (selectionModel.getMinSelectionIndex() < 0) {
     379            if (selectionModel.getMinSelectionIndex() < 0)
    381380                return null;
    382             }
    383381            return data.get(selectionModel.getMinSelectionIndex());
    384382        }
     
    442440    }
    443441
    444     class NamedResultCellRenderer extends JLabel implements TableCellRenderer {
     442    static class NamedResultCellRenderer extends JLabel implements TableCellRenderer {
    445443
    446444        public NamedResultCellRenderer() {
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r2512 r2626  
    399399    }
    400400
    401     class BackAction extends AbstractAction implements Observer {
     401    static class BackAction extends AbstractAction implements Observer {
    402402        private HelpBrowserHistory history;
    403403        public BackAction(HelpBrowserHistory history) {
     
    419419    }
    420420
    421     class ForwardAction extends AbstractAction implements Observer {
     421    static class ForwardAction extends AbstractAction implements Observer {
    422422        private HelpBrowserHistory history;
    423423        public ForwardAction(HelpBrowserHistory history) {
  • trunk/src/org/openstreetmap/josm/gui/help/HelpUtil.java

    r2512 r2626  
    157157            ret += "/" + topic;
    158158        }
    159         ret.replaceAll("\\/+", "\\/"); // just in case, collapse sequences of //
     159        ret = ret.replaceAll("\\/+", "\\/"); // just in case, collapse sequences of //
    160160        return ret;
    161161    }
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r2622 r2626  
    881881     *
    882882     */
    883     class HistoryPrimitiveBuilder extends AbstractVisitor {
     883    static class HistoryPrimitiveBuilder extends AbstractVisitor {
    884884        private HistoryOsmPrimitive clone;
    885885
  • trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java

    r2512 r2626  
    169169    }
    170170
    171     class NodeListPopupMenu extends JPopupMenu {
     171    static class NodeListPopupMenu extends JPopupMenu {
    172172        private ZoomToNodeAction zoomToNodeAction;
    173173        private ShowHistoryAction showHistoryAction;
     
    189189    }
    190190
    191     class ZoomToNodeAction extends AbstractAction {
     191    static class ZoomToNodeAction extends AbstractAction {
    192192        private PrimitiveId primitiveId;
    193193
     
    235235    }
    236236
    237     class ShowHistoryAction extends AbstractAction {
     237    static class ShowHistoryAction extends AbstractAction {
    238238        private PrimitiveId primitiveId;
    239239
     
    302302    }
    303303
    304     class DoubleClickAdapter extends MouseAdapter {
     304    static class DoubleClickAdapter extends MouseAdapter {
    305305        private JTable table;
    306306        private ShowHistoryAction showHistoryAction;
  • trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java

    r2556 r2626  
    99import java.util.Observable;
    1010import java.util.Observer;
    11 import java.util.logging.Logger;
    1211
    1312import javax.swing.DefaultListSelectionModel;
     
    2827 */
    2928public class VersionTable extends JTable implements Observer{
     29    //private static Logger logger = Logger.getLogger(VersionTable.class.getName());
    3030
    31     private static Logger logger = Logger.getLogger(VersionTable.class.getName());
    3231    private VersionTablePopupMenu popupMenu;
    3332
     
    114113    }
    115114
    116     class ChangesetInfoAction extends AbstractInfoAction {
     115    static class ChangesetInfoAction extends AbstractInfoAction {
    117116        private HistoryOsmPrimitive primitive;
    118117
     
    143142    }
    144143
    145     class VersionTablePopupMenu extends JPopupMenu {
     144    static class VersionTablePopupMenu extends JPopupMenu {
    146145
    147146        private ChangesetInfoAction changesetInfoAction;
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java

    r2614 r2626  
    235235        if (strategy == null) return;
    236236        rbStrategy.get(strategy.getStrategy()).setSelected(true);
    237         tfChunkSize.setEnabled(strategy.equals(UploadStrategy.CHUNKED_DATASET_STRATEGY));
     237        tfChunkSize.setEnabled(strategy.getStrategy() == UploadStrategy.CHUNKED_DATASET_STRATEGY);
    238238        if (strategy.getStrategy().equals(UploadStrategy.CHUNKED_DATASET_STRATEGY)) {
    239239            if (strategy.getChunkSize() != UploadStrategySpecification.UNSPECIFIED_CHUNK_SIZE) {
     
    380380    }
    381381
    382     class TextFieldFocusHandler implements FocusListener {
     382    static class TextFieldFocusHandler implements FocusListener {
    383383        public void focusGained(FocusEvent e) {
    384384            Component c = e.getComponent();
  • trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java

    r2599 r2626  
    154154     *
    155155     */
    156     class PrimitiveListModel extends AbstractListModel{
     156    static class PrimitiveListModel extends AbstractListModel{
    157157        private List<OsmPrimitive> primitives;
    158158
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r2592 r2626  
    8585    private boolean isLocalFile;
    8686
    87     private class Markers {
     87    private static class Markers {
    8888        public boolean timedMarkersOmitted = false;
    8989        public boolean untimedMarkersOmitted = false;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r2617 r2626  
    6363import org.openstreetmap.josm.gui.layer.GpxLayer;
    6464import org.openstreetmap.josm.gui.layer.Layer;
     65import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer.ImageEntry;
    6566import org.openstreetmap.josm.io.GpxReader;
    66 import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer.ImageEntry;
    6767import org.openstreetmap.josm.tools.ExifReader;
    6868import org.openstreetmap.josm.tools.GBC;
     
    9898        }
    9999
     100        @Override
    100101        public String toString() {
    101102            return name;
     
    154155                                        tr("Error"),
    155156                                        JOptionPane.ERROR_MESSAGE
    156                                         );
     157                                );
    157158                            }
    158159                            return;
     
    178179                            tr("Error"),
    179180                            JOptionPane.ERROR_MESSAGE
    180                             );
     181                    );
    181182                    return;
    182183                } catch (IOException x) {
     
    187188                            tr("Error"),
    188189                            JOptionPane.ERROR_MESSAGE
    189                             );
     190                    );
    190191                    return;
    191192                }
     
    224225            panel.setLayout(new BorderLayout());
    225226            panel.add(new JLabel(tr("<html>Take a photo of your GPS receiver while it displays the time.<br>"
    226                                     + "Display that photo here.<br>"
    227                                     + "And then, simply capture the time you read on the photo and select a timezone<hr></html>")),
    228                                     BorderLayout.NORTH);
     227                    + "Display that photo here.<br>"
     228                    + "And then, simply capture the time you read on the photo and select a timezone<hr></html>")),
     229                    BorderLayout.NORTH);
    229230
    230231            imgDisp = new ImageDisplay();
     
    285286
    286287                String tzDesc = new StringBuffer(tzStr).append(" (")
    287                                         .append(formatTimezone(tz.getRawOffset() / 3600000.0))
    288                                         .append(')').toString();
     288                .append(formatTimezone(tz.getRawOffset() / 3600000.0))
     289                .append(')').toString();
    289290                vtTimezones.add(tzDesc);
    290291            }
     
    359360                    fc.showOpenDialog(Main.parent);
    360361                    File sel = fc.getSelectedFile();
    361                     if (sel == null) {
     362                    if (sel == null)
    362363                        return;
    363                     }
    364364
    365365                    imgDisp.setImage(sel);
     
    392392                        JOptionPane.OK_CANCEL_OPTION,
    393393                        JOptionPane.QUESTION_MESSAGE
    394                         );
    395                 if (answer == JOptionPane.CANCEL_OPTION) {
     394                );
     395                if (answer == JOptionPane.CANCEL_OPTION)
    396396                    return;
    397                 }
    398397
    399398                long delta;
     
    401400                try {
    402401                    delta = dateFormat.parse(lbExifTime.getText()).getTime()
    403                             - dateFormat.parse(tfGpsTime.getText()).getTime();
     402                    - dateFormat.parse(tfGpsTime.getText()).getTime();
    404403                } catch(ParseException e) {
    405404                    JOptionPane.showMessageDialog(Main.parent, tr("Error while parsing the date.\n"
     
    437436            if (cur instanceof GpxLayer) {
    438437                gpxLst.add(new GpxDataWrapper(((GpxLayer) cur).getName(),
    439                                               ((GpxLayer) cur).data,
    440                                               ((GpxLayer) cur).data.storageFile));
     438                        ((GpxLayer) cur).data,
     439                        ((GpxLayer) cur).data.storageFile));
    441440            }
    442441        }
    443442        for (GpxData data : loadedGpxData) {
    444443            gpxLst.add(new GpxDataWrapper(data.storageFile.getName(),
    445                                           data,
    446                                           data.storageFile));
     444                    data,
     445                    data.storageFile));
    447446        }
    448447
     
    510509
    511510        JButton buttonViewGpsPhoto = new JButton(tr("<html>I can take a picture of my GPS receiver.<br>"
    512                                                     + "Can this help?</html>"));
     511                + "Can this help?</html>"));
    513512        buttonViewGpsPhoto.addActionListener(new SetOffsetActionListener());
    514513        gc.gridx = 2;
     
    586585            ExtendedDialog dialog = new ExtendedDialog(
    587586                    Main.parent,
    588                 tr("Correlate images with GPX track"),
    589                 new String[] { tr("Correlate"), tr("Auto-Guess"), tr("Cancel") }
    590                     );
     587                    tr("Correlate images with GPX track"),
     588                    new String[] { tr("Correlate"), tr("Auto-Guess"), tr("Cancel") }
     589            );
    591590
    592591            dialog.setContent(panel);
     
    602601            if (item == null || ! (item instanceof GpxDataWrapper)) {
    603602                JOptionPane.showMessageDialog(Main.parent, tr("You should select a GPX track"),
    604                                               tr("No selected GPX track"), JOptionPane.ERROR_MESSAGE );
     603                        tr("No selected GPX track"), JOptionPane.ERROR_MESSAGE );
    605604                continue;
    606605            }
     
    623622            if (deltaText.length() > 0) {
    624623                try {
    625                     if(deltaText.startsWith("+"))
     624                    if(deltaText.startsWith("+")) {
    626625                        deltaText = deltaText.substring(1);
     626                    }
    627627                    delta = Long.parseLong(deltaText);
    628628                } catch(NumberFormatException nfe) {
     
    681681                tr("GPX Track loaded"),
    682682                ((dateImgLst.size() > 0 && matched == 0) ? JOptionPane.WARNING_MESSAGE
    683                                                          : JOptionPane.INFORMATION_MESSAGE));
     683                        : JOptionPane.INFORMATION_MESSAGE));
    684684
    685685    }
     
    714714        if(autoImgs.size() <= 0) {
    715715            JOptionPane.showMessageDialog(Main.parent,
    716                 tr("The selected photos don't contain time information."),
    717                 tr("Photos don't contain time information"), JOptionPane.WARNING_MESSAGE);
     716                    tr("The selected photos don't contain time information."),
     717                    tr("Photos don't contain time information"), JOptionPane.WARNING_MESSAGE);
    718718            return;
    719719        }
     
    722722        dialog.showDialog();
    723723        // Will show first photo if none is selected yet
    724         if(!dialog.hasImage())
     724        if(!dialog.hasImage()) {
    725725            yLayer.showNextPhoto();
    726         // FIXME: If the dialog is minimized it will not be maximized. ToggleDialog is
    727         // in need of a complete re-write to allow this in a reasonable way.
     726            // FIXME: If the dialog is minimized it will not be maximized. ToggleDialog is
     727            // in need of a complete re-write to allow this in a reasonable way.
     728        }
    728729
    729730        // Init variables
     
    736737                for (WayPoint curWp : segment) {
    737738                    String curDateWpStr = (String) curWp.attr.get("time");
    738                     if (curDateWpStr == null) continue;
     739                    if (curDateWpStr == null) {
     740                        continue;
     741                    }
    739742
    740743                    try {
     
    749752        if(firstGPXDate < 0) {
    750753            JOptionPane.showMessageDialog(Main.parent,
    751                 tr("The selected GPX track doesn't contain timestamps. Please select another one."),
    752                 tr("GPX Track has no time information"), JOptionPane.WARNING_MESSAGE);
     754                    tr("The selected GPX track doesn't contain timestamps. Please select another one."),
     755                    tr("GPX Track has no time information"), JOptionPane.WARNING_MESSAGE);
    753756            return;
    754757        }
     
    756759        // seconds
    757760        long diff = (yLayer.hasTimeoffset)
    758             ? yLayer.timeoffset
    759             : firstExifDate - firstGPXDate;
     761        ? yLayer.timeoffset
     762                : firstExifDate - firstGPXDate;
    760763        yLayer.timeoffset = diff;
    761764        yLayer.hasTimeoffset = true;
     
    791794                double tz = Math.abs(sldTimezone.getValue());
    792795                String zone = tz % 2 == 0
    793                     ? (int)Math.floor(tz/2) + ":00"
    794                     : (int)Math.floor(tz/2) + ":30";
    795                 if(sldTimezone.getValue() < 0) zone = "-" + zone;
     796                ? (int)Math.floor(tz/2) + ":00"
     797                        : (int)Math.floor(tz/2) + ":30";
     798                if(sldTimezone.getValue() < 0) {
     799                    zone = "-" + zone;
     800                }
    796801
    797802                lblTimezone.setText(tr("Timezone: {0}", zone));
     
    807812
    808813                long timediff = (long) (gpstimezone * 3600)
    809                         + dayOffset*24*60*60
    810                         + sldMinutes.getValue()*60
    811                         + sldSeconds.getValue();
     814                + dayOffset*24*60*60
     815                + sldMinutes.getValue()*60
     816                + sldSeconds.getValue();
    812817
    813818                int matched = matchGpxTrack(autoImgs, autoGpx, timediff);
    814819
    815820                lblMatches.setText(
    816                     tr("Matched {0} of {1} photos to GPX track.", matched, autoImgs.size())
    817                     + ((Math.abs(dayOffset) == 0)
    818                         ? ""
    819                         : " " + tr("(Time difference of {0} days)", Math.abs(dayOffset))
    820                       )
     821                        tr("Matched {0} of {1} photos to GPX track.", matched, autoImgs.size())
     822                        + ((Math.abs(dayOffset) == 0)
     823                                ? ""
     824                                        : " " + tr("(Time difference of {0} days)", Math.abs(dayOffset))
     825                        )
    821826                );
    822827
     
    824829                int o = Math.abs(offset);
    825830                lblOffset.setText(
    826                     tr("Offset between track and photos: {0}m {1}s",
    827                           (offset < 0 ? "-" : "") + Long.toString(Math.round(o/60)),
    828                           Long.toString(Math.round(o%60))
    829                     )
     831                        tr("Offset between track and photos: {0}m {1}s",
     832                                (offset < 0 ? "-" : "") + Long.toString(o/60),
     833                                Long.toString(o%60)
     834                        )
    830835                );
    831836
     
    886891        } catch(Exception e) {
    887892            JOptionPane.showMessageDialog(Main.parent,
    888                 tr("An error occurred while trying to match the photos to the GPX track."
    889                     +" You can adjust the sliders to manually match the photos."),
    890                 tr("Matching photos to track failed"),
    891                 JOptionPane.WARNING_MESSAGE);
     893                    tr("An error occurred while trying to match the photos to the GPX track."
     894                            +" You can adjust the sliders to manually match the photos."),
     895                            tr("Matching photos to track failed"),
     896                            JOptionPane.WARNING_MESSAGE);
    892897        }
    893898
     
    904909        // Settings are only saved temporarily to the layer.
    905910        ExtendedDialog d = new ExtendedDialog(Main.parent,
    906             tr("Adjust timezone and offset"),
    907             new String[] { tr("Close"),  tr("Default Values") }
     911                tr("Adjust timezone and offset"),
     912                new String[] { tr("Close"),  tr("Default Values") }
    908913        );
    909914
     
    10011006
    10021007    private int matchPoints(ArrayList<ImageEntry> dateImgLst, WayPoint prevWp, long prevDateWp,
    1003                                                                    WayPoint curWp, long curDateWp) {
     1008            WayPoint curWp, long curDateWp) {
    10041009        // Time between the track point and the previous one, 5 sec if first point, i.e. photos take
    10051010        // 5 sec before the first track point can be assumed to be take at the starting position
     
    10211026            double distance = prevWp.getCoor().greatCircleDistance(curWp.getCoor());
    10221027            // This is in km/h, 3.6 * m/s
    1023             if (curDateWp > prevDateWp)
     1028            if (curDateWp > prevDateWp) {
    10241029                speed = 3.6 * distance / (curDateWp - prevDateWp);
     1030            }
    10251031            try {
    10261032                prevElevation = new Double((String) prevWp.attr.get("ele"));
     
    10361042        if(prevDateWp == 0 || curDateWp <= prevDateWp) {
    10371043            while(i >= 0 && (dateImgLst.get(i).time.getTime()/1000) <= curDateWp
    1038                         && (dateImgLst.get(i).time.getTime()/1000) >= (curDateWp - interval)) {
     1044                    && (dateImgLst.get(i).time.getTime()/1000) >= (curDateWp - interval)) {
    10391045                if(dateImgLst.get(i).pos == null) {
    10401046                    dateImgLst.get(i).setCoor(curWp.getCoor());
     
    10601066                dateImgLst.get(i).speed = speed;
    10611067
    1062                 if (curElevation != null && prevElevation != null)
     1068                if (curElevation != null && prevElevation != null) {
    10631069                    dateImgLst.get(i).elevation = prevElevation + (curElevation - prevElevation) * timeDiff;
     1070                }
    10641071
    10651072                ret++;
     
    10871094        while (endIndex - startIndex > 1) {
    10881095            curIndex= (int) Math.round((double)(endIndex + startIndex)/2);
    1089             if (searchedDate > dateImgLst.get(curIndex).time.getTime()/1000)
     1096            if (searchedDate > dateImgLst.get(curIndex).time.getTime()/1000) {
    10901097                startIndex= curIndex;
    1091             else
     1098            } else {
    10921099                endIndex= curIndex;
     1100            }
    10931101        }
    10941102        if (searchedDate < dateImgLst.get(endIndex).time.getTime()/1000)
     
    10971105        // This final loop is to check if photos with the exact same EXIF time follows
    10981106        while ((endIndex < (lstSize-1)) && (dateImgLst.get(endIndex).time.getTime()
    1099                                                 == dateImgLst.get(endIndex + 1).time.getTime()))
     1107                == dateImgLst.get(endIndex + 1).time.getTime())) {
    11001108            endIndex++;
     1109        }
    11011110        return endIndex;
    11021111    }
     
    11231132
    11241133    private Float parseTimezone(String timezone) {
    1125         if (timezone.length() == 0) {
     1134        if (timezone.length() == 0)
    11261135            return new Float(0);
    1127         }
    11281136
    11291137        char sgnTimezone = '+';
     
    11351143            switch (c) {
    11361144            case ' ' :
    1137                 if (state != 2 || hTimezone.length() != 0) {
     1145                if (state != 2 || hTimezone.length() != 0)
    11381146                    return null;
    1139                 }
    11401147                break;
    11411148            case '+' :
     
    11441151                    sgnTimezone = c;
    11451152                    state = 2;
    1146                 } else {
     1153                } else
    11471154                    return null;
    1148                 }
    11491155                break;
    11501156            case ':' :
     
    11521158                if (state == 2) {
    11531159                    state = 3;
    1154                 } else {
     1160                } else
    11551161                    return null;
    1156                 }
    11571162                break;
    11581163            case '0' : case '1' : case '2' : case '3' : case '4' :
     
    11881193        }
    11891194
    1190         if (h > 12 || m > 59 ) {
     1195        if (h > 12 || m > 59 )
    11911196            return null;
    1192         } else {
     1197        else
    11931198            return new Float((h + m / 60.0) * (sgnTimezone == '-' ? -1 : 1));
    1194         }
    11951199    }
    11961200}
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r2512 r2626  
    446446    }
    447447
    448     public final class ShowHideMarkerText extends AbstractAction {
     448    public static final class ShowHideMarkerText extends AbstractAction {
    449449        private final Layer layer;
    450450
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java

    r2017 r2626  
    2020    RuleElem rule = new RuleElem();
    2121
    22     class RuleElem {
     22    static class RuleElem {
    2323        Rule rule = new Rule();
    2424        Collection<Rule> rules;
     
    5353        int i = colString.indexOf("#");
    5454        Color ret;
    55         if(i < 0) // name only
     55        if(i < 0) {
    5656            ret = Main.pref.getColor("mappaint."+styleName+"."+colString, Color.red);
    57         else if(i == 0) // value only
     57        } else if(i == 0) {
    5858            ret = ColorHelper.html2color(colString);
    59         else // value and name
     59        } else {
    6060            ret = Main.pref.getColor("mappaint."+styleName+"."+colString.substring(0,i),
    61             ColorHelper.html2color(colString.substring(i)));
     61                    ColorHelper.html2color(colString.substring(i)));
     62        }
    6263        return ret;
    6364    }
     
    9596                    line.width = Integer.parseInt(val.substring(0, val.length()-1));
    9697                    line.widthMode = LineElemStyle.WidthMode.PERCENT;
    97                 }
    98                 else
     98                } else {
    9999                    line.width = Integer.parseInt(val);
    100             }
    101             else if (atts.getQName(count).equals("colour"))
     100                }
     101            }
     102            else if (atts.getQName(count).equals("colour")) {
    102103                line.color=convertColor(atts.getValue(count));
    103             else if (atts.getQName(count).equals("realwidth"))
     104            } else if (atts.getQName(count).equals("realwidth")) {
    104105                line.realWidth=Integer.parseInt(atts.getValue(count));
    105             else if (atts.getQName(count).equals("dashed")) {
     106            } else if (atts.getQName(count).equals("dashed")) {
    106107                try
    107108                {
     
    109110                    line.dashed = new float[parts.length];
    110111                    for (int i = 0; i < parts.length; i++) {
    111                         line.dashed[i] = (float)(Integer.parseInt(parts[i]));
     112                        line.dashed[i] = (Integer.parseInt(parts[i]));
    112113                    }
    113114                } catch (NumberFormatException nfe) {
     
    117118                    }
    118119                }
    119             } else if (atts.getQName(count).equals("dashedcolour"))
     120            } else if (atts.getQName(count).equals("dashedcolour")) {
    120121                line.dashedColor=convertColor(atts.getValue(count));
    121             else if(atts.getQName(count).equals("priority"))
     122            } else if(atts.getQName(count).equals("priority")) {
    122123                line.priority = Integer.parseInt(atts.getValue(count));
    123             else if(atts.getQName(count).equals("mode"))
     124            } else if(atts.getQName(count).equals("mode")) {
    124125                line.over = !atts.getValue(count).equals("under");
    125             else
     126            } else {
    126127                error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
     128            }
    127129        }
    128130    }
     
    131133        if (inDoc==true)
    132134        {
    133             if (qName.equals("rule"))
     135            if (qName.equals("rule")) {
    134136                inRule=true;
    135             else if (qName.equals("rules"))
     137            } else if (qName.equals("rules"))
    136138            {
    137139                if(styleName == null)
    138140                {
    139141                    String n = atts.getValue("name");
    140                     if(n == null) n = "standard";
     142                    if(n == null) {
     143                        n = "standard";
     144                    }
    141145                    styleName = n;
    142146                }
    143147            }
    144             else if (qName.equals("scale_max"))
     148            else if (qName.equals("scale_max")) {
    145149                inScaleMax = true;
    146             else if (qName.equals("scale_min"))
     150            } else if (qName.equals("scale_min")) {
    147151                inScaleMin = true;
    148             else if (qName.equals("condition") && inRule)
     152            } else if (qName.equals("condition") && inRule)
    149153            {
    150154                inCondition=true;
     
    152156                if(r.key != null)
    153157                {
    154                     if(rule.rules == null)
     158                    if(rule.rules == null) {
    155159                        rule.rules = new LinkedList<Rule>();
     160                    }
    156161                    rule.rules.add(new Rule(rule.rule));
    157162                    r = new Rule();
     
    160165                for (int count=0; count<atts.getLength(); count++)
    161166                {
    162                     if(atts.getQName(count).equals("k"))
     167                    if(atts.getQName(count).equals("k")) {
    163168                        r.key = atts.getValue(count);
    164                     else if(atts.getQName(count).equals("v"))
     169                    } else if(atts.getQName(count).equals("v")) {
    165170                        r.value = atts.getValue(count);
    166                     else if(atts.getQName(count).equals("b"))
     171                    } else if(atts.getQName(count).equals("b")) {
    167172                        r.boolValue = atts.getValue(count);
    168                     else
     173                    } else {
    169174                        error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
    170                 }
    171                 if(r.key == null)
     175                    }
     176                }
     177                if(r.key == null) {
    172178                    error("The condition has no key!");
     179                }
    173180            }
    174181            else if (qName.equals("line"))
     
    195202                        hadIcon = (icon != null);
    196203                        rule.icon.icon = icon;
    197                     } else if (atts.getQName(count).equals("annotate"))
     204                    } else if (atts.getQName(count).equals("annotate")) {
    198205                        rule.icon.annotate = Boolean.parseBoolean (atts.getValue(count));
    199                     else if(atts.getQName(count).equals("priority"))
     206                    } else if(atts.getQName(count).equals("priority")) {
    200207                        rule.icon.priority = Integer.parseInt(atts.getValue(count));
    201                     else
     208                    } else {
    202209                        error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
     210                    }
    203211                }
    204212            }
     
    208216                for (int count=0; count<atts.getLength(); count++)
    209217                {
    210                     if (atts.getQName(count).equals("colour"))
     218                    if (atts.getQName(count).equals("colour")) {
    211219                        rule.area.color=convertColor(atts.getValue(count));
    212                     else if (atts.getQName(count).equals("closed"))
     220                    } else if (atts.getQName(count).equals("closed")) {
    213221                        rule.area.closed=Boolean.parseBoolean(atts.getValue(count));
    214                     else if(atts.getQName(count).equals("priority"))
     222                    } else if(atts.getQName(count).equals("priority")) {
    215223                        rule.area.priority = Integer.parseInt(atts.getValue(count));
    216                     else
     224                    } else {
    217225                        error("The element \"" + qName + "\" has unknown attribute \"" + atts.getQName(count) + "\"!");
    218                 }
    219             }
    220             else
     226                    }
     227                }
     228            } else {
    221229                error("The element \"" + qName + "\" is unknown!");
     230            }
    222231        }
    223232    }
     
    230239            {
    231240                styles.add(styleName, rule.rule, rule.rules,
    232                 new LineElemStyle(rule.line, rule.scaleMax, rule.scaleMin));
     241                        new LineElemStyle(rule.line, rule.scaleMax, rule.scaleMin));
    233242            }
    234243            if(hadLineMod)
    235244            {
    236245                styles.addModifier(styleName, rule.rule, rule.rules,
    237                 new LineElemStyle(rule.linemod, rule.scaleMax, rule.scaleMin));
     246                        new LineElemStyle(rule.linemod, rule.scaleMax, rule.scaleMin));
    238247            }
    239248            if(hadIcon)
    240249            {
    241250                styles.add(styleName, rule.rule, rule.rules,
    242                 new IconElemStyle(rule.icon, rule.scaleMax, rule.scaleMin));
     251                        new IconElemStyle(rule.icon, rule.scaleMax, rule.scaleMin));
    243252            }
    244253            if(hadArea)
    245254            {
    246255                styles.add(styleName, rule.rule, rule.rules,
    247                 new AreaElemStyle(rule.area, rule.scaleMax, rule.scaleMin));
     256                        new AreaElemStyle(rule.area, rule.scaleMax, rule.scaleMin));
    248257            }
    249258            inRule = false;
     
    251260            rule.init();
    252261        }
    253         else if (inCondition && qName.equals("condition"))
     262        else if (inCondition && qName.equals("condition")) {
    254263            inCondition = false;
    255         else if (inLine && qName.equals("line"))
     264        } else if (inLine && qName.equals("line")) {
    256265            inLine = false;
    257         else if (inLineMod && qName.equals("linemod"))
     266        } else if (inLineMod && qName.equals("linemod")) {
    258267            inLineMod = false;
    259         else if (inIcon && qName.equals("icon"))
     268        } else if (inIcon && qName.equals("icon")) {
    260269            inIcon = false;
    261         else if (inArea && qName.equals("area"))
     270        } else if (inArea && qName.equals("area")) {
    262271            inArea = false;
    263         else if (qName.equals("scale_max"))
     272        } else if (qName.equals("scale_max")) {
    264273            inScaleMax = false;
    265         else if (qName.equals("scale_min"))
     274        } else if (qName.equals("scale_min")) {
    266275            inScaleMin = false;
     276        }
    267277    }
    268278
    269279    @Override public void characters(char ch[], int start, int length)
    270280    {
    271         if (inScaleMax == true)
     281        if (inScaleMax == true) {
    272282            rule.scaleMax = Long.parseLong(new String(ch, start, length));
    273         else if (inScaleMin == true)
     283        } else if (inScaleMin == true) {
    274284            rule.scaleMin = Long.parseLong(new String(ch, start, length));
     285        }
    275286    }
    276287}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r1971 r2626  
    1717public class ElemStyles
    1818{
    19     public class StyleSet {
     19    public static class StyleSet {
    2020        private HashMap<String, IconElemStyle> icons;
    2121        private HashMap<String, LineElemStyle> lines;
     
    4646                if((style = icons.get("n" + key + "=" + val)) != null)
    4747                {
    48                     if(ret == null || style.priority > ret.priority)
     48                    if(ret == null || style.priority > ret.priority) {
    4949                        ret = style;
     50                    }
    5051                }
    5152                if((style = icons.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val))) != null)
    5253                {
    53                     if(ret == null || style.priority > ret.priority)
     54                    if(ret == null || style.priority > ret.priority) {
    5455                        ret = style;
     56                    }
    5557                }
    5658                if((style = icons.get("x" + key)) != null)
    5759                {
    58                     if(ret == null || style.priority > ret.priority)
     60                    if(ret == null || style.priority > ret.priority) {
    5961                        ret = style;
     62                    }
    6063                }
    6164            }
    6265            for(IconElemStyle s : iconsList)
    6366            {
    64                 if((ret == null || s.priority > ret.priority) && s.check(primitive))
     67                if((ret == null || s.priority > ret.priority) && s.check(primitive)) {
    6568                    ret = s;
     69                }
    6670            }
    6771            return ret;
     
    8084                String idx = "n" + key + "=" + val;
    8185                if((styleArea = areas.get(idx)) != null && (retArea == null
    82                 || styleArea.priority > retArea.priority) && (!noclosed
    83                 || !styleArea.closed))
     86                        || styleArea.priority > retArea.priority) && (!noclosed
     87                                || !styleArea.closed)) {
    8488                    retArea = styleArea;
     89                }
    8590                if((styleLine = lines.get(idx)) != null && (retLine == null
    86                 || styleLine.priority > retLine.priority))
     91                        || styleLine.priority > retLine.priority))
    8792                {
    8893                    retLine = styleLine;
    8994                    linestring = idx;
    9095                }
    91                 if((styleLine = modifiers.get(idx)) != null)
     96                if((styleLine = modifiers.get(idx)) != null) {
    9297                    over.put(idx, styleLine);
     98                }
    9399                idx = "b" + key + "=" + OsmUtils.getNamedOsmBoolean(val);
    94100                if((styleArea = areas.get(idx)) != null && (retArea == null
    95                 || styleArea.priority > retArea.priority) && (!noclosed
    96                 || !styleArea.closed))
     101                        || styleArea.priority > retArea.priority) && (!noclosed
     102                                || !styleArea.closed)) {
    97103                    retArea = styleArea;
     104                }
    98105                if((styleLine = lines.get(idx)) != null && (retLine == null
    99                 || styleLine.priority > retLine.priority))
     106                        || styleLine.priority > retLine.priority))
    100107                {
    101108                    retLine = styleLine;
    102109                    linestring = idx;
    103110                }
    104                 if((styleLine = modifiers.get(idx)) != null)
     111                if((styleLine = modifiers.get(idx)) != null) {
    105112                    over.put(idx, styleLine);
     113                }
    106114                idx = "x" + key;
    107115                if((styleArea = areas.get(idx)) != null && (retArea == null
    108                 || styleArea.priority > retArea.priority) && (!noclosed
    109                 || !styleArea.closed))
     116                        || styleArea.priority > retArea.priority) && (!noclosed
     117                                || !styleArea.closed)) {
    110118                    retArea = styleArea;
     119                }
    111120                if((styleLine = lines.get(idx)) != null && (retLine == null
    112                 || styleLine.priority > retLine.priority))
     121                        || styleLine.priority > retLine.priority))
    113122                {
    114123                    retLine = styleLine;
    115124                    linestring = idx;
    116125                }
    117                 if((styleLine = modifiers.get(idx)) != null)
     126                if((styleLine = modifiers.get(idx)) != null) {
    118127                    over.put(idx, styleLine);
     128                }
    119129            }
    120130            for(AreaElemStyle s : areasList)
    121131            {
    122132                if((retArea == null || s.priority > retArea.priority)
    123                 && (!noclosed || !s.closed) && s.check(primitive))
     133                        && (!noclosed || !s.closed) && s.check(primitive)) {
    124134                    retArea = s;
     135                }
    125136            }
    126137            for(LineElemStyle s : linesList)
    127138            {
    128139                if((retLine == null || s.priority > retLine.priority)
    129                 && s.check(primitive))
     140                        && s.check(primitive)) {
    130141                    retLine = s;
     142                }
    131143            }
    132144            for(LineElemStyle s : modifiersList)
    133145            {
    134                 if(s.check(primitive))
     146                if(s.check(primitive)) {
    135147                    over.put(s.getCode(), s);
     148                }
    136149            }
    137150            over.remove(linestring);
     
    155168        {
    156169            return (!osm.hasKeys()) ? null :
    157             ((osm instanceof Node) ? getNode(osm) : get(osm,
    158             osm instanceof Way && !((Way)osm).isClosed()));
     170                ((osm instanceof Node) ? getNode(osm) : get(osm,
     171                        osm instanceof Way && !((Way)osm).isClosed()));
    159172        }
    160173
     
    187200                    String val = o.get(key);
    188201                    AreaElemStyle s = areas.get("n" + key + "=" + val);
    189                     if(s == null || (s.closed && noclosed))
     202                    if(s == null || (s.closed && noclosed)) {
    190203                        s = areas.get("b" + key + "=" + OsmUtils.getNamedOsmBoolean(val));
    191                     if(s == null || (s.closed && noclosed))
     204                    }
     205                    if(s == null || (s.closed && noclosed)) {
    192206                        s = areas.get("x" + key);
     207                    }
    193208                    if(s != null && !(s.closed && noclosed))
    194209                        return true;
     
    277292    private StyleSet getStyleSet(String name, boolean create)
    278293    {
    279         if(name == null)
     294        if(name == null) {
    280295            name = Main.pref.get("mappaint.style", "standard");
     296        }
    281297
    282298        StyleSet s = styleSet.get(name);
  • trunk/src/org/openstreetmap/josm/gui/preferences/StyleSourceEditor.java

    r2512 r2626  
    217217    }
    218218
    219     class AvailableStylesListModel extends DefaultListModel {
     219    static class AvailableStylesListModel extends DefaultListModel {
    220220        private ArrayList<StyleSourceInfo> data;
    221221        private DefaultListSelectionModel selectionModel;
     
    269269    }
    270270
    271     class ActiveStylesModel extends AbstractTableModel {
     271    static class ActiveStylesModel extends AbstractTableModel {
    272272        private ArrayList<String> data;
    273273        private DefaultListSelectionModel selectionModel;
     
    385385    }
    386386
    387     public class StyleSourceInfo {
     387    public static class StyleSourceInfo {
    388388        String version;
    389389        String name;
     
    522522    }
    523523
    524     class IconPathTableModel extends AbstractTableModel {
     524    static class IconPathTableModel extends AbstractTableModel {
    525525        private ArrayList<String> data;
    526526        private DefaultListSelectionModel selectionModel;
     
    675675    }
    676676
    677     class StyleSourceCellRenderer extends JLabel implements ListCellRenderer {
     677    static class StyleSourceCellRenderer extends JLabel implements ListCellRenderer {
    678678        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
    679679                boolean cellHasFocus) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java

    r2512 r2626  
    3030import javax.swing.table.DefaultTableColumnModel;
    3131import javax.swing.table.TableColumn;
    32 import javax.swing.table.TableColumnModel;
    3332import javax.swing.table.TableModel;
    3433
     
    394393        if (editor == null) {
    395394            logger.warning("editor is null. cannot register OK accelator listener.");
    396         }
    397         editor.getEditor().addKeyListener(l);
     395        } else {
     396            editor.getEditor().addKeyListener(l);
     397        }
    398398    }
    399399
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r2621 r2626  
    667667    }
    668668
    669     private class PresetPanel extends JPanel {
     669    private static class PresetPanel extends JPanel {
    670670        boolean hasElements = false;
    671671        PresetPanel()
  • trunk/src/org/openstreetmap/josm/io/MultiPartFormOutputStream.java

    r2512 r2626  
    88are permitted provided that the following conditions are met:
    99
    10     * Redistribution of source code must retain the above copyright notice, this list
     10 * Redistribution of source code must retain the above copyright notice, this list
    1111      of conditions and the following disclaimer.
    1212
    13     * Redistribution in binary form must reproduce the above copyright notice, this
     13 * Redistribution in binary form must reproduce the above copyright notice, this
    1414      list of conditions and the following disclaimer in the documentation and/or other
    1515      materials provided with the distribution.
     
    3131You acknowledge that this software is not designed, licensed or intended for use in the
    3232design, construction, operation or maintenance of any nuclear facility.
    33 */
     33 */
    3434
    3535package org.openstreetmap.josm.io;
     
    8686     */
    8787    public MultiPartFormOutputStream(OutputStream os, String boundary) {
    88         if(os == null) {
     88        if(os == null)
    8989            throw new IllegalArgumentException("Output stream is required.");
    90         }
    91         if(boundary == null || boundary.length() == 0) {
     90        if(boundary == null || boundary.length() == 0)
    9291            throw new IllegalArgumentException("Boundary stream is required.");
    93         }
    9492        this.out = new DataOutputStream(os);
    9593        this.boundary = boundary;
     
    106104    public void writeField(String name, boolean value)
    107105    throws java.io.IOException {
    108         writeField(name, new Boolean(value).toString());
     106        writeField(name, Boolean.valueOf(value).toString());
    109107    }
    110108
     
    178176    public void writeField(String name, char value)
    179177    throws java.io.IOException {
    180         writeField(name, new Character(value).toString());
     178        writeField(name, Character.valueOf(value).toString());
    181179    }
    182180
     
    191189    public void writeField(String name, String value)
    192190    throws java.io.IOException {
    193         if(name == null) {
     191        if(name == null)
    194192            throw new IllegalArgumentException("Name cannot be null or empty.");
    195         }
    196193        if(value == null) {
    197194            value = "";
     
    229226    public void writeFile(String name, String mimeType, java.io.File file)
    230227    throws java.io.IOException {
    231         if(file == null) {
     228        if(file == null)
    232229            throw new IllegalArgumentException("File cannot be null.");
    233         }
    234         if(!file.exists()) {
     230        if(!file.exists())
    235231            throw new IllegalArgumentException("File does not exist.");
    236         }
    237         if(file.isDirectory()) {
     232        if(file.isDirectory())
    238233            throw new IllegalArgumentException("File cannot be a directory.");
    239         }
    240234        writeFile(name, mimeType, file.getCanonicalPath(), new FileInputStream(file));
    241235    }
     
    254248            String fileName, InputStream is)
    255249    throws java.io.IOException {
    256         if(is == null) {
     250        if(is == null)
    257251            throw new IllegalArgumentException("Input stream cannot be null.");
    258         }
    259         if(fileName == null || fileName.length() == 0) {
     252        if(fileName == null || fileName.length() == 0)
    260253            throw new IllegalArgumentException("File name cannot be null or empty.");
    261         }
    262254        /*
    263255            --boundary\r\n
     
    308300            String fileName, byte[] data)
    309301    throws java.io.IOException {
    310         if(data == null) {
     302        if(data == null)
    311303            throw new IllegalArgumentException("Data cannot be null.");
    312         }
    313         if(fileName == null || fileName.length() == 0) {
     304        if(fileName == null || fileName.length() == 0)
    314305            throw new IllegalArgumentException("File name cannot be null or empty.");
    315         }
    316306        /*
    317307            --boundary\r\n
  • trunk/src/org/openstreetmap/josm/io/NmeaReader.java

    r1724 r2626  
    132132    public GpxData data;
    133133
    134 //  private final static SimpleDateFormat GGATIMEFMT =
    135 //      new SimpleDateFormat("HHmmss.SSS");
     134    //  private final static SimpleDateFormat GGATIMEFMT =
     135    //      new SimpleDateFormat("HHmmss.SSS");
    136136    private final static SimpleDateFormat RMCTIMEFMT =
    137137        new SimpleDateFormat("ddMMyyHHmmss.SSS");
     
    142142    {
    143143        Date d = RMCTIMEFMT.parse(p, new ParsePosition(0));
     144        if (d == null) {
     145            d = RMCTIMEFMTSTD.parse(p, new ParsePosition(0));
     146        }
    144147        if (d == null)
    145             d = RMCTIMEFMTSTD.parse(p, new ParsePosition(0));
    146         if (d == null) throw(null); // malformed
     148            throw new RuntimeException("Date is malformed"); // malformed
    147149        return d;
    148150    }
     
    181183            int loopstart_char = rd.read();
    182184            ps = new NMEAParserState();
    183             if(loopstart_char == -1) {// zero size file
     185            if(loopstart_char == -1)
    184186                //TODO tell user about the problem?
    185187                return;
    186             }
    187188            sb.append((char)loopstart_char);
    188189            ps.p_Date="010100"; // TODO date problem
    189190            while(true) {
    190191                // don't load unparsable files completely to memory
    191                 if(sb.length()>=1020) sb.delete(0, sb.length()-1);
     192                if(sb.length()>=1020) {
     193                    sb.delete(0, sb.length()-1);
     194                }
    192195                int c = rd.read();
    193196                if(c=='$') {
     
    199202                    ParseNMEASentence(sb.toString(),ps);
    200203                    break;
    201                 } else sb.append((char)c);
     204                } else {
     205                    sb.append((char)c);
     206                }
    202207            }
    203208            rd.close();
     
    209214        }
    210215    }
    211     private class NMEAParserState {
     216    private static class NMEAParserState {
    212217        protected Collection<WayPoint> waypoints = new ArrayList<WayPoint>();
    213218        protected String p_Time;
     
    239244                byte[] chb = chkstrings[0].getBytes();
    240245                int chk=0;
    241                 for(int i = 1; i < chb.length; i++) chk ^= chb[i];
     246                for(int i = 1; i < chb.length; i++) {
     247                    chk ^= chb[i];
     248                }
    242249                if(Integer.parseInt(chkstrings[1].substring(0,2),16) != chk) {
    243250                    //System.out.println("Checksum error");
     
    246253                    return false;
    247254                }
     255            } else {
     256                ps.no_checksum++;
    248257            }
    249             else
    250                 ps.no_checksum++;
    251258            // now for the content
    252259            String[] e = chkstrings[0].split(",");
     
    264271                        e[GPGGA.LATITUDE.position],
    265272                        e[GPGGA.LONGITUDE.position]
    266                     );
     273                );
    267274                if(latLon==null) throw(null); // malformed
    268275
     
    291298                accu=e[GPGGA.HEIGHT_UNTIS.position];
    292299                if(accu.equals("M")) {
    293                         // Ignore heights that are not in meters for now
    294                         accu=e[GPGGA.HEIGHT.position];
    295                         if(!accu.equals("")) {
     300                    // Ignore heights that are not in meters for now
     301                    accu=e[GPGGA.HEIGHT.position];
     302                    if(!accu.equals("")) {
    296303                        Double.parseDouble(accu);
    297304                        // if it throws it's malformed; this should only happen if the
    298305                        // device sends nonstandard data.
    299                         if(!accu.equals("")) currentwp.attr.put("ele", accu);
     306                        if(!accu.equals("")) {
     307                            currentwp.attr.put("ele", accu);
     308                        }
    300309                    }
    301310                }
     
    309318                // h-dilution
    310319                accu=e[GPGGA.HDOP.position];
    311                 if(!accu.equals(""))
     320                if(!accu.equals("")) {
    312321                    currentwp.attr.put("hdop", Float.parseFloat(accu));
     322                }
    313323                // fix
    314324                accu=e[GPGGA.QUALITY.position];
     
    320330                        break;
    321331                    case 1:
    322                         if(sat < 4) currentwp.attr.put("fix", "2d");
    323                         else currentwp.attr.put("fix", "3d");
     332                        if(sat < 4) {
     333                            currentwp.attr.put("fix", "2d");
     334                        } else {
     335                            currentwp.attr.put("fix", "3d");
     336                        }
    324337                        break;
    325338                    case 2:
     
    354367                // vdop
    355368                accu=e[GPGSA.VDOP.position];
    356                 if(!accu.equals(""))
     369                if(!accu.equals("")) {
    357370                    currentwp.attr.put("vdop", Float.parseFloat(accu));
     371                }
    358372                // hdop
    359373                accu=e[GPGSA.HDOP.position];
    360                 if(!accu.equals(""))
     374                if(!accu.equals("")) {
    361375                    currentwp.attr.put("hdop", Float.parseFloat(accu));
     376                }
    362377                // pdop
    363378                accu=e[GPGSA.PDOP.position];
    364                 if(!accu.equals(""))
     379                if(!accu.equals("")) {
    365380                    currentwp.attr.put("pdop", Float.parseFloat(accu));
     381                }
    366382            }
    367383            else if(e[0].equals("$GPRMC")) {
     
    372388                        e[GPRMC.WIDTH_NORTH.position],
    373389                        e[GPRMC.LENGTH_EAST.position]
    374                     );
    375                 if(latLon==null) throw(null);
     390                );
    376391                if((latLon.lat()==0.0) && (latLon.lon()==0.0)) {
    377392                    ps.zero_coord++;
     
    439454
    440455    private LatLon parseLatLon(String ns, String ew, String dlat, String dlon)
    441         throws NumberFormatException {
     456    throws NumberFormatException {
    442457        String widthNorth = dlat.trim();
    443458        String lengthEast = dlon.trim();
     
    456471        int latdeg = Integer.parseInt(widthNorth.substring(0, latdegsep));
    457472        double latmin = Double.parseDouble(widthNorth.substring(latdegsep));
    458         if(latdeg < 0) // strange data with '-' sign
     473        if(latdeg < 0) {
    459474            latmin *= -1.0;
     475        }
    460476        double lat = latdeg + latmin / 60;
    461477        if ("S".equals(ns)) {
     
    468484        int londeg = Integer.parseInt(lengthEast.substring(0, londegsep));
    469485        double lonmin = Double.parseDouble(lengthEast.substring(londegsep));
    470         if(londeg < 0) // strange data with '-' sign
     486        if(londeg < 0) {
    471487            lonmin *= -1.0;
     488        }
    472489        double lon = londeg + lonmin / 60;
    473490        if ("W".equals(ew)) {
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r2609 r2626  
    557557                    } else if (rm.type.equals("relation")) {
    558558                        primitive = new Relation(rm.id);
    559                     } else {
     559                    } else
    560560                        // can't happen, we've been testing for valid member types
    561561                        // at the beginning of this method
    562562                        //
    563                     }
     563                        throw new AssertionError();
    564564                    ds.addPrimitive(primitive);
    565565                    externalIdMap.put(new SimplePrimitiveId(rm.id, OsmPrimitiveType.fromApiTypeName(rm.type)), primitive);
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r2540 r2626  
    3131                String bbox[] = map.get("bbox").split(",");
    3232                b = new Bounds(
    33                     new LatLon(Double.parseDouble(bbox[1]), Double.parseDouble(bbox[0])),
    34                     new LatLon(Double.parseDouble(bbox[3]), Double.parseDouble(bbox[2])));
     33                        new LatLon(Double.parseDouble(bbox[1]), Double.parseDouble(bbox[0])),
     34                        new LatLon(Double.parseDouble(bbox[3]), Double.parseDouble(bbox[2])));
    3535            } else if (map.containsKey("minlat")) {
    3636                String s = map.get("minlat");
     
    4545            } else {
    4646                b = positionToBounds(parseDouble(map, "lat"),
    47                                      parseDouble(map, "lon"),
    48                                      Integer.parseInt(map.get("zoom")));
     47                        parseDouble(map, "lon"),
     48                        Integer.parseInt(map.get("zoom")));
    4949            }
    5050        } catch (NumberFormatException x) {
     
    8181     */
    8282    private static Bounds parseShortLink(final String url) {
    83         if (!url.startsWith(SHORTLINK_PREFIX)) {
     83        if (!url.startsWith(SHORTLINK_PREFIX))
    8484            return null;
    85         }
    8685        final String shortLink = url.substring(SHORTLINK_PREFIX.length());
    8786
     
    125124        // 2**32 == 4294967296
    126125        return positionToBounds(y * 180.0 / 4294967296.0 - 90.0,
    127                                 x * 360.0 / 4294967296.0 - 180.0,
    128                                 // TODO: -2 was not in ruby code
    129                                 zoom - 8 - (zoomOffset % 3) - 2);
     126                x * 360.0 / 4294967296.0 - 180.0,
     127                // TODO: -2 was not in ruby code
     128                zoom - 8 - (zoomOffset % 3) - 2);
    130129    }
    131130
     
    133132        final double size = 180.0 / Math.pow(2, zoom);
    134133        return new Bounds(
    135                           new LatLon(lat - size/2, lon - size),
    136                           new LatLon(lat + size/2, lon + size));
     134                new LatLon(lat - size/2, lon - size),
     135                new LatLon(lat + size/2, lon + size));
    137136    }
    138137
     
    144143        int zoom = 0;
    145144        while (zoom <= 20) {
    146             if (size >= 180)
     145            if (size >= 180) {
    147146                break;
     147            }
    148148            size *= 2;
    149149            zoom++;
     
    163163        double lon = (Math.round(pos.lon() * decimals));
    164164        lon /= decimals;
    165         return new String("http://www.openstreetmap.org/?lat="+lat+"&lon="+lon+"&zoom="+zoom);
     165        return "http://www.openstreetmap.org/?lat="+lat+"&lon="+lon+"&zoom="+zoom;
    166166    }
    167167}
  • trunk/src/org/openstreetmap/josm/tools/Pair.java

    r1169 r2626  
    1818    }
    1919
    20     @Override public boolean equals(Object o) {
    21         return o == null ? o == null : o instanceof Pair
    22             && a.equals(((Pair<?,?>) o).a) && b.equals(((Pair<?,?>) o).b);
     20    @Override public boolean equals(Object other) {
     21        if (other instanceof Pair<?, ?>) {
     22            Pair<?, ?> o = (Pair<?, ?>)other;
     23            return a.equals(o.a) && b.equals(o.b);
     24        } else
     25            return false;
    2326    }
    2427
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r2017 r2626  
    273273        // pull in the groups
    274274        for (int i = GROUP_NONE; i < GROUP__MAX+GROUPS_ALT2*2; i++) { // fill more groups, so registering with e.g. ALT2+MNEMONIC won't NPE
    275             groups.put(new Integer(i), new Integer(Main.pref.getInteger("shortcut.groups."+i, -1)));
     275            groups.put(i, Main.pref.getInteger("shortcut.groups."+i, -1));
    276276        }
    277277        // (1) System reserved shortcuts
Note: See TracChangeset for help on using the changeset viewer.