Ignore:
Timestamp:
2017-05-30T15:12:36+02:00 (2 years ago)
Author:
Don-vip
Message:

sonar - squid:S3878 - Arrays should not be created for varargs parameters

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

Legend:

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

    r10713 r12279  
    110110
    111111        GuiHelper.prepareResizeableOptionPane(panel, panel.getPreferredSize());
    112         int ret = new ExtendedDialog(Main.parent, tr("About JOSM..."), new String[] {tr("OK"), tr("Report bug")})
    113             .setButtonIcons(new String[] {"ok", "bug"})
     112        int ret = new ExtendedDialog(Main.parent, tr("About JOSM..."), tr("OK"), tr("Report bug"))
     113            .setButtonIcons("ok", "bug")
    114114            .setContent(panel, false)
    115115            .showDialog().getValue();
  • trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java

    r11885 r12279  
    114114            return targetLayers[0];
    115115        }
    116         ExtendedDialog ed = new ExtendedDialog(Main.parent, title, new String[] {buttonText, tr("Cancel")});
    117         ed.setButtonIcons(new String[] {buttonIcon, "cancel"});
     116        ExtendedDialog ed = new ExtendedDialog(Main.parent, title, buttonText, tr("Cancel"));
     117        ed.setButtonIcons(buttonIcon, "cancel");
    118118        ed.setContent(pnl);
    119119        ed.showDialog();
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r11657 r12279  
    4949    static class SelectWmsLayersDialog extends ExtendedDialog {
    5050        SelectWmsLayersDialog(WMSLayerTree tree, JComboBox<String> formats) {
    51             super(Main.parent, tr("Select WMS layers"), new String[]{tr("Add layers"), tr("Cancel")});
     51            super(Main.parent, tr("Select WMS layers"), tr("Add layers"), tr("Cancel"));
    5252            final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
    5353            scrollPane.setPreferredSize(new Dimension(400, 400));
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r11553 r12279  
    6161
    6262    protected static boolean confirmChangeDirectionOfWays() {
    63         ExtendedDialog ed = new ExtendedDialog(Main.parent,
     63        return new ExtendedDialog(Main.parent,
    6464                tr("Change directions?"),
    65                 new String[] {tr("Reverse and Combine"), tr("Cancel")});
    66         ed.setButtonIcons(new String[] {"wayflip", "cancel"});
    67         ed.setContent(tr("The ways can not be combined in their current directions.  "
    68                 + "Do you want to reverse some of them?"));
    69         ed.toggleEnable("combineway-reverse");
    70         ed.showDialog();
    71         return ed.getValue() == 1;
     65                tr("Reverse and Combine"), tr("Cancel"))
     66            .setButtonIcons("wayflip", "cancel")
     67            .setContent(tr("The ways can not be combined in their current directions.  "
     68                + "Do you want to reverse some of them?"))
     69            .toggleEnable("combineway-reverse")
     70            .showDialog()
     71            .getValue() == 1;
    7272    }
    7373
  • trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java

    r10383 r12279  
    5858         */
    5959        public HistoryObjectIDDialog() {
    60             super(Main.parent, tr("Show history"), new String[]{tr("Show history"), tr("Cancel")});
    61             setButtonIcons(new String[]{"dialogs/history", "cancel"});
     60            super(Main.parent, tr("Show history"), tr("Show history"), tr("Cancel"));
     61            setButtonIcons("dialogs/history", "cancel");
    6262            init();
    6363        }
  • trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java

    r12093 r12279  
    217217                    new String[] {tr("OK"), tr("Cancel")},
    218218                    false);
    219             setButtonIcons(new String[] {"ok", "cancel"});
     219            setButtonIcons("ok", "cancel");
    220220            contentInsets = new Insets(10, 15, 5, 15);
    221221            JPanel pnl = new JPanel(new GridBagLayout());
     
    294294                    Main.parent,
    295295                    tr("Overwrite"),
    296                     new String[] {tr("Overwrite"), tr("Cancel")}
     296                    tr("Overwrite"), tr("Cancel")
    297297            ) { {
    298298                contentInsets = new Insets(10, 15, 10, 15);
    299299            } };
    300300            dialog.setContent(tr("Offset bookmark already exists. Overwrite?"));
    301             dialog.setButtonIcons(new String[] {"ok.png", "cancel.png"});
     301            dialog.setButtonIcons("ok", "cancel");
    302302            dialog.setupDialog();
    303303            dialog.setVisible(true);
  • trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java

    r10604 r12279  
    162162        ExtendedDialog diag = new ExtendedDialog(Main.parent,
    163163                tr("Add Rectified Image"),
    164 
    165                 new String[] {tr("Add Rectified Image"), tr("Cancel")});
    166         diag.setContent(panel);
    167         diag.setButtonIcons(new String[] {"OLmarker", "cancel"});
     164                tr("Add Rectified Image"), tr("Cancel"))
     165            .setContent(panel)
     166            .setButtonIcons("OLmarker", "cancel");
    168167
    169168        // This repeatedly shows the dialog in case there has been an error.
  • trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java

    r11986 r12279  
    6565        WhichTasksToPerformDialog(JList<DownloadTask> list) {
    6666            super(Main.parent, tr("Which tasks to perform?"), new String[]{tr("Ok"), tr("Cancel")}, true);
    67             setButtonIcons(new String[]{"ok", "cancel"});
     67            setButtonIcons("ok", "cancel");
    6868            final JPanel pane = new JPanel(new GridLayout(2, 1));
    6969            pane.add(new JLabel(tr("Which tasks to perform?")));
     
    138138        ExtendedDialog dialog = new ExtendedDialog(Main.parent,
    139139                tr("Download Location"),
    140                 new String[] {tr("Download URL"), tr("Cancel")}
    141         );
    142         dialog.setContent(all, false /* don't embedded content in JScrollpane  */);
    143         dialog.setButtonIcons(new String[] {"download", "cancel"});
    144         dialog.setToolTipTexts(new String[] {
     140                tr("Download URL"), tr("Cancel"))
     141            .setContent(all, false /* don't embedded content in JScrollpane  */)
     142            .setButtonIcons("download", "cancel")
     143            .setToolTipTexts(
    145144                tr("Start downloading data"),
    146                 tr("Close dialog and cancel downloading")
    147         });
    148         dialog.configureContextsensitiveHelp("/Action/OpenLocation", true /* show help button */);
    149         dialog.showDialog();
    150         if (dialog.getValue() == 1) {
     145                tr("Close dialog and cancel downloading"))
     146            .configureContextsensitiveHelp("/Action/OpenLocation", true /* show help button */);
     147        if (dialog.showDialog().getValue() == 1) {
    151148            USE_NEW_LAYER.put(layer.isSelected());
    152149            remindUploadAddressHistory(uploadAddresses);
  • trunk/src/org/openstreetmap/josm/actions/SaveAction.java

    r8510 r12279  
    4747                    Main.parent,
    4848                    tr("Overwrite"),
    49                     new String[] {tr("Overwrite"), tr("Cancel")}
    50             );
    51             dialog.setButtonIcons(new String[] {"save_as", "cancel"});
    52             dialog.setContent(tr("File {0} exists. Overwrite?", f.getName()));
    53             dialog.showDialog();
    54             int ret = dialog.getValue();
    55             if (ret != 1) {
     49                    tr("Overwrite"), tr("Cancel"))
     50                .setButtonIcons("save_as", "cancel")
     51                .setContent(tr("File {0} exists. Overwrite?", f.getName()));
     52            if (dialog.showDialog().getValue() != 1) {
    5653                f = null;
    5754            }
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r10407 r12279  
    207207    public static boolean confirmOverwrite(File file) {
    208208        if (file == null || file.exists()) {
    209             ExtendedDialog dialog = new ExtendedDialog(
     209            return new ExtendedDialog(
    210210                    Main.parent,
    211211                    tr("Overwrite"),
    212                     new String[] {tr("Overwrite"), tr("Cancel")}
    213             );
    214             dialog.setContent(tr("File exists. Overwrite?"));
    215             dialog.setButtonIcons(new String[] {"save_as", "cancel"});
    216             dialog.showDialog();
    217             return dialog.getValue() == 1;
     212                    tr("Overwrite"), tr("Cancel"))
     213                .setContent(tr("File exists. Overwrite?"))
     214                .setButtonIcons("save_as", "cancel")
     215                .showDialog()
     216                .getValue() == 1;
    218217        }
    219218        return true;
  • trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java

    r11889 r12279  
    5353        contentPanel.add(searchTermBox, gc);
    5454
    55         ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Search for notes"),
    56                 new String[] {tr("Search for notes"), tr("Cancel")});
    57         ed.setContent(contentPanel);
    58         ed.setButtonIcons(new String[] {"note_search", "cancel"});
    59         ed.showDialog();
    60         if (ed.getValue() != 1) {
     55        ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Search for notes"), tr("Search for notes"), tr("Cancel"))
     56            .setContent(contentPanel)
     57            .setButtonIcons("note_search", "cancel");
     58        if (ed.showDialog().getValue() != 1) {
    6159            return;
    6260        }
     
    6462        String searchTerm = Optional.ofNullable(searchTermBox.getText()).orElse("").trim();
    6563        if (searchTerm.isEmpty()) {
    66             Notification notification = new Notification(tr("You must enter a search term"));
    67             notification.setIcon(JOptionPane.WARNING_MESSAGE);
    68             notification.show();
     64            new Notification(tr("You must enter a search term"))
     65                .setIcon(JOptionPane.WARNING_MESSAGE)
     66                .show();
    6967            return;
    7068        }
  • trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java

    r11848 r12279  
    118118            fc = createAndOpenFileChooser(false, false, tr("Save session"), joz, JFileChooser.FILES_ONLY, "lastDirectory");
    119119        } else {
    120             fc = createAndOpenFileChooser(false, false, tr("Save session"), Arrays.asList(new FileFilter[]{jos, joz}), jos,
     120            fc = createAndOpenFileChooser(false, false, tr("Save session"), Arrays.asList(jos, joz), jos,
    121121                    JFileChooser.FILES_ONLY, "lastDirectory");
    122122        }
     
    188188         */
    189189        public SessionSaveAsDialog() {
    190             super(Main.parent, tr("Save Session"), new String[] {tr("Save As"), tr("Cancel")});
     190            super(Main.parent, tr("Save Session"), tr("Save As"), tr("Cancel"));
    191191            initialize();
    192             setButtonIcons(new String[] {"save_as", "cancel"});
     192            setButtonIcons("save_as", "cancel");
    193193            setDefaultButton(1);
    194194            setRememberWindowGeometry(getClass().getName() + ".geometry",
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r12217 r12279  
    291291        ExtendedDialog ed = new ExtendedDialog(Main.parent,
    292292                tr("Status Report"),
    293                 new String[] {tr("Copy to clipboard and close"), tr("Report bug"), tr("Close") });
    294         ed.setButtonIcons(new String[] {"copy", "bug", "cancel" });
     293                tr("Copy to clipboard and close"), tr("Report bug"), tr("Close"));
     294        ed.setButtonIcons("copy", "bug", "cancel");
    295295        ed.setContent(ta, false);
    296296        ed.setMinimumSize(new Dimension(380, 200));
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r12031 r12279  
    243243            configureList();
    244244
    245             setButtonIcons(new String[]{"ok", "cancel"});
     245            setButtonIcons("ok", "cancel");
    246246            final JPanel pane = new JPanel(new GridBagLayout());
    247247            pane.add(new JLabel(getTitle()), GBC.eol().fill(GBC.HORIZONTAL));
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r12031 r12279  
    206206
    207207        private PropertiesMembershipDialog(boolean preselectNew, boolean queryTags, boolean queryMemberships) {
    208             super(Main.parent, tr("Tags / Memberships"), new String[]{tr("Unglue"), tr("Cancel")});
    209             setButtonIcons(new String[]{"unglueways", "cancel"});
     208            super(Main.parent, tr("Tags / Memberships"), tr("Unglue"), tr("Cancel"));
     209            setButtonIcons("unglueways", "cancel");
    210210
    211211            final JPanel content = new JPanel(new GridBagLayout());
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r12065 r12279  
    869869            super(Main.parent,
    870870                    tr("Move elements"),
    871                     new String[]{tr("Move them"), tr("Undo move")});
    872             setButtonIcons(new String[]{"reorder", "cancel"});
     871                    tr("Move them"), tr("Undo move"));
     872            setButtonIcons("reorder", "cancel");
    873873            setCancelButton(2);
    874874        }
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r11986 r12279  
    340340                Main.parent,
    341341                initialValues instanceof Filter ? tr("Filter") : tr("Search"),
    342                         new String[] {
    343                     initialValues instanceof Filter ? tr("Submit filter") : tr("Start Search"),
    344                             tr("Cancel")}
     342                initialValues instanceof Filter ? tr("Submit filter") : tr("Start Search"),
     343                tr("Cancel")
    345344        ) {
    346345            @Override
     
    368367            }
    369368        };
    370         dialog.setButtonIcons(new String[] {"dialogs/search", "cancel"});
     369        dialog.setButtonIcons("dialogs/search", "cancel");
    371370        dialog.configureContextsensitiveHelp("/Action/Search", true /* show help button */);
    372371        dialog.setContent(p);
    373         dialog.showDialog();
    374         int result = dialog.getValue();
    375 
    376         if (result != 1) return null;
     372
     373        if (dialog.showDialog().getValue() != 1) return null;
    377374
    378375        // User pressed OK - let's perform the search
  • trunk/src/org/openstreetmap/josm/actions/upload/RelationUploadOrderHook.java

    r9543 r12279  
    8080                Main.parent,
    8181                tr("Cycling dependencies"),
    82                 new String[] {tr("OK")}
     82                tr("OK")
    8383        );
    8484        dialog.setContent(pnl, false /* don't embed in scroll pane */);
    85         dialog.setButtonIcons(new String[] {"ok"});
     85        dialog.setButtonIcons("ok");
    8686        dialog.setRememberWindowGeometry(
    8787                getClass().getName() + ".geometry",
  • trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java

    r12212 r12279  
    141141        ExtendedDialog ed = new ExtendedDialog(Main.parent,
    142142                tr("Suspicious data found. Upload anyway?"),
    143                 new String[] {tr("Continue upload"), tr("Cancel")});
    144         ed.setButtonIcons(new String[] {"ok.png", "cancel.png"});
    145         ed.setContent(p);
    146         ed.showDialog();
     143                tr("Continue upload"), tr("Cancel"))
     144            .setButtonIcons("ok", "cancel")
     145            .setContent(p);
    147146
    148         if (ed.getValue() != 1) {
     147        if (ed.showDialog().getValue() != 1) {
    149148            OsmValidator.initializeTests();
    150149            OsmValidator.initializeErrorLayer();
Note: See TracChangeset for help on using the changeset viewer.