Ignore:
Timestamp:
2015-11-25T01:21:14+01:00 (4 years ago)
Author:
Don-vip
Message:

Sonar - squid:S1941 - Variables should not be declared before they are relevant

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r9059 r9062  
    380380        if (message == null) return false;
    381381
     382        UpdatePluginsMessagePanel pnlMessage = new UpdatePluginsMessagePanel();
     383        pnlMessage.setMessage(message);
     384        pnlMessage.initDontShowAgain(togglePreferenceKey);
     385
     386        // check whether automatic update at startup was disabled
     387        //
     388        String policy = Main.pref.get(togglePreferenceKey, "ask").trim().toLowerCase(Locale.ENGLISH);
     389        switch(policy) {
     390        case "never":
     391            if ("pluginmanager.version-based-update.policy".equals(togglePreferenceKey)) {
     392                Main.info(tr("Skipping plugin update after JOSM upgrade. Automatic update at startup is disabled."));
     393            } else if ("pluginmanager.time-based-update.policy".equals(togglePreferenceKey)) {
     394                Main.info(tr("Skipping plugin update after elapsed update interval. Automatic update at startup is disabled."));
     395            }
     396            return false;
     397
     398        case "always":
     399            if ("pluginmanager.version-based-update.policy".equals(togglePreferenceKey)) {
     400                Main.info(tr("Running plugin update after JOSM upgrade. Automatic update at startup is enabled."));
     401            } else if ("pluginmanager.time-based-update.policy".equals(togglePreferenceKey)) {
     402                Main.info(tr("Running plugin update after elapsed update interval. Automatic update at startup is disabled."));
     403            }
     404            return true;
     405
     406        case "ask":
     407            break;
     408
     409        default:
     410            Main.warn(tr("Unexpected value ''{0}'' for preference ''{1}''. Assuming value ''ask''.", policy, togglePreferenceKey));
     411        }
     412
    382413        ButtonSpec[] options = new ButtonSpec[] {
    383414                new ButtonSpec(
     
    394425                )
    395426        };
    396 
    397         UpdatePluginsMessagePanel pnlMessage = new UpdatePluginsMessagePanel();
    398         pnlMessage.setMessage(message);
    399         pnlMessage.initDontShowAgain(togglePreferenceKey);
    400 
    401         // check whether automatic update at startup was disabled
    402         //
    403         String policy = Main.pref.get(togglePreferenceKey, "ask").trim().toLowerCase(Locale.ENGLISH);
    404         switch(policy) {
    405         case "never":
    406             if ("pluginmanager.version-based-update.policy".equals(togglePreferenceKey)) {
    407                 Main.info(tr("Skipping plugin update after JOSM upgrade. Automatic update at startup is disabled."));
    408             } else if ("pluginmanager.time-based-update.policy".equals(togglePreferenceKey)) {
    409                 Main.info(tr("Skipping plugin update after elapsed update interval. Automatic update at startup is disabled."));
    410             }
    411             return false;
    412 
    413         case "always":
    414             if ("pluginmanager.version-based-update.policy".equals(togglePreferenceKey)) {
    415                 Main.info(tr("Running plugin update after JOSM upgrade. Automatic update at startup is enabled."));
    416             } else if ("pluginmanager.time-based-update.policy".equals(togglePreferenceKey)) {
    417                 Main.info(tr("Running plugin update after elapsed update interval. Automatic update at startup is disabled."));
    418             }
    419             return true;
    420 
    421         case "ask":
    422             break;
    423 
    424         default:
    425             Main.warn(tr("Unexpected value ''{0}'' for preference ''{1}''. Assuming value ''ask''.", policy, togglePreferenceKey));
    426         }
    427427
    428428        int ret = HelpAwareOptionPane.showOptionDialog(
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r8540 r9062  
    315315        if (sites == null) return;
    316316        getProgressMonitor().setTicksCount(sites.size() * 3);
    317         File pluginDir = Main.pref.getPluginsDirectory();
    318317
    319318        // collect old cache files and remove if no longer in use
     
    334333        }
    335334
     335        File pluginDir = Main.pref.getPluginsDirectory();
    336336        for (String site: sites) {
    337337            String printsite = site.replaceAll("%<(.*)>", "");
Note: See TracChangeset for help on using the changeset viewer.