Ignore:
Timestamp:
2017-08-06T20:24:40+02:00 (7 years ago)
Author:
michael2402
Message:

See #15057: Fix checkstye and sonar issues.

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

Legend:

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

    r12574 r12575  
    106106         * want to save the last query in OverpassQueryList.
    107107         */
    108         Consumer<Collection> errorReporter = (errors) -> {
     108        Consumer<Collection<Object>> errorReporter = errors -> {
    109109
    110110            boolean onlyNoDataError = errors.size() == 1 &&
     
    221221                @Override
    222222                public void focusLost(FocusEvent e) {
    223 
     223                    // ignored
    224224                }
    225225            });
     
    233233                ? BasicArrowButton.EAST
    234234                : BasicArrowButton.WEST);
    235             arrowButton.addActionListener(e ->  {
     235            arrowButton.addActionListener(e -> {
    236236                if (overpassQueryList.isVisible()) {
    237237                    overpassQueryList.setVisible(false);
     
    288288    private static final class QueryWizardDialog extends ExtendedDialog {
    289289
     290        private static final String HEADLINE_START = "<h3>";
     291        private static final String HEADLINE_END = "</h3>";
     292        private static final String TR_START = "<tr>";
     293        private static final String TR_END = "</tr>";
     294        private static final String TD_START = "<td>";
     295        private static final String TD_END = "</td>";
    290296        private static QueryWizardDialog dialog;
    291297        private final HistoryComboBox queryWizard;
     
    329335
    330336            JLabel searchLabel = new JLabel(tr("Search :"));
    331             JTextComponent descPane = this.buildDescriptionSection();
     337            JTextComponent descPane = buildDescriptionSection();
    332338            JScrollPane scroll = GuiHelper.embedInVerticalScrollPane(descPane);
    333339            scroll.getVerticalScrollBar().setUnitIncrement(10); // make scrolling smooth
     
    422428        }
    423429
    424         private JTextComponent buildDescriptionSection() {
    425             JEditorPane descriptionSection = new JEditorPane("text/html", this.getDescriptionContent());
     430        private static JTextComponent buildDescriptionSection() {
     431            JEditorPane descriptionSection = new JEditorPane("text/html", getDescriptionContent());
    426432            descriptionSection.setEditable(false);
    427433            descriptionSection.addHyperlinkListener(e -> {
     
    434440        }
    435441
    436         private String getDescriptionContent() {
     442        private static String getDescriptionContent() {
    437443            return new StringBuilder("<html>")
    438444                    .append(DESCRIPTION_STYLE)
    439445                    .append("<body>")
    440                     .append("<h3>")
     446                    .append(HEADLINE_START)
    441447                    .append(tr("Query Wizard"))
    442                     .append("</h3>")
     448                    .append(HEADLINE_END)
    443449                    .append("<p>")
    444450                    .append(tr("Allows you to interact with <i>Overpass API</i> by writing declarative, human-readable terms."))
     
    447453                    .append(tr("<a href=\"{0}\">OSM Wiki</a>.", Main.getOSMWebsite() + "/wiki/Overpass_turbo/Wizard"))
    448454                    .append("</p>")
    449                     .append("<h3>").append(tr("Hints")).append("</h3>")
    450                     .append("<table>").append("<tr>").append("<td>")
     455                    .append(HEADLINE_START).append(tr("Hints")).append(HEADLINE_END)
     456                    .append("<table>").append(TR_START).append(TD_START)
    451457                    .append(Utils.joinAsHtmlUnorderedList(Arrays.asList("<i>type:node</i>", "<i>type:relation</i>", "<i>type:way</i>")))
    452                     .append("</td>").append("<td>")
     458                    .append(TD_END).append(TD_START)
    453459                    .append("<span>").append(tr("Download objects of a certain type.")).append("</span>")
    454                     .append("</td>").append("</tr>")
    455                     .append("<tr>").append("<td>")
     460                    .append(TD_END).append(TR_END)
     461                    .append(TR_START).append(TD_START)
    456462                    .append(Utils.joinAsHtmlUnorderedList(
    457463                            Arrays.asList("<i>key=value in <u>location</u></i>",
    458464                                    "<i>key=value around <u>location</u></i>",
    459465                                    "<i>key=value in bbox</i>")))
    460                     .append("</td>").append("<td>")
     466                    .append(TD_END).append(TD_START)
    461467                    .append(tr("Download object by specifying a specific location. For example,"))
    462468                    .append(Utils.joinAsHtmlUnorderedList(Arrays.asList(
     
    469475                    .append(tr("Instead of <i>location</i> any valid place name can be used like address, city, etc."))
    470476                    .append("</span>")
    471                     .append("</td>").append("</tr>")
    472                     .append("<tr>").append("<td>")
     477                    .append(TD_END).append(TR_END)
     478                    .append(TR_START).append(TD_START)
    473479                    .append(Utils.joinAsHtmlUnorderedList(Arrays.asList("<i>key=value</i>", "<i>key=*</i>", "<i>key~regex</i>",
    474480                            "<i>key!=value</i>", "<i>key!~regex</i>", "<i>key=\"combined value\"</i>")))
    475                     .append("</td>").append("<td>")
     481                    .append(TD_END).append(TD_START)
    476482                    .append(tr("<span>Download objects that have some concrete key/value pair, only the key with any contents for the value, " +
    477483                            "the value matching some regular expression. 'Not equal' operators are supported as well.</span>"))
    478                     .append("</td>").append("</tr>")
    479                     .append("<tr>").append("<td>")
     484                    .append(TD_END).append(TR_END)
     485                    .append(TR_START).append(TD_START)
    480486                    .append(Utils.joinAsHtmlUnorderedList(Arrays.asList(
    481487                            tr("<i>expression1 {0} expression2</i>", "or"),
    482488                            tr("<i>expression1 {0} expression2</i>", "and"))))
    483                     .append("</td>").append("<td>")
     489                    .append(TD_END).append(TD_START)
    484490                    .append("<span>")
    485491                    .append(tr("Basic logical operators can be used to create more sophisticated queries. Instead of 'or' - '|', '||' " +
    486492                            "can be used, and instead of 'and' - '&', '&&'."))
    487493                    .append("</span>")
    488                     .append("</td>").append("</tr>").append("</table>")
     494                    .append(TD_END).append(TR_END).append("</table>")
    489495                    .append("</body>")
    490496                    .append("</html>")
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java

    r12574 r12575  
    3030    private final DownloadTask task;
    3131    private final Future<?> future;
    32     private Consumer<Collection> errorReporter;
     32    private Consumer<Collection<Object>> errorReporter;
    3333
    3434    /**
    35      * constructor
     35     * Creates a new {@link PostDownloadHandler}
    3636     * @param task the asynchronous download task
    3737     * @param future the future on which the completion of the download task can be synchronized
     
    4343
    4444    /**
    45      * constructor
     45     * Creates a new {@link PostDownloadHandler} using a custom error reporter
    4646     * @param task the asynchronous download task
    4747     * @param future the future on which the completion of the download task can be synchronized
     
    4949     *                      task
    5050     */
    51     public PostDownloadHandler(DownloadTask task, Future<?> future, Consumer<Collection> errorReporter) {
     51    public PostDownloadHandler(DownloadTask task, Future<?> future, Consumer<Collection<Object>> errorReporter) {
    5252        this(task, future);
    5353        this.errorReporter = errorReporter;
Note: See TracChangeset for help on using the changeset viewer.