Ticket #24946: 24946.patch

File 24946.patch, 4.0 KB (added by DanProgs <Abenteurer.2901@…>, 4 days ago)
  • src/org/openstreetmap/josm/actions/JosmAction.java

    ### Eclipse Workspace Patch 1.0
    #P josm
    diff --git src/org/openstreetmap/josm/actions/JosmAction.java src/org/openstreetmap/josm/actions/JosmAction.java
    index 3cc62a1..9ebfce4 100644
     
    8383            String toolbarId, boolean installAdapters) {
    8484        super(name);
    8585        if (icon != null) {
    86             ImageResource resource = icon.getResource();
     86            final ImageResource resource = icon.getResource();
    8787            if (resource != null) {
    8888                try {
    8989                    resource.attachImageIcon(this, true);
    … …  
    353353        MainApplication.worker.submit(() -> {
    354354                        try {
    355355                            future.get();
    356                         } catch (InterruptedException | ExecutionException | CancellationException e) {
     356                        } catch (InterruptedException e) {
     357                            Logging.error(e);
     358                            Thread.currentThread().interrupt();
     359                        } catch (ExecutionException | CancellationException e) {
    357360                            Logging.error(e);
    358361                            return;
     362                        } finally {
     363                            monitor.close();
    359364                        }
    360                         monitor.close();
    361365                    });
    362366    }
    363367
    … …  
    419423     * @since 13434
    420424     */
    421425    protected final void updateEnabledStateOnCurrentSelection(boolean allowReadOnly) {
    422         DataSet ds = getLayerManager().getActiveDataSet();
     426        final DataSet ds = getLayerManager().getActiveDataSet();
    423427        if (ds != null && (allowReadOnly || !ds.isLocked())) {
    424428            updateEnabledState(ds.getSelected());
    425429        } else {
    … …  
    511515            String dialogTitle, String outsideDialogMessage, String incompleteDialogMessage,
    512516            Collection<? extends OsmPrimitive> primitives,
    513517            Collection<? extends OsmPrimitive> ignore) {
    514         int checkRes = Command.checkOutlyingOrIncompleteOperation(primitives, ignore);
     518        final int checkRes = Command.checkOutlyingOrIncompleteOperation(primitives, ignore);
    515519        if ((checkRes & Command.IS_OUTSIDE) != 0) {
    516             boolean answer = showConfirmOutlyingOperationDialog(operation + "_outside_nodes", outsideDialogMessage, dialogTitle);
    517             if (!answer)
    518                 return false;
     520            final boolean answer = showConfirmOutlyingOperationDialog(operation + "_outside_nodes", outsideDialogMessage, dialogTitle);
     521            if (!answer) {
     522                return false;
     523            }
    519524        }
    520525        if ((checkRes & Command.IS_INCOMPLETE) != 0) {
    521526            return showConfirmOutlyingOperationDialog(operation + "_incomplete", incompleteDialogMessage, dialogTitle);
    … …  
    524529    }
    525530
    526531    private static boolean showConfirmOutlyingOperationDialog(String preferenceKey, String dialogMessage, String dialogTitle) {
    527         JPanel msg = new JPanel(new GridBagLayout());
     532        final JPanel msg = new JPanel(new GridBagLayout());
    528533        msg.add(new JMultilineLabel("<html>" + dialogMessage + "</html>"));
    529         boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
     534        final boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
    530535                preferenceKey,
    531536                MainApplication.getMainFrame(),
    532537                msg,
    … …  
    535540                JOptionPane.QUESTION_MESSAGE,
    536541                JOptionPane.YES_OPTION);
    537542        if (!answer && JOptionPane.NO_OPTION == ConditionalOptionPaneUtil.getDialogReturnValue(preferenceKey)) {
    538             String message = tr("Operation was not performed, as per {0} preference", preferenceKey);
     543            final String message = tr("Operation was not performed, as per {0} preference", preferenceKey);
    539544            new Notification(message).setIcon(JOptionPane.INFORMATION_MESSAGE).show();
    540545            Logging.info(message);
    541546        }