Changeset 8855 in josm for trunk/src/org


Ignore:
Timestamp:
2015-10-10T21:01:42+02:00 (9 years ago)
Author:
Don-vip
Message:

sonar - Unused private method should be removed
sonar - Unused protected methods should be removed
sonar - Sections of code should not be "commented out"
sonar - Empty statements should be removed
sonar - squid:S1172 - Unused method parameters should be removed
sonar - squid:S1481 - Unused local variables should be removed

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

Legend:

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

    r8851 r8855  
    539539        }
    540540
    541         protected Node getStartNode() {
    542             Set<Node> nodes = getNodes();
    543             for (Node n: nodes) {
    544                 if (successors.get(n) != null && successors.get(n).size() == 1)
    545                     return n;
    546             }
    547             return null;
    548         }
    549 
    550541        protected Set<Node> getTerminalNodes() {
    551542            Set<Node> ret = new LinkedHashSet<>();
  • trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java

    r8846 r8855  
    217217            }
    218218
    219             // and display an error message. The while (true) ensures that the dialog pops up again
     219            // and display an error message. The while loop ensures that the dialog pops up again
    220220            JOptionPane.showMessageDialog(Main.parent,
    221221                    tr("Couldn''t match the entered link or id to the selected service. Please try again."),
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r8850 r8855  
    455455                    v = EN.diff(v, segment);
    456456                } else throw new IllegalStateException();
    457                 /**
    458                  * When summing up the length of the sum vector should increase.
    459                  * However, it is possible to construct ways, such that this assertion fails.
    460                  * So only uncomment this for testing
    461                  **/
    462                 //                if (segDirections[i].ordinal() % 2 == 0) {
    463                 //                    if (EN.abs(h) < lh) throw new AssertionError();
    464                 //                    lh = EN.abs(h);
    465                 //                } else {
    466                 //                    if (EN.abs(v) < lv) throw new AssertionError();
    467                 //                    lv = EN.abs(v);
    468                 //                }
    469457            }
    470458            // rotate the vertical vector by 90 degrees (clockwise) and add it to the horizontal vector
    471459            segSum = EN.sum(h, new EastNorth(v.north(), -v.east()));
    472             //            if (EN.abs(segSum) < lh) throw new AssertionError();
    473460            this.heading = EN.polar(new EastNorth(0., 0.), segSum);
    474461        }
  • trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java

    r8846 r8855  
    5656        private final Collection<PrimitiveData> source;
    5757        private final Collection<OsmPrimitive> target;
    58         private final List<Tag> commands = new ArrayList<>();
     58        private final List<Tag> tags = new ArrayList<>();
    5959
    6060        public TagPaster(Collection<PrimitiveData> source, Collection<OsmPrimitive> target) {
     
    109109        }
    110110
    111         protected void buildChangeCommand(Collection<? extends OsmPrimitive> selection, TagCollection tc) {
     111        protected void buildTags(TagCollection tc) {
    112112            for (String key : tc.getKeys()) {
    113                 commands.add(new Tag(key, tc.getValues(key).iterator().next()));
     113                tags.add(new Tag(key, tc.getValues(key).iterator().next()));
    114114            }
    115115        }
     
    161161                if (dialog.isCanceled())
    162162                    return;
    163                 buildChangeCommand(target, dialog.getResolution());
     163                buildTags(dialog.getResolution());
    164164            } else {
    165165                // no conflicts in the source tags to resolve. Just apply the tags
    166166                // to the target primitives
    167167                //
    168                 buildChangeCommand(target, tc);
     168                buildTags(tc);
    169169            }
    170170        }
     
    185185         * Replies true if this a heterogeneous source can be pasted without conflict to targets
    186186         *
    187          * @param targets the collection of target primitives
    188187         * @return true if this a heterogeneous source can be pasted without conflicts to targets
    189188         */
    190         protected boolean canPasteFromHeterogeneousSourceWithoutConflict(Collection<OsmPrimitive> targets) {
     189        protected boolean canPasteFromHeterogeneousSourceWithoutConflict() {
    191190            for (OsmPrimitiveType type : OsmPrimitiveType.dataValues()) {
    192191                if (hasTargetPrimitives(type.getOsmClass())) {
     
    200199
    201200        /**
    202          * Pastes the tags in the current selection of the paste buffer to a set of target
    203          * primitives.
     201         * Pastes the tags in the current selection of the paste buffer to a set of target primitives.
    204202         */
    205203        protected void pasteFromHeterogeneousSource() {
    206             if (canPasteFromHeterogeneousSourceWithoutConflict(target)) {
     204            if (canPasteFromHeterogeneousSourceWithoutConflict()) {
    207205                for (OsmPrimitiveType type : OsmPrimitiveType.dataValues()) {
    208206                    if (hasSourceTagsByType(type) && hasTargetPrimitives(type.getOsmClass())) {
    209                         buildChangeCommand(target, getSourceTagsByType(type));
     207                        buildTags(getSourceTagsByType(type));
    210208                    }
    211209                }
     
    224222                for (OsmPrimitiveType type : OsmPrimitiveType.dataValues()) {
    225223                    if (hasSourceTagsByType(type) && hasTargetPrimitives(type.getOsmClass())) {
    226                         buildChangeCommand(OsmPrimitive.getFilteredList(target, type.getOsmClass()), dialog.getResolution(type));
     224                        buildTags(dialog.getResolution(type));
    227225                    }
    228226                }
     
    231229
    232230        public List<Tag> execute() {
    233             commands.clear();
     231            tags.clear();
    234232            if (isHeteogeneousSource()) {
    235233                pasteFromHeterogeneousSource();
     
    237235                pasteFromHomogeneousSource();
    238236            }
    239             return commands;
     237            return tags;
    240238        }
    241239
  • trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java

    r8443 r8855  
    127127    }
    128128
    129     protected int getNumWaysInSelection() {
    130         if (getCurrentDataSet() == null) return 0;
    131         int ret = 0;
    132         for (OsmPrimitive primitive : getCurrentDataSet().getSelected()) {
    133             if (primitive instanceof Way) {
    134                 ret++;
    135             }
    136         }
    137         return ret;
    138     }
    139 
    140129    @Override
    141130    protected void updateEnabledState() {
  • trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java

    r8624 r8855  
    8181        try {
    8282            final long id = Long.parseLong(searchTerm);
    83             new DownloadNotesTask().download(false, id, null);
     83            new DownloadNotesTask().download(id, null);
    8484            return;
    8585        } catch (NumberFormatException ignore) {
  • trunk/src/org/openstreetmap/josm/actions/ValidateAction.java

    r8836 r8855  
    4848    @Override
    4949    public void actionPerformed(ActionEvent ev) {
    50         doValidate(ev, true);
     50        doValidate(true);
    5151    }
    5252
     
    5858     * revalidated
    5959     *
    60      * @param ev The event
    6160     * @param getSelectedItems If selected or last selected items must be validated
    6261     */
    63     public void doValidate(ActionEvent ev, boolean getSelectedItems) {
     62    public void doValidate(boolean getSelectedItems) {
    6463        if (Main.map == null || !Main.map.isVisible())
    6564            return;
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java

    r8836 r8855  
    3838    private DownloadTask downloadTask;
    3939
    40     public Future<?> download(boolean newLayer, long id, ProgressMonitor progressMonitor) {
     40    public Future<?> download(long id, ProgressMonitor progressMonitor) {
    4141        final String url = OsmApi.getOsmApi().getBaseUrl() + "notes/" + id;
    4242        downloadTask = new DownloadRawUrlTask(new OsmServerLocationReader(url), progressMonitor);
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesUrlIdTask.java

    r8624 r8855  
    1818        final Matcher matcher = Pattern.compile(URL_ID_PATTERN).matcher(url);
    1919        if (matcher.matches()) {
    20             return download(newLayer, Long.parseLong(matcher.group(2)), null);
     20            return download(Long.parseLong(matcher.group(2)), null);
    2121        } else {
    2222            throw new IllegalStateException("Failed to parse note id from " + url);
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r8850 r8855  
    236236        Main.map.keyDetector.addModifierListener(this);
    237237        ignoreNextKeyRelease = true;
    238         // would like to but haven't got mouse position yet:
    239         // computeHelperLine(false, false, false);
    240238    }
    241239
  • trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java

    r8510 r8855  
    2121 * is another.
    2222 *
    23  * MapModes should register/deregister all necessary listeners on the map's view
    24  * control.
     23 * MapModes should register/deregister all necessary listeners on the map's view control.
    2524 */
    2625public abstract class MapMode extends JosmAction implements MouseListener, MouseMotionListener {
     
    3231    /**
    3332     * Constructor for mapmodes without an menu
     33     * @param mapFrame unused but kept for plugin compatibility. Can be {@code null}
    3434     */
    3535    public MapMode(String name, String iconName, String tooltip, Shortcut shortcut, MapFrame mapFrame, Cursor cursor) {
     
    4141    /**
    4242     * Constructor for mapmodes with an menu (no shortcut will be registered)
     43     * @param mapFrame unused but kept for plugin compatibility. Can be {@code null}
    4344     */
    4445    public MapMode(String name, String iconName, String tooltip, MapFrame mapFrame, Cursor cursor) {
     
    8485    }
    8586
    86     // By default, all tools will work with all layers. Can be overwritten to require
    87     // a special type of layer
     87    /**
     88     * Determines if layer {@code l} is supported by this map mode.
     89     * By default, all tools will work with all layers.
     90     * Can be overwritten to require a special type of layer
     91     * @param l layer
     92     * @return {@code true} if the layer is supported by this map mode
     93     */
    8894    public boolean layerIsSupported(Layer l) {
    89         return true;
     95        return l != null;
    9096    }
    9197
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r8777 r8855  
    302302     *    <li>it is not referred to by other non-deleted primitives outside of  <code>primitivesToDelete</code></li>
    303303     * </ul>
    304      * @param layer  the layer in whose context primitives are deleted
    305304     * @param primitivesToDelete  the primitives to delete
    306305     * @return the collection of nodes referred to by primitives in <code>primitivesToDelete</code> which
    307306     * can be deleted too
    308307     */
    309     protected static Collection<Node> computeNodesToDelete(OsmDataLayer layer, Collection<OsmPrimitive> primitivesToDelete) {
     308    protected static Collection<Node> computeNodesToDelete(Collection<OsmPrimitive> primitivesToDelete) {
    310309        Collection<Node> nodesToDelete = new HashSet<>();
    311310        for (Way way : OsmPrimitive.getFilteredList(primitivesToDelete, Way.class)) {
     
    379378        if (alsoDeleteNodesInWay) {
    380379            // delete untagged nodes only referenced by primitives in primitivesToDelete, too
    381             Collection<Node> nodesToDelete = computeNodesToDelete(layer, primitivesToDelete);
     380            Collection<Node> nodesToDelete = computeNodesToDelete(primitivesToDelete);
    382381            primitivesToDelete.addAll(nodesToDelete);
    383382        }
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r8836 r8855  
    215215        if (this.layers.isEmpty())
    216216            throw new IllegalArgumentException(tr("No layers defined by getCapabilities document: {0}", info.getUrl()));
    217 
    218         // Not needed ? initProjection();
    219217    }
    220218
     
    387385
    388386    /**
    389      * Initializes projection for this TileSource with current projection
    390      */
    391     protected void initProjection() {
    392         initProjection(Main.getProjection());
    393     }
    394 
    395     /**
    396387     * Initializes projection for this TileSource with projection
    397388     * @param proj projection to be used by this TileSource
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r8840 r8855  
    12241224    }
    12251225
    1226     void fireHighlightingChanged(OsmPrimitive primitive) {
     1226    void fireHighlightingChanged() {
    12271227        highlightUpdateCount++;
    12281228    }
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r8840 r8855  
    640640            updateFlags(FLAG_HIGHLIGHTED, highlighted);
    641641            if (dataSet != null) {
    642                 dataSet.fireHighlightingChanged(this);
     642                dataSet.fireHighlightingChanged();
    643643            }
    644644        }
  • trunk/src/org/openstreetmap/josm/data/osm/Storage.java

    r8840 r8855  
    267267     */
    268268    private int rehash(int h) {
    269         //return 54435761*h;
    270269        return 1103515245*h >> 2;
    271270    }
     
    361360        };
    362361    }
    363     /*
    364     public static <O> Hash<O,O> identityHash() {
    365         return new Hash<O,O>() {
    366             public int getHashCode(O t) {
    367                 return System.identityHashCode(t);
    368             }
    369             public boolean equals(O t1, O t2) {
    370                 return t1 == t2;
    371             }
    372         };
    373     }
    374      */
    375362
    376363    private final class FMap<K> implements Map<K, T> {
  • trunk/src/org/openstreetmap/josm/data/osm/TigerUtils.java

    r8390 r8855  
    4545    }
    4646
    47     public static String combineTags(String name, Set<String> values) {
     47    public static String combineTags(Set<String> values) {
    4848        Set<Object> resultSet = new TreeSet<>();
    4949        for (String value: values) {
     
    6666        return combined.toString();
    6767    }
    68 
    69     public static String combineTags(String name, String t1, String t2) {
    70         Set<String> set = new TreeSet<>();
    71         set.add(t1);
    72         set.add(t2);
    73         return TigerUtils.combineTags(name, set);
    74     }
    7568}
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java

    r8840 r8855  
    66import java.awt.Graphics2D;
    77import java.awt.Point;
    8 import java.awt.Polygon;
    98import java.awt.Rectangle;
    109import java.awt.RenderingHints;
     
    455454
    456455    /**
    457      * Checks if a polygon is visible in display.
    458      *
    459      * @param polygon The polygon to check.
    460      * @return <code>true</code> if polygon is visible.
    461      */
    462     protected boolean isPolygonVisible(Polygon polygon) {
    463         Rectangle bounds = polygon.getBounds();
    464         if (bounds.width == 0 && bounds.height == 0) return false;
    465         if (bounds.x > nc.getWidth()) return false;
    466         if (bounds.y > nc.getHeight()) return false;
    467         if (bounds.x + bounds.width < 0) return false;
    468         if (bounds.y + bounds.height < 0) return false;
    469         return true;
    470     }
    471 
    472     /**
    473456     * Finally display all segments in currect path.
    474457     */
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r8849 r8855  
    263263            }
    264264            // TODO directionKeys are no longer in OsmPrimitive (search pattern is used instead)
    265             /*  for (String a : OsmPrimitive.getDirectionKeys())
    266                 presetsValueData.add(a);
    267              */
    268265            for (String a : Main.pref.getCollection(ValidatorPreference.PREFIX + ".knownkeys",
    269266                    Arrays.asList(new String[]{"is_in", "int_ref", "fixme", "population"}))) {
     
    704701            }
    705702
    706             public boolean match(OsmPrimitive osm, Map<String, String> keys) {
     703            public boolean match(Map<String, String> keys) {
    707704                for (Entry<String, String> prop: keys.entrySet()) {
    708705                    String key = prop.getKey();
     
    784781
    785782            for (CheckerElement ce : data) {
    786                 if (!ce.match(osm, keys))
     783                if (!ce.match(keys))
    787784                    return false;
    788785            }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedNode.java

    r8829 r8855  
    44import static org.openstreetmap.josm.tools.I18n.marktr;
    55import static org.openstreetmap.josm.tools.I18n.tr;
    6 
    7 import java.util.Map;
    86
    97import org.openstreetmap.josm.command.Command;
     
    8886    }
    8987
    90     private boolean contains(Map.Entry<String, String> tag, String s) {
    91         return tag.getKey().indexOf(s) != -1 || tag.getValue().indexOf(s) != -1;
    92     }
    93 
    9488    @Override
    9589    public Command fixError(TestError testError) {
  • trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java

    r8513 r8855  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.Component;
    76import java.text.MessageFormat;
    87
     
    6564                    !Main.isOffline(OnlineResource.OSM_API)) {
    6665                try {
    67                     instance.initFromOAuth(Main.parent);
     66                    instance.initFromOAuth();
    6867                } catch (Exception e) {
    6968                    Main.error(e);
     
    211210     * Initializes the user identity manager from OAuth request of user details.
    212211     * This method should be called if {@code osm-server.auth-method} is set to {@code oauth}.
    213      * @param parent component relative to which the {@link PleaseWaitDialog} is displayed.
    214212     * @see #initFromPreferences
    215213     * @since 5434
    216214     */
    217     public void initFromOAuth(Component parent) {
     215    public void initFromOAuth() {
    218216        try {
    219217            UserInfo info = new OsmServerUserInfoReader().fetchUserInfo(NullProgressMonitor.INSTANCE);
     
    283281            if (OsmApi.isUsingOAuth()) {
    284282                try {
    285                     getInstance().initFromOAuth(Main.parent);
     283                    getInstance().initFromOAuth();
    286284                } catch (Exception e) {
    287285                    Main.error(e);
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r8840 r8855  
    927927    @Override
    928928    public synchronized void addMouseListener(MouseListener ml) {
    929         //super.addMouseListener(ml);
    930929        lonText.addMouseListener(ml);
    931930        latText.addMouseListener(ml);
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r8732 r8855  
    198198    }
    199199
    200     protected Point getTopLeftCoordinates() {
    201         return new Point(center.x - (getWidth() / 2), center.y - (getHeight() / 2));
    202     }
    203 
    204200    /**
    205201     * Draw the map.
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListTableCellRenderer.java

    r8510 r8855  
    5353     * @param isSelected true, if the current row is selected
    5454     */
    55     protected  void renderNode(ListMergeModel<Node>.EntriesTableModel model, Node node, int row, boolean isSelected) {
     55    protected void renderNode(ListMergeModel<Node>.EntriesTableModel model, Node node, int row, boolean isSelected) {
    5656        setIcon(icon);
    5757        setBorder(null);
     
    8484    /**
    8585     * render the row id
    86      * @param model  the model
     86     * @param model the model
    8787     * @param row the row index
    88      * @param isSelected true, if the current row is selected
    8988     */
    90     protected  void renderRowId(ListMergeModel<Node>.EntriesTableModel model, int row, boolean isSelected) {
     89    protected void renderRowId(ListMergeModel<Node>.EntriesTableModel model, int row) {
    9190        setIcon(null);
    9291        setBorder(rowNumberBorder);
     
    111110            switch(column) {
    112111            case 0:
    113                 renderRowId(getModel(table), row, isSelected);
     112                renderRowId(getModel(table), row);
    114113                break;
    115114            case 1:
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtil.java

    r8510 r8855  
    6868        for (String key: tc.getKeys()) {
    6969            if (TigerUtils.isTigerTag(key)) {
    70                 tc.setUniqueForKey(key, TigerUtils.combineTags(key, tc.getValues(key)));
     70                tc.setUniqueForKey(key, TigerUtils.combineTags(tc.getValues(key)));
    7171            }
    7272        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

    r8846 r8855  
    99import java.awt.event.FocusEvent;
    1010import java.awt.event.FocusListener;
    11 import java.text.NumberFormat;
    12 import java.text.ParsePosition;
    1311import java.util.ArrayList;
    1412import java.util.Arrays;
     
    235233    }
    236234
    237     protected Double parseDoubleFromUserInput(String input) {
    238         if (input == null) return null;
    239         // remove white space and an optional degree symbol
    240         //
    241         input = input.trim();
    242         input = input.replaceAll(DEG, "");
    243 
    244         // try to parse using the current locale
    245         //
    246         NumberFormat f = NumberFormat.getNumberInstance();
    247         Number n = null;
    248         ParsePosition pp = new ParsePosition(0);
    249         n = f.parse(input, pp);
    250         if (pp.getErrorIndex() >= 0 || pp.getIndex() < input.length()) {
    251             // fall back - try to parse with the english locale
    252             //
    253             pp = new ParsePosition(0);
    254             f = NumberFormat.getNumberInstance(Locale.ENGLISH);
    255             n = f.parse(input, pp);
    256             if (pp.getErrorIndex() >= 0 || pp.getIndex() < input.length())
    257                 return null;
    258         }
    259         return n == null ? null : n.doubleValue();
    260     }
    261 
    262235    protected void parseLatLonUserInput() {
    263236        LatLon latLon;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r8836 r8855  
    960960        }
    961961
    962         protected boolean isActiveLayer(Layer layer) {
    963             if (!Main.isDisplayingMapView())
    964                 return false;
    965             return Main.map.mapView.getActiveLayer() == layer;
    966         }
    967 
    968962        @Override
    969963        public void updateEnabledState() {
     
    11481142        public void showMenu(MouseEvent evt) {
    11491143            Layer layer = getModel().getLayer(layerList.getSelectedRow());
    1150             menu = new LayerListPopup(getModel().getSelectedLayers(), layer);
     1144            menu = new LayerListPopup(getModel().getSelectedLayers());
    11511145            super.showMenu(evt);
    11521146        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java

    r8510 r8855  
    6767    }
    6868
    69     public LayerListPopup(List<Layer> selectedLayers, final Layer layer) {
     69    public LayerListPopup(List<Layer> selectedLayers) {
    7070
    7171        List<Action> actions;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r8846 r8855  
    839839
    840840    /**
    841      * Change the Geometry of the detached dialog to better fit the content.
    842      */
    843     protected Rectangle getDetachedGeometry(Rectangle last) {
    844         return last;
    845     }
    846 
    847     /**
    848841     * Default size of the detached dialog.
    849842     * Override this method to customize the initial dialog size.
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java

    r8840 r8855  
    1616import java.beans.PropertyChangeListener;
    1717import java.text.DateFormat;
    18 import java.util.Collection;
    1918import java.util.Collections;
    2019import java.util.HashSet;
     
    364363        }
    365364
    366         protected void alertNoPrimitivesToSelect(Collection<OsmPrimitive> primitives) {
     365        protected void alertNoPrimitivesToSelect() {
    367366            HelpAwareOptionPane.showOptionDialog(
    368367                    ChangesetDetailPanel.this,
     
    391390            }
    392391            if (target.isEmpty()) {
    393                 alertNoPrimitivesToSelect(target);
     392                alertNoPrimitivesToSelect();
    394393                return;
    395394            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanel.java

    r8760 r8855  
    3838    }
    3939
    40     protected void init(Changeset cs) {
    41         if (cs == null) {
    42             model.clear();
    43             return;
    44         }
    45         model.initFromTags(cs.getKeys());
    46     }
    47 
    4840    /* ---------------------------------------------------------------------------- */
    4941    /* interface PropertyChangeListener                                             */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r8836 r8855  
    178178        tagEditorPanel.getModel().ensureOneTag();
    179179
    180         JSplitPane pane = buildSplitPane(relation);
     180        JSplitPane pane = buildSplitPane();
    181181        pane.setPreferredSize(new Dimension(100, 100));
    182182
     
    460460     * @return the split panel
    461461     */
    462     protected JSplitPane buildSplitPane(Relation relation) {
     462    protected JSplitPane buildSplitPane() {
    463463        final JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    464464        pane.setTopComponent(buildTagEditorPanel());
     
    468468            @Override
    469469            public void windowOpened(WindowEvent e) {
    470                 // has to be called when the window is visible, otherwise
    471                 // no effect
     470                // has to be called when the window is visible, otherwise no effect
    472471                pane.setDividerLocation(0.3);
    473472            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r8840 r8855  
    675675
    676676    /**
    677      * Replies true if the layer this model belongs to is equal to the active
    678      * layer
    679      *
    680      * @return true if the layer this model belongs to is equal to the active
    681      * layer
    682      */
    683     protected boolean isActiveLayer() {
    684         if (!Main.isDisplayingMapView()) return false;
    685         return Main.map.mapView.getActiveLayer() == layer;
    686     }
    687 
    688     /**
    689677     * Sort the selected relation members by the way they are linked.
    690678     */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableCellRenderer.java

    r8510 r8855  
    4848    }
    4949
    50     protected void renderBackground(OsmPrimitive primitive, boolean isSelected) {
     50    protected void renderBackground(OsmPrimitive primitive) {
    5151        Color bgc = UIManager.getColor("Table.background");
    5252        if (primitive != null && model != null && model.getNumMembersWithPrimitive(primitive) == 1) {
     
    7272            return this;
    7373
    74         renderBackground((OsmPrimitive) value, isSelected);
     74        renderBackground((OsmPrimitive) value);
    7575        renderPrimitive((OsmPrimitive) value);
    7676        return this;
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r8510 r8855  
    132132    }
    133133
    134     protected boolean hasNewNodes(Way way) {
    135         for (Node n: way.getNodes()) {
    136             if (n.isNew()) return true;
    137         }
    138         return false;
    139     }
    140 
    141134    protected boolean canShowAsLatest(OsmPrimitive primitive) {
    142135        if (primitive == null) return false;
  • trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListTableCellRenderer.java

    r8510 r8855  
    5151    }
    5252
    53     protected void renderRole(Item diffItem, int row, boolean isSelected) {
     53    protected void renderRole(Item diffItem) {
    5454        String text = "";
    5555        Color bgColor = diffItem.state.getColor();
     
    6161    }
    6262
    63     protected void renderPrimitive(Item diffItem, int row, boolean isSelected) {
     63    protected void renderPrimitive(Item diffItem) {
    6464        String text = "";
    6565        Color bgColor = diffItem.state.getColor();
     
    8787        switch(column) {
    8888        case 0:
    89             renderRole(member, row, isSelected);
     89            renderRole(member);
    9090            break;
    9191        case 1:
    92             renderPrimitive(member, row, isSelected);
     92            renderPrimitive(member);
    9393            break;
    9494        }
     
    9696        return this;
    9797    }
    98 
    99     protected DiffTableModel getRelationMemberTableModel(JTable table) {
    100         return (DiffTableModel) table.getModel();
    101     }
    10298}
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r8840 r8855  
    315315        }
    316316
    317         protected void cancelWhenInSaveAndUploadingMode() {
    318             cancelSafeAndUploadTask();
    319         }
    320 
    321317        public void cancel() {
    322318            switch(model.getMode()) {
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r8846 r8855  
    514514        initTileSource(this.tileSource);
    515515
    516         ;
    517516        // keep them final here, so we avoid namespace clutter in the class
    518517        final JPopupMenu tileOptionMenu = new JPopupMenu();
  • trunk/src/org/openstreetmap/josm/gui/layer/Layer.java

    r8840 r8855  
    388388     */
    389389    public boolean isProjectionSupported(Projection proj) {
    390         return true;
     390        return proj != null;
    391391    }
    392392
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r8846 r8855  
    442442    @Override
    443443    public boolean isMergable(final Layer other) {
    444         // isUploadDiscouraged commented to allow merging between normal layers and discouraged layers with a warning (see #7684)
    445         return other instanceof OsmDataLayer; // && (isUploadDiscouraged() == ((OsmDataLayer)other).isUploadDiscouraged());
     444        // allow merging between normal layers and discouraged layers with a warning (see #7684)
     445        return other instanceof OsmDataLayer;
    446446    }
    447447
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r8846 r8855  
    4444    public void clearCached() {
    4545        // run in EDT to make sure this isn't called during rendering run
    46         // {@link org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer#render}
    4746        GuiHelper.runInEDT(new Runnable() {
    4847            @Override
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagCellRenderer.java

    r8840 r8855  
    6969    }
    7070
    71     protected TagEditorModel getModel(JTable table) {
    72         return (TagEditorModel) table.getModel();
    73     }
    74 
    7571    /**
    7672     * replies the cell renderer component for a specific cell
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r8846 r8855  
    233233        }
    234234
    235         public boolean addToPanel(JPanel p, Collection<OsmPrimitive> sel) {
     235        public boolean addToPanel(JPanel p) {
    236236            String cstring;
    237237            if (count > 0 && !required) {
     
    477477                proles.add(new JLabel(tr("elements")), GBC.eol());
    478478                for (Role i : roles) {
    479                     i.addToPanel(proles, sel);
     479                    i.addToPanel(proles);
    480480                }
    481481                p.add(proles, GBC.eol());
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java

    r8840 r8855  
    231231        if (filter == null) {
    232232            // Collections.copy throws an exception "Source does not fit in dest"
    233             // Collections.copy(filtered, list);
    234233            filtered.ensureCapacity(list.size());
    235234            for (AutoCompletionListItem item: list) {
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r8846 r8855  
    1414import java.util.LinkedHashSet;
    1515import java.util.List;
    16 import java.util.NoSuchElementException;
    1716import java.util.Set;
    1817import java.util.concurrent.Callable;
     
    3736import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    3837import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    39 import org.openstreetmap.josm.tools.CheckParameterUtil;
    4038import org.openstreetmap.josm.tools.Utils;
    4139
     
    9997        case RELATION: relations.add(id.getUniqueId()); break;
    10098        }
    101     }
    102 
    103     /**
    104      * remembers an {@link OsmPrimitive}'s id. <code>ds</code> must include
    105      * an {@link OsmPrimitive} with id=<code>id</code>. The id will
    106      * later we fetched as part of a Multi Get request.
    107      *
    108      * Ignore the id if it id &lt;= 0.
    109      *
    110      * @param ds  the dataset (must not be null)
    111      * @param id  the primitive id
    112      * @param type The primitive type. Must be one of {@link OsmPrimitiveType#NODE NODE}, {@link OsmPrimitiveType#WAY WAY},
    113      * {@link OsmPrimitiveType#RELATION RELATION}
    114      * @throws IllegalArgumentException if ds is null
    115      * @throws NoSuchElementException if ds does not include an {@link OsmPrimitive} with id=<code>id</code>
    116      */
    117     protected void remember(DataSet ds, long id, OsmPrimitiveType type) throws NoSuchElementException {
    118         CheckParameterUtil.ensureParameterNotNull(ds, "ds");
    119         if (id <= 0) return;
    120         OsmPrimitive primitive = ds.getPrimitiveById(id, type);
    121         if (primitive == null)
    122             throw new NoSuchElementException(tr("No primitive with id {0} in local dataset. Cannot infer primitive type.", id));
    123         remember(primitive.getPrimitiveId());
    124         return;
    12599    }
    126100
  • trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java

    r8394 r8855  
    1515import org.openstreetmap.josm.data.osm.DataSet;
    1616import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    17 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    1817import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1918import org.openstreetmap.josm.gui.util.GuiHelper;
     
    4544    }
    4645
    47     protected void importData(InputStream in, final File associatedFile) throws IllegalDataException {
    48         importData(in, associatedFile, NullProgressMonitor.INSTANCE);
    49     }
    50 
    5146    protected void importData(InputStream in, final File associatedFile, ProgressMonitor  progressMonitor) throws IllegalDataException {
    5247        final DataSet dataSet = OsmChangeReader.parseDataSet(in, progressMonitor);
  • trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java

    r8840 r8855  
    7979        private StringBuilder text;
    8080
    81         protected void parseChangesetAttributes(Changeset cs, Attributes atts) throws XmlParsingException {
     81        protected void parseChangesetAttributes(Attributes atts) throws XmlParsingException {
    8282            // -- id
    8383            String value = atts.getValue("id");
     
    204204            case "changeset":
    205205                current = new Changeset();
    206                 parseChangesetAttributes(current, atts);
     206                parseChangesetAttributes(atts);
    207207                break;
    208208            case "tag":
  • trunk/src/org/openstreetmap/josm/io/OsmImporter.java

    r8509 r8855  
    1616import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    1717import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    18 import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    1918import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2019import org.openstreetmap.josm.gui.util.GuiHelper;
     
    7877            throw new IOException(tr("File ''{0}'' does not exist.", file.getName()), e);
    7978        }
    80     }
    81 
    82     /**
    83      * Imports OSM data from stream
    84      * @param in input stream
    85      * @param associatedFile filename of data
    86      */
    87     protected void importData(InputStream in, final File associatedFile) throws IllegalDataException {
    88         importData(in, associatedFile, NullProgressMonitor.INSTANCE);
    8979    }
    9080
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java

    r8510 r8855  
    4444    private final Collection<PluginInformation> failed = new LinkedList<>();
    4545    private final Collection<PluginInformation> downloaded = new LinkedList<>();
    46     //private Exception lastException;
    4746    private boolean canceled;
    4847    private HttpURLConnection downloadConnection;
  • trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java

    r8840 r8855  
    7575            interrupt();
    7676            while (result == Result.WAITING) {
    77                 sleep(10); /* yield(); */
     77                sleep(10);
    7878            }
    7979            if (result == Result.FAILED)
     
    315315                                    long bytesToSkip = (long) (calibratedOffset /* seconds (double) */ * bytesPerSecond);
    316316                                    // skip doesn't seem to want to skip big chunks, so reduce it to smaller ones
    317                                     // audioInputStream.skip(bytesToSkip);
    318317                                    while (bytesToSkip > chunk) {
    319318                                        nBytesRead = audioInputStream.skip(chunk);
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r8510 r8855  
    344344        double a1 = p2.getY() - p1.getY();
    345345        double b1 = p1.getX() - p2.getX();
    346         // double c1 = 0;
    347346
    348347        double a2 = p4.getY() - p3.getY();
  • trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java

    r8846 r8855  
    140140     */
    141141    public static String getDisplayName(Locale locale) {
    142         /*String full = locale.toString();
    143         if ("ca__valencia".equals(full))
    144             return t_r_c("language", "Valencian");*/
    145 
    146142        return locale.getDisplayName();
    147143    }
  • trunk/src/org/openstreetmap/josm/tools/OverpassTurboQueryWizard.java

    r8744 r8855  
    4848        try (final Reader reader = new InputStreamReader(
    4949                getClass().getResourceAsStream("/data/overpass-turbo-ffs.js"), StandardCharsets.UTF_8)) {
    50             //engine.eval("var turbo = {ffs: {noPresets: true}};");
    5150            engine.eval("var console = {log: function(){}};");
    5251            engine.eval(reader);
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r8846 r8855  
    13031303     */
    13041304    public static ThreadFactory newThreadFactory(final String nameFormat, final int threadPriority) {
    1305         final String ignore = String.format(Locale.ENGLISH, nameFormat, 0); // fail fast
    13061305        return new ThreadFactory() {
    13071306            final AtomicLong count = new AtomicLong(0);
Note: See TracChangeset for help on using the changeset viewer.