Ignore:
Timestamp:
2015-10-13T23:50:14+02:00 (9 years ago)
Author:
Don-vip
Message:

sonar - squid:S2325 - "private" methods that don't access instance data should be "static"

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
33 edited

Legend:

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

    r8863 r8870  
    422422    }
    423423
    424     private String getRelationTypeName(IRelation relation) {
     424    private static String getRelationTypeName(IRelation relation) {
    425425        String name = trc("Relation type", relation.get("type"));
    426426        if (name == null) {
     
    455455    }
    456456
    457     private String getNameTagValue(IRelation relation, String nameTag) {
     457    private static String getNameTagValue(IRelation relation, String nameTag) {
    458458        if ("name".equals(nameTag)) {
    459459            if (Main.pref.getBoolean("osm-primitives.localize-name", true))
     
    509509    }
    510510
    511     private String buildDefaultToolTip(long id, Map<String, String> tags) {
     511    private static String buildDefaultToolTip(long id, Map<String, String> tags) {
    512512        StringBuilder sb = new StringBuilder();
    513513        sb.append("<html><strong>id</strong>=")
  • trunk/src/org/openstreetmap/josm/gui/FileDrop.java

    r8848 r8870  
    3434import org.openstreetmap.josm.Main;
    3535import org.openstreetmap.josm.actions.OpenFileAction;
     36import org.openstreetmap.josm.gui.FileDrop.TransferableObject;
    3637
    3738// CHECKSTYLE.OFF: HideUtilityClassConstructor
     
    227228
    228229    /** Determine if the dragged data is a file list. */
    229     private boolean isDragOk(final DropTargetDragEvent evt) {
     230    private static boolean isDragOk(final DropTargetDragEvent evt) {
    230231        boolean ok = false;
    231232
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r8846 r8870  
    617617        }
    618618
    619         private void handleAutosave() {
     619        private static void handleAutosave() {
    620620            if (AutosaveTask.PROP_AUTOSAVE_ENABLED.get()) {
    621621                AutosaveTask autosaveTask = new AutosaveTask();
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r8863 r8870  
    909909     * @param result resulting list ofmenu items
    910910     */
    911     private void findMenuItems(final JMenu menu, final String textToFind, final List<JMenuItem> result) {
     911    private static void findMenuItems(final JMenu menu, final String textToFind, final List<JMenuItem> result) {
    912912        for (int i = 0; i < menu.getItemCount(); i++) {
    913913            JMenuItem menuItem = menu.getItem(i);
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r8856 r8870  
    207207    }
    208208
    209     private EastNorth calculateDefaultCenter() {
     209    private static EastNorth calculateDefaultCenter() {
    210210        Bounds b = DownloadDialog.getSavedDownloadBounds();
    211211        if (b == null) {
  • trunk/src/org/openstreetmap/josm/gui/SelectionManager.java

    r8557 r8870  
    368368    }
    369369
    370     private void selectionAreaChanged() {
     370    private static void selectionAreaChanged() {
    371371        // Trigger a redraw of the map view.
    372372        // A nicer way would be to provide change events for the temporary layer.
     
    436436    }
    437437
    438     private Polygon rectToPolygon(Rectangle r) {
     438    private static Polygon rectToPolygon(Rectangle r) {
    439439        Polygon poly = new Polygon();
    440440
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java

    r8856 r8870  
    288288     * @return List of primitives whose filtering can be affected by change in source primitives
    289289     */
    290     private Collection<OsmPrimitive> getAffectedPrimitives(Collection<? extends OsmPrimitive> primitives) {
     290    private static Collection<OsmPrimitive> getAffectedPrimitives(Collection<? extends OsmPrimitive> primitives) {
    291291        // Filters can use nested parent/child expression so complete tree is necessary
    292292        Set<OsmPrimitive> result = new HashSet<>();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java

    r8846 r8870  
    422422    }
    423423
    424     private String getSort(StyleSource s) {
     424    private static String getSort(StyleSource s) {
    425425        if (s instanceof XmlStyleSource) {
    426426            return tr("xml");
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r8863 r8870  
    226226     * @return {@code true} if the user accepts to overwrite key, {@code false} otherwise
    227227     */
    228     private boolean warnOverwriteKey(String action, String togglePref) {
     228    private static boolean warnOverwriteKey(String action, String togglePref) {
    229229        ExtendedDialog ed = new ExtendedDialog(
    230230                Main.parent,
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRenderer.java

    r8510 r8870  
    191191    }
    192192
    193     private void setDotted(Graphics g) {
     193    private static void setDotted(Graphics g) {
    194194        ((Graphics2D) g).setStroke(new BasicStroke(
    195195                1f,
     
    201201    }
    202202
    203     private void unsetDotted(Graphics g) {
     203    private static void unsetDotted(Graphics g) {
    204204        ((Graphics2D) g).setStroke(new BasicStroke());
    205205    }
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r8855 r8870  
    788788        }
    789789
    790         private User getCurrentUser() {
     790        private static User getCurrentUser() {
    791791            UserInfo info = JosmUserIdentityManager.getInstance().getUserInfo();
    792792            return info == null ? User.getAnonymous() : User.createOsmUser(info.getId(), info.getDisplayName());
  • trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java

    r8836 r8870  
    568568    }
    569569
    570     private String getLastChangesetTagFromHistory(String historyKey, List<String> def) {
     570    private static String getLastChangesetTagFromHistory(String historyKey, List<String> def) {
    571571        Collection<String> history = Main.pref.getCollection(historyKey, def);
    572572        int age = (int) (System.currentTimeMillis() / 1000 - Main.pref.getInteger(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, 0));
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r8846 r8870  
    12731273    }
    12741274
    1275     private int getLastIndexOfListBefore(List<ImageEntry> images, long searchedTime) {
     1275    private static int getLastIndexOfListBefore(List<ImageEntry> images, long searchedTime) {
    12761276        int lstSize = images.size();
    12771277
     
    13071307    }
    13081308
    1309     private String formatTimezone(double timezone) {
     1309    private static String formatTimezone(double timezone) {
    13101310        StringBuilder ret = new StringBuilder();
    13111311
     
    13261326    }
    13271327
    1328     private double parseTimezone(String timezone) throws ParseException {
     1328    private static double parseTimezone(String timezone) throws ParseException {
    13291329
    13301330        if (timezone.isEmpty())
     
    13971397    }
    13981398
    1399     private long parseOffset(String offset) throws ParseException {
     1399    private static long parseOffset(String offset) throws ParseException {
    14001400        String error = tr("Error while parsing offset.\nExpected format: {0}", "number");
    14011401
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r8846 r8870  
    444444    }
    445445
    446     private Dimension scaledDimension(Image thumb) {
     446    private static Dimension scaledDimension(Image thumb) {
    447447        final double d = Main.map.mapView.getDist100Pixel();
    448448        final double size = 10 /*meter*/;     /* size of the photo on the map */
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r8840 r8870  
    559559    }
    560560
    561     private Point getCenterImgCoord(Rectangle visibleRect) {
     561    private static Point getCenterImgCoord(Rectangle visibleRect) {
    562562        return new Point(visibleRect.x + visibleRect.width / 2,
    563563                visibleRect.y + visibleRect.height / 2);
     
    630630    }
    631631
    632     private void checkVisibleRectPos(Image image, Rectangle visibleRect) {
     632    private static void checkVisibleRectPos(Image image, Rectangle visibleRect) {
    633633        if (visibleRect.x < 0) {
    634634            visibleRect.x = 0;
     
    645645    }
    646646
    647     private void checkVisibleRectSize(Image image, Rectangle visibleRect) {
     647    private static void checkVisibleRectSize(Image image, Rectangle visibleRect) {
    648648        if (visibleRect.width > image.getWidth(null)) {
    649649            visibleRect.width = image.getWidth(null);
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

    r8848 r8870  
    5757    }
    5858
    59     private void warnCantImportIntoServerLayer(GpxLayer layer) {
     59    private static void warnCantImportIntoServerLayer(GpxLayer layer) {
    6060        String msg = tr("<html>The data in the GPX layer ''{0}'' has been downloaded from the server.<br>" +
    6161                "Because its way points do not include a timestamp we cannot correlate them with audio data.</html>",
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportImagesAction.java

    r8510 r8870  
    3333    }
    3434
    35     private void warnCantImportIntoServerLayer(GpxLayer layer) {
     35    private static void warnCantImportIntoServerLayer(GpxLayer layer) {
    3636        String msg = tr("<html>The data in the GPX layer ''{0}'' has been downloaded from the server.<br>"+
    3737                "Because its way points do not include a timestamp we cannot correlate them with images.</html>",
     
    4141    }
    4242
    43     private void addRecursiveFiles(List<File> files, File[] sel) {
     43    private static void addRecursiveFiles(List<File> files, File[] sel) {
    4444        for (File f : sel) {
    4545            if (f.isDirectory()) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java

    r8836 r8870  
    6969        }
    7070
    71         private boolean mapHasGpxorMarkerLayer() {
     71        private static boolean mapHasGpxorMarkerLayer() {
    7272            for (Layer layer : Main.map.mapView.getAllLayers()) {
    7373                if (layer instanceof GpxLayer || layer instanceof MarkerLayer) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java

    r8846 r8870  
    309309        }
    310310
    311         private boolean conditionRequiresKeyPresence(KeyMatchType matchType) {
     311        private static boolean conditionRequiresKeyPresence(KeyMatchType matchType) {
    312312            return matchType != KeyMatchType.REGEX;
    313313        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java

    r8846 r8870  
    141141     * @param mc side effect: update the valid region for the current MultiCascade
    142142     */
    143     private boolean requiresUpdate(Prototype current, Prototype candidate, Double scale, MultiCascade mc) {
     143    private static boolean requiresUpdate(Prototype current, Prototype candidate, Double scale, MultiCascade mc) {
    144144        if (current == null || candidate.priority >= current.priority) {
    145145            if (scale == null)
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r8846 r8870  
    684684        }
    685685
    686         private void appendRow(StringBuilder s, String th, String td) {
     686        private static void appendRow(StringBuilder s, String th, String td) {
    687687            s.append("<tr><th>").append(th).append("</th><td>").append(td).append("</td</tr>");
    688688        }
     
    14261426        }
    14271427
    1428         private String fromSourceEntry(SourceEntry entry) {
     1428        private static String fromSourceEntry(SourceEntry entry) {
    14291429            if (entry == null)
    14301430                return null;
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r8836 r8870  
    195195    }
    196196
    197     private File[] askUserForCustomSettingsFiles(boolean saveFileFlag, String title) {
     197    private static File[] askUserForCustomSettingsFiles(boolean saveFileFlag, String title) {
    198198        FileFilter filter = new FileFilter() {
    199199            @Override
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java

    r8846 r8870  
    143143    }
    144144
    145     private String getName(String o) {
     145    private static String getName(String o) {
    146146        return Main.pref.getColorName(o);
    147147    }
     
    262262     * Add all missing color entries.
    263263     */
    264     private void fixColorPrefixes() {
     264    private static void fixColorPrefixes() {
    265265        PaintColors.getColors();
    266266        ConflictColors.getColors();
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/CacheContentsPanel.java

    r8769 r8870  
    172172    }
    173173
    174     private Long getCacheSize(CacheAccess<String, BufferedImageCacheEntry> cache) {
     174    private static Long getCacheSize(CacheAccess<String, BufferedImageCacheEntry> cache) {
    175175        ICacheStats stats = cache.getStatistics();
    176176        for (IStats cacheStats: stats.getAuxiliaryCacheStats()) {
     
    242242    }
    243243
    244     private DefaultTableModel getTableModel(final CacheAccess<String, BufferedImageCacheEntry> cache) {
     244    private static DefaultTableModel getTableModel(final CacheAccess<String, BufferedImageCacheEntry> cache) {
    245245        final DefaultTableModel tableModel = new DefaultTableModel(
    246246                getCacheStats(cache),
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java

    r8836 r8870  
    9999    }
    100100
    101     private void addSettingsSection(final JPanel p, String name, JPanel section, GBC gbc) {
     101    private static void addSettingsSection(final JPanel p, String name, JPanel section, GBC gbc) {
    102102        final JLabel lbl = new JLabel(name);
    103103        lbl.setFont(lbl.getFont().deriveFont(Font.BOLD));
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java

    r8836 r8870  
    164164        }
    165165
    166         private JComponent build() {
     166        private static JComponent build() {
    167167            StringBuilder s = new StringBuilder();
    168168            s.append("<b>+proj=...</b> - <i>").append(tr("Projection name"))
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java

    r8554 r8870  
    471471    }
    472472
    473     private Collection<String> getSubprojectionPreference(ProjectionChoice pc) {
     473    private static Collection<String> getSubprojectionPreference(ProjectionChoice pc) {
    474474        return Main.pref.getCollection("projection.sub."+pc.getId(), null);
    475475    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java

    r8836 r8870  
    160160        }
    161161
    162         private void addDefault(List<ExtendedSourceEntry> defaults, String filename, String title, String description) {
     162        private static void addDefault(List<ExtendedSourceEntry> defaults, String filename, String title, String description) {
    163163            ExtendedSourceEntry i = new ExtendedSourceEntry(filename+".mapcss", "resource://data/validator/"+filename+".mapcss");
    164164            i.title = title;
  • trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java

    r8840 r8870  
    5353    private boolean cancelable;
    5454
    55     private void doInEDT(Runnable runnable) {
     55    private static void doInEDT(Runnable runnable) {
    5656        // This must be invoke later even if current thread is EDT because inside there is dialog.setVisible
    5757        // which freeze current code flow until modal dialog is closed
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetMenu.java

    r8863 r8870  
    6565    }
    6666
    67     private Component copyMenuComponent(Component menuComponent) {
     67    private static Component copyMenuComponent(Component menuComponent) {
    6868        if (menuComponent instanceof JMenu) {
    6969            JMenu menu = (JMenu) menuComponent;
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r8863 r8870  
    162162        }
    163163
    164         private int isMatching(Collection<String> values, String[] searchString) {
     164        private static int isMatching(Collection<String> values, String[] searchString) {
    165165            int sum = 0;
    166166            for (String word: searchString) {
  • trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java

    r8846 r8870  
    198198    }
    199199
    200     private boolean isFocusInMainWindow() {
     200    private static boolean isFocusInMainWindow() {
    201201        Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    202202        return focused != null && SwingUtilities.getWindowAncestor(focused) instanceof JFrame;
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r8846 r8870  
    312312    }
    313313
    314     private Dimension sizeWithInsets(Container parent, Dimension size) {
     314    private static Dimension sizeWithInsets(Container parent, Dimension size) {
    315315        Insets insets = parent.getInsets();
    316316        int width = size.width + insets.left + insets.right;
     
    331331    }
    332332
    333     private Rectangle boundsWithYandHeight(Rectangle bounds, double y, double height) {
     333    private static Rectangle boundsWithYandHeight(Rectangle bounds, double y, double height) {
    334334        Rectangle r = new Rectangle();
    335335        r.setBounds((int) (bounds.getX()), (int) y, (int) (bounds.getWidth()), (int) height);
     
    337337    }
    338338
    339     private Rectangle boundsWithXandWidth(Rectangle bounds, double x, double width) {
     339    private static Rectangle boundsWithXandWidth(Rectangle bounds, double x, double width) {
    340340        Rectangle r = new Rectangle();
    341341        r.setBounds((int) x, (int) (bounds.getY()), (int) width, (int) (bounds.getHeight()));
Note: See TracChangeset for help on using the changeset viewer.