Changeset 19115 in josm for trunk


Ignore:
Timestamp:
2024-06-19T00:35:04+02:00 (2 weeks ago)
Author:
taylor.smock
Message:

Fix some checkstyle issues

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

Legend:

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

    r19106 r19115  
    548548    enum Direction {
    549549        RIGHT, UP, LEFT, DOWN;
     550        /**
     551         * Change a direction by the specified number of 90 degree increments counter-clockwise
     552         * @param directionChange The number of increments to rotate counter-clockwise
     553         * @return The new direction
     554         */
     555        @SuppressWarnings("EnumOrdinal") // Yes, this is very dependent on order
    550556        public Direction changeBy(int directionChange) {
    551557            int tmp = (this.ordinal() + directionChange) % 4;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r19085 r19115  
    22package org.openstreetmap.josm.gui.dialogs.properties;
    33
     4import static org.openstreetmap.josm.tools.I18n.marktr;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    56import static org.openstreetmap.josm.tools.I18n.trn;
     
    124125            (o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getValue(), o2.getValue());
    125126
     127    private static final String CANCEL_TR = marktr("Cancel");
     128    private static final String CANCEL = "cancel";
     129    private static final String HTML = "<html>";
     130    private static final String DUMMY = "dummy";
    126131    /** Default number of recent tags */
    127132    public static final int DEFAULT_LRU_TAGS_NUMBER = 5;
     
    362367    private Collection<OsmPrimitive> updateSelection() {
    363368        final DataSet activeDataSet = OsmDataManager.getInstance().getActiveDataSet();
     369        activeDataSet.getReadLock().lock();
    364370        try {
    365             activeDataSet.getReadLock().lock();
    366371            Collection<OsmPrimitive> selection = new ArrayList<>(OsmDataManager.getInstance().getInProgressSelection());
    367372            this.sel = selection;
     
    490495                MainApplication.getMainFrame(),
    491496                tr("Overwrite tag"),
    492                 tr("Overwrite"), tr("Cancel"))
    493             .setButtonIcons("ok", "cancel")
     497                tr("Overwrite"), tr(CANCEL_TR))
     498            .setButtonIcons("ok", CANCEL)
    494499            .setContent(action)
    495500            .setCancelButton(2)
     
    505510
    506511        protected EditTagDialog(String key, Map<String, Integer> map, boolean initialFocusOnKey) {
    507             super(MainApplication.getMainFrame(), trn("Change value?", "Change values?", map.size()), tr("OK"), tr("Cancel"));
    508             setButtonIcons("ok", "cancel");
     512            super(MainApplication.getMainFrame(), trn("Change value?", "Change values?", map.size()), tr("OK"), tr(CANCEL_TR));
     513            setButtonIcons("ok", CANCEL);
    509514            setCancelButton(2);
    510515            configureContextsensitiveHelp("/Dialog/EditValue", true /* show help button */);
     
    526531            JPanel mainPanel = new JPanel(new BorderLayout());
    527532
    528             String msg = "<html>"+trn("This will change {0} object.",
     533            String msg = HTML+trn("This will change {0} object.",
    529534                    "This will change up to {0} objects.", sel.size(), sel.size())
    530535                    +"<br><br>("+tr("An empty value deletes the tag.", key)+")</html>";
     
    557562            keys.getModel().setComparator(Comparator.naturalOrder()); // according to Comparable
    558563            keys.setEditable(true);
    559             keys.setPrototypeDisplayValue(new AutoCompletionItem("dummy"));
     564            keys.setPrototypeDisplayValue(new AutoCompletionItem(DUMMY));
    560565            keys.getModel().addAllElements(keyList);
    561566            keys.setSelectedItemText(key);
     
    574579            values.setRenderer(new TEHListCellRenderer(values, values.getRenderer(), valueCount.get(key)));
    575580            values.setEditable(true);
    576             values.setPrototypeDisplayValue(new AutoCompletionItem("dummy"));
     581            values.setPrototypeDisplayValue(new AutoCompletionItem(DUMMY));
    577582            values.getModel().addAllElements(valueList);
    578583            values.setSelectedItemText(selection);
     
    817822
    818823        protected AddTagsDialog() {
    819             super(MainApplication.getMainFrame(), tr("Add tag"), tr("OK"), tr("Cancel"));
    820             setButtonIcons("ok", "cancel");
     824            super(MainApplication.getMainFrame(), tr("Add tag"), tr("OK"), tr(CANCEL_TR));
     825            setButtonIcons("ok", CANCEL);
    821826            setCancelButton(2);
    822827            configureContextsensitiveHelp("/Dialog/AddValue", true /* show help button */);
     
    839844                }
    840845            };
    841             mainPanel.add(new JLabel("<html>"+trn("This will change up to {0} object.",
     846            mainPanel.add(new JLabel(HTML+trn("This will change up to {0} object.",
    842847                "This will change up to {0} objects.", sel.size(), sel.size())
    843848                +"<br><br>"+tr("Please select a key")), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
    844849
    845850            keys = new AutoCompComboBox<>();
    846             keys.setPrototypeDisplayValue(new AutoCompletionItem("dummy"));
     851            keys.setPrototypeDisplayValue(new AutoCompletionItem(DUMMY));
    847852            keys.setEditable(true);
    848853            keys.getModel().setComparator(Comparator.naturalOrder()); // according to Comparable
     
    853858
    854859            values = new AutoCompComboBox<>();
    855             values.setPrototypeDisplayValue(new AutoCompletionItem("dummy"));
     860            values.setPrototypeDisplayValue(new AutoCompletionItem(DUMMY));
    856861            values.setEditable(true);
    857862            values.getModel().setComparator(Comparator.naturalOrder());
     
    9951000                    lines.add(sc.getKeyText() + ' ' + tr("to add first suggestion without closing the dialog"))
    9961001            );
    997             final JLabel helpLabel = new JLabel("<html>" + String.join("<br>", lines) + "</html>");
     1002            final JLabel helpLabel = new JLabel(HTML + String.join("<br>", lines) + "</html>");
    9981003            helpLabel.setFont(helpLabel.getFont().deriveFont(Font.PLAIN));
    9991004            contentPane.add(helpLabel, GBC.eol().fill(GridBagConstraints.HORIZONTAL).insets(5, 5, 5, 5));
     
    10971102                // Create tag label
    10981103                final String color = action.isEnabled() ? "" : "; color:gray";
    1099                 final JLabel tagLabel = new JLabel("<html>"
     1104                final JLabel tagLabel = new JLabel(HTML
    11001105                        + "<style>td{" + color + "}</style>"
    11011106                        + "<table><tr>"
     
    12381243                if (val != null && !val.equals(value)) {
    12391244                    String valueHtmlString = Utils.joinAsHtmlUnorderedList(Arrays.asList("<strike>" + val + "</strike>", value));
    1240                     if (!warnOverwriteKey("<html>"
     1245                    if (!warnOverwriteKey(HTML
    12411246                            + tr("You changed the value of ''{0}'': {1}", key, valueHtmlString)
    12421247                            + tr("Overwrite?"), "overwriteAddKey"))
Note: See TracChangeset for help on using the changeset viewer.