Changeset 4874 in josm for trunk


Ignore:
Timestamp:
2012-01-26T21:52:34+01:00 (13 years ago)
Author:
jttt
Message:

Use static class were appropriate

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

Legend:

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

    r4733 r4874  
    22package org.openstreetmap.josm.actions;
    33
     4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    66
    77import java.awt.event.ActionEvent;
     
    1616
    1717import org.openstreetmap.josm.Main;
    18 import org.openstreetmap.josm.actions.ExtensionFileFilter;
    1918import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    2019import org.openstreetmap.josm.gui.PleaseWaitRunnable;
     
    5756    }
    5857
    59     public class Loader extends PleaseWaitRunnable {
     58    public static class Loader extends PleaseWaitRunnable {
    6059
    6160        private boolean canceled;
     
    8988                    for (Runnable task : postLoadTasks) {
    9089                        if (canceled) return;
    91                         if (task == null) continue;
     90                        if (task == null) {
     91                            continue;
     92                        }
    9293                        task.run();
    9394                    }
     
    112113                        JOptionPane.ERROR_MESSAGE,
    113114                        null
    114                 );
     115                        );
    115116                cancel();
    116117            } catch (IOException e) {
     
    122123                        JOptionPane.ERROR_MESSAGE,
    123124                        null
    124                 );
     125                        );
    125126                cancel();
    126127            } catch (RuntimeException e) {
  • trunk/src/org/openstreetmap/josm/actions/ValidateAction.java

    r4076 r4874  
    3434 */
    3535public class ValidateAction extends JosmAction {
    36    
     36
    3737    /** Serializable ID */
    3838    private static final long serialVersionUID = -2304521273582574603L;
     
    4646    public ValidateAction() {
    4747        super(tr("Validation"), "dialogs/validator", tr("Performs the data validation"),
    48         Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")), KeyEvent.VK_V, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
     48                Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")), KeyEvent.VK_V, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
    4949    }
    5050
     
    106106     *
    107107     */
    108     class ValidationTask extends PleaseWaitRunnable {
     108    static class ValidationTask extends PleaseWaitRunnable {
    109109        private Collection<Test> tests;
    110110        private Collection<OsmPrimitive> validatedPrimitives;
     
    154154        @Override
    155155        protected void realRun() throws SAXException, IOException,
    156                 OsmTransferException {
     156        OsmTransferException {
    157157            if (tests == null || tests.isEmpty())
    158158                return;
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeTask.java

    r4734 r4874  
    5757        return Main.worker.submit(downloadTask);
    5858    }
    59    
     59
    6060    protected class DownloadTask extends DownloadOsmTask.DownloadTask {
    6161
     
    114114     *
    115115     */
    116     private class HistoryListener implements HistoryDataSetListener {
     116    private static class HistoryListener implements HistoryDataSetListener {
    117117
    118118        private final List<Pair<OsmPrimitive, Date>> toMonitor;
    119        
     119
    120120        public HistoryListener(List<Pair<OsmPrimitive, Date>> toMonitor) {
    121121            this.toMonitor = toMonitor;
     
    133133                    if (hp != null) {
    134134                        PrimitiveData data = null;
    135                        
     135
    136136                        switch (pair.a.getType()) {
    137                             case NODE:
    138                                 data = new NodeData();
    139                                 ((NodeData)data).setCoor(((HistoryNode)hp).getCoords());
    140                                 break;
    141                             case WAY:
    142                                 data = new WayData();
    143                                 ((WayData)data).setNodes(((HistoryWay)hp).getNodes());
    144                                 break;
    145                             case RELATION:
    146                                 data = new RelationData();
    147                                 ((RelationData)data).setMembers(((HistoryRelation)hp).getMembers());
    148                                 break;
    149                             default: throw new AssertionError();
     137                        case NODE:
     138                            data = new NodeData();
     139                            ((NodeData)data).setCoor(((HistoryNode)hp).getCoords());
     140                            break;
     141                        case WAY:
     142                            data = new WayData();
     143                            ((WayData)data).setNodes(((HistoryWay)hp).getNodes());
     144                            break;
     145                        case RELATION:
     146                            data = new RelationData();
     147                            ((RelationData)data).setMembers(((HistoryRelation)hp).getMembers());
     148                            break;
     149                        default: throw new AssertionError();
    150150                        }
    151                        
     151
    152152                        data.setUser(hp.getUser());
    153153                        data.setVisible(hp.isVisible());
     
    155155                        data.setKeys(hp.getTags());
    156156                        data.setOsmId(hp.getChangesetId(), (int) hp.getVersion());
    157                        
     157
    158158                        // Load the history data
    159159                        pair.a.load(data);
  • trunk/src/org/openstreetmap/josm/data/APIDataSet.java

    r4534 r4874  
    7373        OsmPrimitiveComparator c = new OsmPrimitiveComparator();
    7474        c.relationsFirst = true;
    75         Collections.sort(toDelete, c); 
    76         Collections.sort(toAdd, c); 
    77         Collections.sort(toUpdate, c); 
     75        Collections.sort(toDelete, c);
     76        Collections.sort(toAdd, c);
     77        Collections.sort(toUpdate, c);
    7878    }
    7979
     
    154154        OsmPrimitiveComparator c = new OsmPrimitiveComparator();
    155155        c.relationsFirst = true;
    156         Collections.sort(toDelete, c); 
    157         Collections.sort(toAdd, c); 
    158         Collections.sort(toUpdate, c); 
     156        Collections.sort(toDelete, c);
     157        Collections.sort(toAdd, c);
     158        Collections.sort(toUpdate, c);
    159159    }
    160160
     
    278278     *
    279279     */
    280     private class RelationUploadDependencyGraph {
     280    private static class RelationUploadDependencyGraph {
    281281        private HashMap<Relation, Set<Relation>> children;
    282282        private Collection<Relation> relations;
     
    353353                        }
    354354                    }
    355             );
     355                    );
    356356            return ret;
    357357        }
  • trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java

    r4612 r4874  
    1515import java.net.URL;
    1616import java.net.URLConnection;
    17 import java.util.Collection;
    18 import java.util.Collections;
    19 import java.util.LinkedList;
    20 import java.util.StringTokenizer;
    21 import java.util.Map.Entry;
    2217
    2318import javax.swing.JOptionPane;
     
    2621import org.openstreetmap.josm.Main;
    2722import org.openstreetmap.josm.io.OsmConnection;
    28 import org.openstreetmap.josm.io.OsmTransferException;
    2923import org.openstreetmap.josm.tools.Base64;
    3024
     
    3630 */
    3731public class ServerSidePreferences extends Preferences {
    38     public class MissingPassword extends Exception{
     32    public static class MissingPassword extends Exception{
    3933        public String realm;
    4034        public MissingPassword(String r) {
     
    5650                String username = get("applet.username");
    5751                String password = get("applet.password");
    58                 if(password.isEmpty() && username.isEmpty())
     52                if(password.isEmpty() && username.isEmpty()) {
    5953                    con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+":"+password));
     54                }
    6055                con.connect();
    6156                if(username.isEmpty() && con instanceof HttpURLConnection
    62                     && ((HttpURLConnection) con).getResponseCode()
    63                     == HttpURLConnection.HTTP_UNAUTHORIZED) {
     57                        && ((HttpURLConnection) con).getResponseCode()
     58                        == HttpURLConnection.HTTP_UNAUTHORIZED) {
    6459                    String t = ((HttpURLConnection) con).getHeaderField("WWW-Authenticate");
    6560                    t = t.replace("Basic realm=\"","").replace("\"","");
     
    8883                String username = get("applet.username");
    8984                String password = get("applet.password");
    90                 if(password.isEmpty() && username.isEmpty())
     85                if(password.isEmpty() && username.isEmpty()) {
    9186                    con.addRequestProperty("Authorization", "Basic "+Base64.encode(username+":"+password));
     87                }
    9288                con.setRequestMethod("POST");
    9389                con.setDoOutput(true);
     
    10399                        tr("Information"),
    104100                        JOptionPane.INFORMATION_MESSAGE
    105                 );
     101                        );
    106102            } catch (Exception e) {
    107103                e.printStackTrace();
     
    111107                        tr("Error"),
    112108                        JOptionPane.ERROR_MESSAGE
    113                 );
     109                        );
    114110            }
    115111        }
     
    127123                    tr("Error"),
    128124                    JOptionPane.ERROR_MESSAGE
    129             );
     125                    );
    130126        }
    131127        this.connection = connection;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DeprecatedTags.java

    r4806 r4874  
    11package org.openstreetmap.josm.data.validation.tests;
    22
    3 import org.openstreetmap.josm.data.osm.Node;
    4 import org.openstreetmap.josm.data.osm.Relation;
    5 import org.openstreetmap.josm.data.osm.Way;
    63import static org.openstreetmap.josm.tools.I18n.tr;
    74
     
    96import java.util.LinkedList;
    107import java.util.List;
     8
    119import org.openstreetmap.josm.command.ChangePropertyCommand;
    1210import org.openstreetmap.josm.command.Command;
    1311import org.openstreetmap.josm.command.SequenceCommand;
     12import org.openstreetmap.josm.data.osm.Node;
    1413import org.openstreetmap.josm.data.osm.OsmPrimitive;
     14import org.openstreetmap.josm.data.osm.Relation;
    1515import org.openstreetmap.josm.data.osm.Tag;
     16import org.openstreetmap.josm.data.osm.Way;
    1617import org.openstreetmap.josm.data.validation.Severity;
    1718import org.openstreetmap.josm.data.validation.Test;
     
    9798    }
    9899
    99     private class DeprecationCheck {
     100    private static class DeprecationCheck {
    100101
    101102        int code;
     
    148149                String key = tag.getKey();
    149150                String value = tag.getValue();
    150                 if (value.isEmpty() && !p.hasKey(key)) {
     151                if (value.isEmpty() && !p.hasKey(key))
    151152                    return false;
    152                 }
    153                 if (!value.isEmpty() && !value.equals(p.get(key))) {
     153                if (!value.isEmpty() && !value.equals(p.get(key)))
    154154                    return false;
    155                 }
    156155            }
    157156            return true;
     
    167166
    168167        String getDescription() {
    169             if (alternatives.isEmpty()) {
     168            if (alternatives.isEmpty())
    170169                return tr("{0} is deprecated", Utils.join(", ", test));
    171             } else {
     170            else
    172171                return tr("{0} is deprecated, use {1} instead", Utils.join(", ", test), Utils.join(tr(" or "), alternatives));
    173             }
    174172        }
    175173    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r4869 r4874  
    3939public class DuplicateNode extends Test {
    4040
    41     private class NodeHash implements Hash<Object, Object> {
     41    private static class NodeHash implements Hash<Object, Object> {
    4242
    4343        double precision = Main.pref.getDouble("validator.duplicatenodes.precision", 0.);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java

    r4869 r4874  
    3434{
    3535
    36     public class RelMember {
     36    public static class RelMember {
    3737        private String role;
    3838        private OsmPrimitiveType type;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java

    r4869 r4874  
    3434{
    3535
    36     private class WayPair {
     36    private static class WayPair {
    3737        public List<LatLon> coor;
    3838        public Map<String, String> keys;
     
    5656    }
    5757
    58     private class WayPairNoTags {
     58    private static class WayPairNoTags {
    5959        public List<LatLon> coor;
    6060        public WayPairNoTags(List<LatLon> _coor) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r4869 r4874  
    7070    }
    7171
    72     public class RoleInfo {
     72    public static class RoleInfo {
    7373        int total = 0;
    7474        Collection<Node> nodes = new LinkedList<Node>();
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r4869 r4874  
    12171217    }
    12181218
    1219     private class CursorInfo {
     1219    private static class CursorInfo {
    12201220        public Cursor cursor;
    12211221        public Object object;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r4363 r4874  
    143143
    144144        createLayout(p, true, Arrays.asList(new SideButton[] {
    145             new SideButton(onoffAction),
    146             new SideButton(upAction),
    147             new SideButton(downAction),
    148             new SideButton(new LaunchMapPaintPreferencesAction())
     145                new SideButton(onoffAction),
     146                new SideButton(upAction),
     147                new SideButton(downAction),
     148                new SideButton(new LaunchMapPaintPreferencesAction())
    149149        }));
    150150    }
     
    359359     * Opens preferences window and selects the mappaint tab.
    360360     */
    361     class LaunchMapPaintPreferencesAction extends AbstractAction {
     361    static class LaunchMapPaintPreferencesAction extends AbstractAction {
    362362        public LaunchMapPaintPreferencesAction() {
    363363            putValue(SMALL_ICON, ImageProvider.get("dialogs", "mappaintpreference"));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationNodeMap.java

    r3788 r4874  
    3030 */
    3131public class RelationNodeMap {
    32     private class NodesWays{
     32    private static class NodesWays{
    3333        public Map<Node, Set<Integer>> nodes = new TreeMap<Node, Set<Integer>>();
    3434        public Map<Integer, Set<Node>> ways = new TreeMap<Integer, Set<Node>>();
     
    108108         * cannot be used in future. (only for performance)
    109109         */
    110 //        Iterator<Map.Entry<Node,TreeSet<Integer>>> it = map.nodes.entrySet().iterator();
    111 //        while (it.hasNext()) {
    112 //            Map.Entry<Node,TreeSet<Integer>> nodeLinks = it.next();
    113 //
    114 //            if (nodeLinks.getValue().size() < 2) {
    115 //                if (nodeLinks.getValue().size() != 1) throw new AssertionError();
    116 //
    117 //                Integer d_way = nodeLinks.getValue().iterator().next();
    118 //                TreeSet<Node> d_way_nodes = map.ways.get(d_way);
    119 //                d_way_nodes.remove(nodeLinks.getKey());
    120 //
    121 //                it.remove();
    122 //                continue;
    123 //            }
    124 //        }
    125             }
     110        //        Iterator<Map.Entry<Node,TreeSet<Integer>>> it = map.nodes.entrySet().iterator();
     111        //        while (it.hasNext()) {
     112        //            Map.Entry<Node,TreeSet<Integer>> nodeLinks = it.next();
     113        //
     114        //            if (nodeLinks.getValue().size() < 2) {
     115        //                if (nodeLinks.getValue().size() != 1) throw new AssertionError();
     116        //
     117        //                Integer d_way = nodeLinks.getValue().iterator().next();
     118        //                TreeSet<Node> d_way_nodes = map.ways.get(d_way);
     119        //                d_way_nodes.remove(nodeLinks.getKey());
     120        //
     121        //                it.remove();
     122        //                continue;
     123        //            }
     124        //        }
     125    }
    126126
    127127    private void addPair(Node n, int i) {
     
    211211            }
    212212        }
    213        
     213
    214214        firstOneway = way;
    215215        return popForwardOnewayPart(way);
     
    220220            for (Node n : onewayMap.ways.get(way)) {
    221221                Integer i = findAdjacentWay(onewayMap, n);
    222                 if(i == null) continue;
     222                if(i == null) {
     223                    continue;
     224                }
    223225
    224226                lastOnewayNode = processBackwardIfEndOfLoopReached(i);
    225                 if(lastOnewayNode != null){
     227                if(lastOnewayNode != null)
    226228                    return popBackwardOnewayPart(firstOneway);
    227                 }
    228229
    229230                deleteWayNode(onewayMap, i, n);
     
    231232            }
    232233        }
    233        
     234
    234235        firstOneway = null;
    235236        return null;
     
    240241            for (Node n : onewayReverseMap.ways.get(way)) {
    241242                if((map.nodes.containsKey(n))
    242                         || (onewayMap.nodes.containsKey(n) && onewayMap.nodes.get(n).size() > 1)) {
     243                        || (onewayMap.nodes.containsKey(n) && onewayMap.nodes.get(n).size() > 1))
    243244                    return n;
    244                 }
    245                 if(firstCircular != null && firstCircular == n) {
     245                if(firstCircular != null && firstCircular == n)
    246246                    return firstCircular;
    247                 }
    248247            }
    249248        }
    250249        return null;
    251250    }
    252    
     251
    253252    private Integer popBackwardOnewayPart(int way){
    254253        if (lastOnewayNode != null) {
    255254            TreeSet<Node> nodes = new TreeSet<Node>();
    256             if (onewayReverseMap.ways.containsKey(way)) nodes.addAll(onewayReverseMap.ways.get(way));
    257             if (map.ways.containsKey(way)) nodes.addAll(map.ways.get(way));
     255            if (onewayReverseMap.ways.containsKey(way)) {
     256                nodes.addAll(onewayReverseMap.ways.get(way));
     257            }
     258            if (map.ways.containsKey(way)) {
     259                nodes.addAll(map.ways.get(way));
     260            }
    258261            for (Node n : nodes) {
    259262                if(n == lastOnewayNode) { //if oneway part ends
     
    277280        firstOneway = null;
    278281        lastOnewayNode = null;
    279        
     282
    280283        return null;
    281284    }
     
    302305
    303306    private void deleteWayNode(NodesWays nw, Integer way, Node n){
    304         if(nw.oneWay)
     307        if(nw.oneWay) {
    305308            doneOneway(way);
    306         else
     309        } else {
    307310            done(way);
     311        }
    308312        nw.ways.get(way).remove(n);
    309313    }
     
    343347        Set<Node> nodesForward = remainingOneway.get(i);
    344348        for (Node n : nodesForward) {
    345             if(onewayMap.nodes.containsKey(n)) onewayMap.nodes.get(n).remove(i);
    346             if(onewayReverseMap.nodes.containsKey(n)) onewayReverseMap.nodes.get(n).remove(i);
     349            if(onewayMap.nodes.containsKey(n)) {
     350                onewayMap.nodes.get(n).remove(i);
     351            }
     352            if(onewayReverseMap.nodes.containsKey(n)) {
     353                onewayReverseMap.nodes.get(n).remove(i);
     354            }
    347355        }
    348356        remainingOneway.remove(i);
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r4729 r4874  
    66import java.io.BufferedReader;
    77import java.io.DataOutputStream;
     8import java.io.IOException;
    89import java.io.InputStreamReader;
    9 import java.io.IOException;
    1010import java.io.UnsupportedEncodingException;
    1111import java.lang.reflect.Field;
     
    4646    private HttpURLConnection connection;
    4747
    48     private class SessionId {
     48    private static class SessionId {
    4949        String id;
    5050        String token;
     
    209209            while((c = r.readLine()) != null) {
    210210                Matcher m = p.matcher(c);
    211                 if(m.find()) {
     211                if(m.find())
    212212                    return m.group(1);
    213                 }
    214213            }
    215214        } catch (IOException e) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/AddWMSLayerPanel.java

    r4802 r4874  
    147147                            if(!previouslyShownUnsupportedCrsError) {
    148148                                JOptionPane.showMessageDialog(null, tr("That layer does not support any of JOSM''s projections,\n" +
    149                                 "so you can not use it. This message will not show again."),
    150                                 tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
     149                                        "so you can not use it. This message will not show again."),
     150                                        tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
    151151                                previouslyShownUnsupportedCrsError = true;
    152152                            }
     
    223223        resultingLayerField = new JTextArea(3, 40);
    224224        resultingLayerField.setLineWrap(true);
    225         JScrollPane bottomScrollPane = new JScrollPane(resultingLayerField, 
     225        JScrollPane bottomScrollPane = new JScrollPane(resultingLayerField,
    226226                JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    227227        bottomScrollPane.setMinimumSize(new Dimension(60, 60));
     
    250250        StringBuilder a = new StringBuilder("tms");
    251251        String z = sanitize(tmsZoom.getText());
    252         if(!z.isEmpty())
     252        if(!z.isEmpty()) {
    253253            a.append("["+z+"]");
     254        }
    254255        a.append(":");
    255256        a.append(sanitize(tmsURL.getText()));
     
    493494        for (Projection proj : Projections.getProjections()) {
    494495            if (proj instanceof ProjectionSubPrefs) {
    495                 if (((ProjectionSubPrefs) proj).getPreferencesFromCode(crs) == null) {
     496                if (((ProjectionSubPrefs) proj).getPreferencesFromCode(crs) == null)
    496497                    return true;
    497                 }
    498498            } else {
    499                 if (proj.toCode().equals(crs)) {
     499                if (proj.toCode().equals(crs))
    500500                    return true;
    501                 }
    502501            }
    503502        }
     
    511510        } else if (selectedLayers != null) {
    512511            HashSet<String> proj = new HashSet<String>();
    513             for(LayerDetails l : selectedLayers)
     512            for(LayerDetails l : selectedLayers) {
    514513                proj.addAll(l.getProjections());
     514            }
    515515            info.setServerProjections(proj);
    516516        }
     
    520520    private static String getChildContent(Element parent, String name, String missing, String empty) {
    521521        Element child = getChild(parent, name);
    522         if (child == null) {
     522        if (child == null)
    523523            return missing;
    524         } else {
     524        else {
    525525            String content = (String) getContent(child);
    526526            return (content != null) ? content : empty;
     
    556556
    557557    private static Element getChild(Element parent, String name) {
    558         if (parent == null) {
     558        if (parent == null)
    559559            return null;
    560         }
    561560        for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
    562             if (child instanceof Element && name.equals(child.getNodeName())) {
     561            if (child instanceof Element && name.equals(child.getNodeName()))
    563562                return (Element) child;
    564             }
    565563        }
    566564        return null;
    567565    }
    568566
    569     class LayerDetails {
     567    static class LayerDetails {
    570568
    571569        private String name;
     
    597595        @Override
    598596        public String toString() {
    599             if(this.name == null || this.name.isEmpty()) {
     597            if(this.name == null || this.name.isEmpty())
    600598                return this.ident;
    601             } else {
     599            else
    602600                return this.name;
    603             }
    604         }
    605 
    606     }
    607 
    608     class LayerTreeCellRenderer extends DefaultTreeCellRenderer {
     601        }
     602
     603    }
     604
     605    static class LayerTreeCellRenderer extends DefaultTreeCellRenderer {
    609606        @Override
    610607        public Component getTreeCellRendererComponent(JTree tree, Object value,
  • trunk/src/org/openstreetmap/josm/gui/preferences/ImageryPreference.java

    r4577 r4874  
    282282        p.add(pane,GBC.std().fill(GBC.BOTH));
    283283    }
    284    
     284
    285285    public ImageryProvidersPanel getProvidersPanel() {
    286286        return imageryProviders;
     
    391391        public final ImageryLayerTableModel activeModel;
    392392        public final ImageryDefaultLayerTableModel defaultModel;
    393        
     393
    394394        // Public JToolbars
    395395        public final JToolBar activeToolbar;
     
    400400        private final PreferenceTabbedPane gui;
    401401        private final ImageryLayerInfo layerInfo;
    402        
    403         private class ImageryTableCellRenderer extends DefaultTableCellRenderer {
    404            
     402
     403        private static class ImageryTableCellRenderer extends DefaultTableCellRenderer {
     404
    405405            private List<ImageryInfo> layers;
    406            
     406
    407407            public ImageryTableCellRenderer(List<ImageryInfo> layers) {
    408408                this.layers = layers;
    409409            }
    410            
     410
    411411            @Override
    412412            public Component getTableCellRendererComponent(JTable table, Object value, boolean
    413             isSelected, boolean hasFocus, int row, int column) {
     413                    isSelected, boolean hasFocus, int row, int column) {
    414414                JLabel label = (JLabel) super.getTableCellRendererComponent(
    415                 table, value, isSelected, hasFocus, row, column);
     415                        table, value, isSelected, hasFocus, row, column);
    416416                String t = value.toString();
    417417                label.setBackground(Main.pref.getUIColor("Table.background"));
     
    423423                    if(l.getExtendedUrl().equals(t)) {
    424424                        label.setBackground(Main.pref.getColor(
    425                         marktr("Imagery Background: Default"),
    426                         new Color(200,255,200)));
     425                                marktr("Imagery Background: Default"),
     426                                new Color(200,255,200)));
    427427                        break;
    428428                    }
     
    456456
    457457            defaultModel.addTableModelListener(
    458                 new TableModelListener() {
    459                     @Override
    460                     public void tableChanged(TableModelEvent e) {
    461                         activeTable.repaint();
    462                     }
    463                 }
    464             );
     458                    new TableModelListener() {
     459                        @Override
     460                        public void tableChanged(TableModelEvent e) {
     461                            activeTable.repaint();
     462                        }
     463                    }
     464                    );
    465465
    466466            activeModel.addTableModelListener(
    467                 new TableModelListener() {
    468                     @Override
    469                     public void tableChanged(TableModelEvent e) {
    470                         defaultTable.repaint();
    471                     }
    472                 }
    473             );
     467                    new TableModelListener() {
     468                        @Override
     469                        public void tableChanged(TableModelEvent e) {
     470                            defaultTable.repaint();
     471                        }
     472                    }
     473                    );
    474474
    475475            TableColumnModel mod = defaultTable.getColumnModel();
     
    592592                            mapPolygons.remove(i);
    593593                        }
    594                      // Only display bounds when no polygons (shapes) are defined for this provider
     594                        // Only display bounds when no polygons (shapes) are defined for this provider
    595595                    } else {
    596596                        if (defaultTable.getSelectionModel().isSelectedIndex(i)) {
     
    643643                        activeModel.addRow(p.getImageryInfo());
    644644                    } catch (IllegalArgumentException ex) {
    645                         if (ex.getMessage() == null || ex.getMessage().isEmpty()) {
     645                        if (ex.getMessage() == null || ex.getMessage().isEmpty())
    646646                            throw ex;
    647                         } else {
     647                        else {
    648648                            JOptionPane.showMessageDialog(Main.parent,
    649649                                    ex.getMessage(), tr("Error"),
     
    709709                    return;
    710710                }
    711                
     711
    712712                Set<String> acceptedEulas = new HashSet<String>();
    713713
  • trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java

    r4839 r4874  
    3232
    3333    public static final boolean registerSourceProvider(SourceProvider provider) {
    34         if (provider != null) {
     34        if (provider != null)
    3535            return styleSourceProviders.add(provider);
    36         }
    3736        return false;
    3837    }
    39    
     38
    4039    public static class Factory implements PreferenceSettingFactory {
    4140        public PreferenceSetting createPreferenceSetting() {
     
    6968                    }
    7069                }
    71         );
    72     }
    73 
    74     class MapPaintSourceEditor extends SourceEditor {
     70                );
     71    }
     72
     73    static class MapPaintSourceEditor extends SourceEditor {
    7574
    7675        final private String iconpref = "mappaint.icon.sources";
     
    118117        public String getStr(I18nString ident) {
    119118            switch (ident) {
    120                 case AVAILABLE_SOURCES:
    121                     return tr("Available styles:");
    122                 case ACTIVE_SOURCES:
    123                     return tr("Active styles:");
    124                 case NEW_SOURCE_ENTRY_TOOLTIP:
    125                      return tr("Add a new style by entering filename or URL");
    126                 case NEW_SOURCE_ENTRY:
    127                     return tr("New style entry:");
    128                 case REMOVE_SOURCE_TOOLTIP:
    129                     return tr("Remove the selected styles from the list of active styles");
    130                 case EDIT_SOURCE_TOOLTIP:
    131                     return tr("Edit the filename or URL for the selected active style");
    132                 case ACTIVATE_TOOLTIP:
    133                     return tr("Add the selected available styles to the list of active styles");
    134                 case RELOAD_ALL_AVAILABLE:
    135                     return marktr("Reloads the list of available styles from ''{0}''");
    136                 case LOADING_SOURCES_FROM:
    137                     return marktr("Loading style sources from ''{0}''");
    138                 case FAILED_TO_LOAD_SOURCES_FROM:
    139                     return marktr("<html>Failed to load the list of style sources from<br>"
    140                             + "''{0}''.<br>"
    141                             + "<br>"
    142                             + "Details (untranslated):<br>{1}</html>");
    143                 case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC:
    144                     return "/Preferences/Styles#FailedToLoadStyleSources";
    145                 case ILLEGAL_FORMAT_OF_ENTRY:
    146                     return marktr("Warning: illegal format of entry in style list ''{0}''. Got ''{1}''");
    147                 default: throw new AssertionError();
     119            case AVAILABLE_SOURCES:
     120                return tr("Available styles:");
     121            case ACTIVE_SOURCES:
     122                return tr("Active styles:");
     123            case NEW_SOURCE_ENTRY_TOOLTIP:
     124                return tr("Add a new style by entering filename or URL");
     125            case NEW_SOURCE_ENTRY:
     126                return tr("New style entry:");
     127            case REMOVE_SOURCE_TOOLTIP:
     128                return tr("Remove the selected styles from the list of active styles");
     129            case EDIT_SOURCE_TOOLTIP:
     130                return tr("Edit the filename or URL for the selected active style");
     131            case ACTIVATE_TOOLTIP:
     132                return tr("Add the selected available styles to the list of active styles");
     133            case RELOAD_ALL_AVAILABLE:
     134                return marktr("Reloads the list of available styles from ''{0}''");
     135            case LOADING_SOURCES_FROM:
     136                return marktr("Loading style sources from ''{0}''");
     137            case FAILED_TO_LOAD_SOURCES_FROM:
     138                return marktr("<html>Failed to load the list of style sources from<br>"
     139                        + "''{0}''.<br>"
     140                        + "<br>"
     141                        + "Details (untranslated):<br>{1}</html>");
     142            case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC:
     143                return "/Preferences/Styles#FailedToLoadStyleSources";
     144            case ILLEGAL_FORMAT_OF_ENTRY:
     145                return marktr("Warning: illegal format of entry in style list ''{0}''. Got ''{1}''");
     146            default: throw new AssertionError();
    148147            }
    149148        }
     
    177176        public MapPaintPrefMigration() {
    178177            super("mappaint.style.sources",
    179                   "mappaint.style.enable-defaults",
    180                   "mappaint.style.sources-list");
     178                    "mappaint.style.enable-defaults",
     179                    "mappaint.style.sources-list");
    181180        }
    182181
     
    215214        private boolean insertNewDefaults(List<SourceEntry> list) {
    216215            boolean changed = false;
    217            
     216
    218217            Collection<String> knownDefaults = new TreeSet<String>(Main.pref.getCollection("mappaint.style.known-defaults"));
    219218
     
    223222                int i = Utils.indexOf(list,
    224223                        new Predicate<SourceEntry>() {
    225                             @Override
    226                             public boolean evaluate(SourceEntry se) {
    227                                 return Utils.equal(def.url, se.url);
    228                             }
    229                         });
     224                    @Override
     225                    public boolean evaluate(SourceEntry se) {
     226                        return Utils.equal(def.url, se.url);
     227                    }
     228                });
    230229                if (i == -1 && !knownDefaults.contains(def.url)) {
    231230                    list.add(insertionIdx, def);
     
    268267                    entry.url,
    269268                    entry.name == null ? "" : entry.name,
    270                     entry.title == null ? "" : entry.title,
    271                     Boolean.toString(entry.active)
     269                            entry.title == null ? "" : entry.title,
     270                                    Boolean.toString(entry.active)
    272271            });
    273272        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r4843 r4874  
    1212import java.util.ArrayList;
    1313import java.util.Collection;
    14 import java.util.HashMap;
    1514import java.util.Iterator;
    1615import java.util.LinkedList;
    1716import java.util.List;
    18 import java.util.Map;
    1917
    2018import javax.swing.BorderFactory;
     
    5856    }
    5957
    60     private class TabData {
     58    private static class TabData {
    6159        public String icon;
    6260        public JComponent tab;
     
    217215                            tr("Warning"),
    218216                            JOptionPane.WARNING_MESSAGE
    219                     );
     217                            );
    220218                }
    221219                Main.parent.repaint();
     
    234232                        }
    235233                    }
    236             );
     234                    );
    237235        } else {
    238236            // no need for asynchronous activities. Simply run the remaining "save preference"
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r4839 r4874  
    11461146            try {
    11471147                sources.addAll(getDefault());
    1148                
     1148
    11491149                for (SourceProvider provider : sourceProviders) {
    11501150                    for (SourceEntry src : provider.getSources()) {
     
    11541154                    }
    11551155                }
    1156                
     1156
    11571157                MirroredInputStream stream = new MirroredInputStream(url);
    11581158                InputStreamReader r;
     
    12331233    }
    12341234
    1235     class SourceEntryTableCellRenderer extends DefaultTableCellRenderer {
     1235    static class SourceEntryTableCellRenderer extends DefaultTableCellRenderer {
    12361236        @Override
    12371237        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java

    r4839 r4874  
    5050    private SourceEditor sources;
    5151    private JCheckBox sortMenu;
    52    
     52
    5353    public static final boolean registerSourceProvider(SourceProvider provider) {
    54         if (provider != null) {
     54        if (provider != null)
    5555            return presetSourceProviders.add(provider);
    56         }
    5756        return false;
    5857    }
     
    166165                    }
    167166                }
    168         );
     167                );
    169168        gui.addValidationListener(validationListener);
    170169    }
    171170
    172     class TaggingPresetSourceEditor extends SourceEditor {
     171    static class TaggingPresetSourceEditor extends SourceEditor {
    173172
    174173        final private String iconpref = "taggingpreset.icon.sources";
     
    216215        public String getStr(I18nString ident) {
    217216            switch (ident) {
    218                 case AVAILABLE_SOURCES:
    219                     return tr("Available presets:");
    220                 case ACTIVE_SOURCES:
    221                     return tr("Active presets:");
    222                 case NEW_SOURCE_ENTRY_TOOLTIP:
    223                      return tr("Add a new preset by entering filename or URL");
    224                 case NEW_SOURCE_ENTRY:
    225                     return tr("New preset entry:");
    226                 case REMOVE_SOURCE_TOOLTIP:
    227                     return tr("Remove the selected presets from the list of active presets");
    228                 case EDIT_SOURCE_TOOLTIP:
    229                     return tr("Edit the filename or URL for the selected active preset");
    230                 case ACTIVATE_TOOLTIP:
    231                     return tr("Add the selected available presets to the list of active presets");
    232                 case RELOAD_ALL_AVAILABLE:
    233                     return marktr("Reloads the list of available presets from ''{0}''");
    234                 case LOADING_SOURCES_FROM:
    235                     return marktr("Loading preset sources from ''{0}''");
    236                 case FAILED_TO_LOAD_SOURCES_FROM:
    237                     return marktr("<html>Failed to load the list of preset sources from<br>"
    238                             + "''{0}''.<br>"
    239                             + "<br>"
    240                             + "Details (untranslated):<br>{1}</html>");
    241                 case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC:
    242                     return "/Preferences/Presets#FailedToLoadPresetSources";
    243                 case ILLEGAL_FORMAT_OF_ENTRY:
    244                     return marktr("Warning: illegal format of entry in preset list ''{0}''. Got ''{1}''");
    245                 default: throw new AssertionError();
     217            case AVAILABLE_SOURCES:
     218                return tr("Available presets:");
     219            case ACTIVE_SOURCES:
     220                return tr("Active presets:");
     221            case NEW_SOURCE_ENTRY_TOOLTIP:
     222                return tr("Add a new preset by entering filename or URL");
     223            case NEW_SOURCE_ENTRY:
     224                return tr("New preset entry:");
     225            case REMOVE_SOURCE_TOOLTIP:
     226                return tr("Remove the selected presets from the list of active presets");
     227            case EDIT_SOURCE_TOOLTIP:
     228                return tr("Edit the filename or URL for the selected active preset");
     229            case ACTIVATE_TOOLTIP:
     230                return tr("Add the selected available presets to the list of active presets");
     231            case RELOAD_ALL_AVAILABLE:
     232                return marktr("Reloads the list of available presets from ''{0}''");
     233            case LOADING_SOURCES_FROM:
     234                return marktr("Loading preset sources from ''{0}''");
     235            case FAILED_TO_LOAD_SOURCES_FROM:
     236                return marktr("<html>Failed to load the list of preset sources from<br>"
     237                        + "''{0}''.<br>"
     238                        + "<br>"
     239                        + "Details (untranslated):<br>{1}</html>");
     240            case FAILED_TO_LOAD_SOURCES_FROM_HELP_TOPIC:
     241                return "/Preferences/Presets#FailedToLoadPresetSources";
     242            case ILLEGAL_FORMAT_OF_ENTRY:
     243                return marktr("Warning: illegal format of entry in preset list ''{0}''. Got ''{1}''");
     244            default: throw new AssertionError();
    246245            }
    247246        }
     
    304303        public PresetPrefMigration() {
    305304            super("taggingpreset.sources",
    306                   "taggingpreset.enable-defaults",
    307                   "taggingpreset.sources-list");
     305                    "taggingpreset.enable-defaults",
     306                    "taggingpreset.sources-list");
    308307        }
    309308
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r4840 r4874  
    1313import java.awt.event.MouseEvent;
    1414import java.util.ArrayList;
     15import java.util.Collection;
     16import java.util.Collections;
    1517import java.util.List;
    1618import java.util.Map;
    1719import java.util.Map.Entry;
    18 import java.util.Collection;
    19 import java.util.Collections;
    2020
    2121import javax.swing.Box;
    2222import javax.swing.ButtonGroup;
     23import javax.swing.DefaultCellEditor;
    2324import javax.swing.JButton;
    2425import javax.swing.JLabel;
     
    3334import javax.swing.table.DefaultTableCellRenderer;
    3435import javax.swing.table.DefaultTableModel;
    35 import javax.swing.DefaultCellEditor;
    3636
    3737import org.openstreetmap.josm.Main;
    38 import org.openstreetmap.josm.gui.ExtendedDialog;
    39 import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    40 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory;
    41 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    4238import org.openstreetmap.josm.data.Preferences;
    4339import org.openstreetmap.josm.data.Preferences.ListListSetting;
     
    4642import org.openstreetmap.josm.data.Preferences.Setting;
    4743import org.openstreetmap.josm.data.Preferences.StringSetting;
     44import org.openstreetmap.josm.gui.ExtendedDialog;
     45import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     46import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory;
     47import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
    4848import org.openstreetmap.josm.tools.CheckParameterUtil;
    4949import org.openstreetmap.josm.tools.GBC;
     
    244244    }
    245245
    246     private class SettingCellRenderer extends DefaultTableCellRenderer {
     246    private static class SettingCellRenderer extends DefaultTableCellRenderer {
    247247        @Override
    248248        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
     
    264264    }
    265265
    266     private class SettingCellEditor extends DefaultCellEditor {
     266    private static class SettingCellEditor extends DefaultCellEditor {
    267267        public SettingCellEditor() {
    268268            super(new JTextField());
    269269        }
    270270
     271        @Override
    271272        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    272273            PrefEntry pe = (PrefEntry) value;
     
    322323                    tr("Warning"),
    323324                    JOptionPane.WARNING_MESSAGE
    324             );
     325                    );
    325326            return;
    326327        }
     
    430431                    tr("Warning"),
    431432                    JOptionPane.WARNING_MESSAGE
    432             );
     433                    );
    433434            return;
    434435        }
  • trunk/src/org/openstreetmap/josm/io/GpxImporter.java

    r4759 r4874  
    66import java.io.File;
    77import java.io.FileInputStream;
    8 import java.io.FileNotFoundException;
    98import java.io.IOException;
    109import java.io.InputStream;
     
    1211
    1312import javax.swing.JOptionPane;
    14 import javax.swing.SwingUtilities;
    1513
    1614import org.openstreetmap.josm.Main;
     
    2422public class GpxImporter extends FileImporter {
    2523
    26     protected class GpxImporterData {
     24    protected static class GpxImporterData {
    2725        public GpxLayer gpxLayer;
    2826        public MarkerLayer markerLayer;
     
    5957
    6058    public GpxImporterData loadLayers(InputStream is, final File associatedFile,
    61                     final String gpxLayerName, String markerLayerName, ProgressMonitor progressMonitor) throws IOException {
     59            final String gpxLayerName, String markerLayerName, ProgressMonitor progressMonitor) throws IOException {
    6260        final GpxImporterData data = new GpxImporterData();
    6361        try {
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r4713 r4874  
    3030    private String source;
    3131
    32     private enum State { 
     32    private enum State {
    3333        INIT,               // initial state, should always be at the bottom of the stack
    3434        IMAGERY,            // inside the imagery element
     
    6363    }
    6464
    65     private class Parser extends DefaultHandler {
     65    private static class Parser extends DefaultHandler {
    6666        private StringBuffer accumulator = new StringBuffer();
    6767
     
    9797            State newState = null;
    9898            switch (states.peek()) {
    99                 case INIT:
    100                     if (qName.equals("imagery")) {
    101                         newState = State.IMAGERY;
    102                     }
    103                     break;
    104                 case IMAGERY:
    105                     if (qName.equals("entry")) {
    106                         entry = new ImageryInfo();
    107                         skipEntry = false;
    108                         newState = State.ENTRY;
    109                     }
    110                     break;
    111                 case ENTRY:
    112                     if (Arrays.asList(new String[] {
     99            case INIT:
     100                if (qName.equals("imagery")) {
     101                    newState = State.IMAGERY;
     102                }
     103                break;
     104            case IMAGERY:
     105                if (qName.equals("entry")) {
     106                    entry = new ImageryInfo();
     107                    skipEntry = false;
     108                    newState = State.ENTRY;
     109                }
     110                break;
     111            case ENTRY:
     112                if (Arrays.asList(new String[] {
    113113                        "name",
    114114                        "type",
     
    126126                        "country-code",
    127127                        "icon",
    128                     }).contains(qName)) {
    129                         newState = State.ENTRY_ATTRIBUTE;
    130                     } else if (qName.equals("bounds")) {
    131                         try {
    132                             bounds = new ImageryBounds(
    133                                     atts.getValue("min-lat") + "," +
    134                                     atts.getValue("min-lon") + "," +
    135                                     atts.getValue("max-lat") + "," +
    136                                     atts.getValue("max-lon"), ",");
    137                         } catch (IllegalArgumentException e) {
    138                             break;
    139                         }
    140                         newState = State.BOUNDS;
    141                     } else if (qName.equals("projections")) {
    142                         projections = new ArrayList<String>();
    143                         newState = State.PROJECTIONS;
    144                     }
    145                     break;
    146                 case BOUNDS:
    147                     if (qName.equals("shape")) {
    148                         shape = new Shape();
    149                         newState = State.SHAPE;
    150                     }
    151                     break;
    152                 case SHAPE:
    153                     if (qName.equals("point")) {
    154                         try {
    155                             shape.addPoint(atts.getValue("lat"), atts.getValue("lon"));
    156                         } catch (IllegalArgumentException e) {
    157                             break;
    158                         }
    159                     }
    160                     break;
    161                 case PROJECTIONS:
    162                     if (qName.equals("code")) {
    163                         newState = State.CODE;
    164                     }
    165                     break;
     128                }).contains(qName)) {
     129                    newState = State.ENTRY_ATTRIBUTE;
     130                } else if (qName.equals("bounds")) {
     131                    try {
     132                        bounds = new ImageryBounds(
     133                                atts.getValue("min-lat") + "," +
     134                                        atts.getValue("min-lon") + "," +
     135                                        atts.getValue("max-lat") + "," +
     136                                        atts.getValue("max-lon"), ",");
     137                    } catch (IllegalArgumentException e) {
     138                        break;
     139                    }
     140                    newState = State.BOUNDS;
     141                } else if (qName.equals("projections")) {
     142                    projections = new ArrayList<String>();
     143                    newState = State.PROJECTIONS;
     144                }
     145                break;
     146            case BOUNDS:
     147                if (qName.equals("shape")) {
     148                    shape = new Shape();
     149                    newState = State.SHAPE;
     150                }
     151                break;
     152            case SHAPE:
     153                if (qName.equals("point")) {
     154                    try {
     155                        shape.addPoint(atts.getValue("lat"), atts.getValue("lon"));
     156                    } catch (IllegalArgumentException e) {
     157                        break;
     158                    }
     159                }
     160                break;
     161            case PROJECTIONS:
     162                if (qName.equals("code")) {
     163                    newState = State.CODE;
     164                }
     165                break;
    166166            }
    167167            /**
     
    189189        public void endElement(String namespaceURI, String qName, String rqName) {
    190190            switch (states.pop()) {
    191                 case INIT:
    192                     throw new RuntimeException("parsing error: more closing than opening elements");
    193                 case ENTRY:
    194                     if (qName.equals("entry")) {
    195                         if (!skipEntry) {
    196                             entries.add(entry);
     191            case INIT:
     192                throw new RuntimeException("parsing error: more closing than opening elements");
     193            case ENTRY:
     194                if (qName.equals("entry")) {
     195                    if (!skipEntry) {
     196                        entries.add(entry);
     197                    }
     198                    entry = null;
     199                }
     200                break;
     201            case ENTRY_ATTRIBUTE:
     202                if (qName.equals("name")) {
     203                    entry.setName(tr(accumulator.toString()));
     204                } else if (qName.equals("type")) {
     205                    boolean found = false;
     206                    for (ImageryType type : ImageryType.values()) {
     207                        if (equal(accumulator.toString(), type.getUrlString())) {
     208                            entry.setImageryType(type);
     209                            found = true;
     210                            break;
    197211                        }
    198                         entry = null;
    199                     }
    200                     break;
    201                 case ENTRY_ATTRIBUTE:
    202                     if (qName.equals("name")) {
    203                         entry.setName(tr(accumulator.toString()));
    204                     } else if (qName.equals("type")) {
    205                         boolean found = false;
    206                         for (ImageryType type : ImageryType.values()) {
    207                             if (equal(accumulator.toString(), type.getUrlString())) {
    208                                 entry.setImageryType(type);
    209                                 found = true;
    210                                 break;
    211                             }
     212                    }
     213                    if (!found) {
     214                        skipEntry = true;
     215                    }
     216                } else if (qName.equals("default")) {
     217                    if (accumulator.toString().equals("true")) {
     218                        entry.setDefaultEntry(true);
     219                    } else if (accumulator.toString().equals("false")) {
     220                        entry.setDefaultEntry(false);
     221                    } else {
     222                        skipEntry = true;
     223                    }
     224                } else if (qName.equals("url")) {
     225                    entry.setUrl(accumulator.toString());
     226                } else if (qName.equals("eula")) {
     227                    entry.setEulaAcceptanceRequired(accumulator.toString());
     228                } else if (qName.equals("min-zoom") || qName.equals("max-zoom")) {
     229                    Integer val = null;
     230                    try {
     231                        val = Integer.parseInt(accumulator.toString());
     232                    } catch(NumberFormatException e) {
     233                        val = null;
     234                    }
     235                    if (val == null) {
     236                        skipEntry = true;
     237                    } else {
     238                        if (qName.equals("min-zoom")) {
     239                            entry.setDefaultMinZoom(val);
     240                        } else {
     241                            entry.setDefaultMaxZoom(val);
    212242                        }
    213                         if (!found) {
    214                             skipEntry = true;
    215                         }
    216                     } else if (qName.equals("default")) {
    217                         if (accumulator.toString().equals("true")) {
    218                             entry.setDefaultEntry(true);
    219                         } else if (accumulator.toString().equals("false")) {
    220                             entry.setDefaultEntry(false);
    221                         } else {
    222                             skipEntry = true;
    223                         }
    224                     } else if (qName.equals("url")) {
    225                         entry.setUrl(accumulator.toString());
    226                     } else if (qName.equals("eula")) {
    227                         entry.setEulaAcceptanceRequired(accumulator.toString());
    228                     } else if (qName.equals("min-zoom") || qName.equals("max-zoom")) {
    229                         Integer val = null;
    230                         try {
    231                             val = Integer.parseInt(accumulator.toString());
    232                         } catch(NumberFormatException e) {
    233                             val = null;
    234                         }
    235                         if (val == null) {
    236                             skipEntry = true;
    237                         } else {
    238                             if (qName.equals("min-zoom")) {
    239                                 entry.setDefaultMinZoom(val);
    240                             } else {
    241                                 entry.setDefaultMaxZoom(val);
    242                             }
    243                         }
    244                     } else if (qName.equals("attribution-text")) {
    245                         entry.setAttributionText(accumulator.toString());
    246                     } else if (qName.equals("attribution-url")) {
    247                         entry.setAttributionLinkURL(accumulator.toString());
    248                     } else if (qName.equals("logo-image")) {
    249                         entry.setAttributionImage(accumulator.toString());
    250                     } else if (qName.equals("logo-url")) {
    251                         entry.setAttributionImageURL(accumulator.toString());
    252                     } else if (qName.equals("terms-of-use-text")) {
    253                         entry.setTermsOfUseText(accumulator.toString());
    254                     } else if (qName.equals("terms-of-use-url")) {
    255                         entry.setTermsOfUseURL(accumulator.toString());
    256                     } else if (qName.equals("country-code")) {
    257                         entry.setCountryCode(accumulator.toString());
    258                     } else if (qName.equals("icon")) {
    259                         entry.setIcon(accumulator.toString());
    260                     } else {
    261                     }
    262                     break;
    263                 case BOUNDS:
    264                     entry.setBounds(bounds);
    265                     bounds = null;
    266                     break;
    267                 case SHAPE:
    268                     bounds.addShape(shape);
    269                     shape = null;
    270                     break;
    271                 case CODE:
    272                     projections.add(accumulator.toString());
    273                     break;
    274                 case PROJECTIONS:
    275                     entry.setServerProjections(projections);
    276                     projections = null;
    277                     break;
     243                    }
     244                } else if (qName.equals("attribution-text")) {
     245                    entry.setAttributionText(accumulator.toString());
     246                } else if (qName.equals("attribution-url")) {
     247                    entry.setAttributionLinkURL(accumulator.toString());
     248                } else if (qName.equals("logo-image")) {
     249                    entry.setAttributionImage(accumulator.toString());
     250                } else if (qName.equals("logo-url")) {
     251                    entry.setAttributionImageURL(accumulator.toString());
     252                } else if (qName.equals("terms-of-use-text")) {
     253                    entry.setTermsOfUseText(accumulator.toString());
     254                } else if (qName.equals("terms-of-use-url")) {
     255                    entry.setTermsOfUseURL(accumulator.toString());
     256                } else if (qName.equals("country-code")) {
     257                    entry.setCountryCode(accumulator.toString());
     258                } else if (qName.equals("icon")) {
     259                    entry.setIcon(accumulator.toString());
     260                } else {
     261                }
     262                break;
     263            case BOUNDS:
     264                entry.setBounds(bounds);
     265                bounds = null;
     266                break;
     267            case SHAPE:
     268                bounds.addShape(shape);
     269                shape = null;
     270                break;
     271            case CODE:
     272                projections.add(accumulator.toString());
     273                break;
     274            case PROJECTIONS:
     275                entry.setServerProjections(projections);
     276                projections = null;
     277                break;
    278278            }
    279279        }
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r4868 r4874  
    407407     * needed to block the current thread and wait for the result of the modal dialog from EDT.
    408408     */
    409     private class CancelOrContinueDialog {
     409    private static class CancelOrContinueDialog {
    410410
    411411        private boolean cancel;
Note: See TracChangeset for help on using the changeset viewer.