Ignore:
Timestamp:
2018-08-15T02:05:27+02:00 (8 years ago)
Author:
donvip
Message:

update to JOSM 14153

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery_offset_db/src/iodb/OffsetDialog.java

    r34095 r34466  
    3535import javax.swing.border.EmptyBorder;
    3636
    37 import org.openstreetmap.josm.Main;
    3837import org.openstreetmap.josm.data.Bounds;
    3938import org.openstreetmap.josm.data.UserIdentityManager;
     
    4342import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer;
    4443import org.openstreetmap.josm.gui.layer.MapViewPaintable;
     44import org.openstreetmap.josm.spi.preferences.Config;
    4545import org.openstreetmap.josm.tools.HttpClient;
    4646import org.openstreetmap.josm.tools.ImageProvider;
     
    5757    protected static final String PREF_CALIBRATION = "iodb.show.calibration";
    5858    protected static final String PREF_DEPRECATED = "iodb.show.deprecated";
    59     private static final int MAX_OFFSETS = Main.pref.getInt("iodb.max.offsets", 4);
     59    private static final int MAX_OFFSETS = Config.getPref().getInt("iodb.max.offsets", 4);
    6060
    6161    /**
     
    7575     */
    7676    public OffsetDialog(List<ImageryOffsetBase> offsets) {
    77         super(JOptionPane.getFrameForComponent(Main.parent), ImageryOffsetTools.DIALOG_TITLE,
     77        super(JOptionPane.getFrameForComponent(MainApplication.getMainFrame()), ImageryOffsetTools.DIALOG_TITLE,
    7878                MODAL ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS);
    7979        setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
     
    9393        updateButtonPanel();
    9494        final JCheckBox calibrationBox = new JCheckBox(tr("Calibration geometries"));
    95         calibrationBox.setSelected(Main.pref.getBoolean(PREF_CALIBRATION, true));
     95        calibrationBox.setSelected(Config.getPref().getBoolean(PREF_CALIBRATION, true));
    9696        calibrationBox.addActionListener(new ActionListener() {
    9797            @Override
    9898            public void actionPerformed(ActionEvent e) {
    99                 Main.pref.putBoolean(PREF_CALIBRATION, calibrationBox.isSelected());
     99                Config.getPref().putBoolean(PREF_CALIBRATION, calibrationBox.isSelected());
    100100                updateButtonPanel();
    101101            }
    102102        });
    103103        final JCheckBox deprecatedBox = new JCheckBox(tr("Deprecated offsets"));
    104         deprecatedBox.setSelected(Main.pref.getBoolean(PREF_DEPRECATED, false));
     104        deprecatedBox.setSelected(Config.getPref().getBoolean(PREF_DEPRECATED, false));
    105105        deprecatedBox.addActionListener(new ActionListener() {
    106106            @Override
    107107            public void actionPerformed(ActionEvent e) {
    108                 Main.pref.putBoolean(PREF_DEPRECATED, deprecatedBox.isSelected());
     108                Config.getPref().putBoolean(PREF_DEPRECATED, deprecatedBox.isSelected());
    109109                updateButtonPanel();
    110110            }
     
    128128        setContentPane(dialog);
    129129        pack();
    130         setLocationRelativeTo(Main.parent);
     130        setLocationRelativeTo(MainApplication.getMainFrame());
    131131    }
    132132
     
    163163     */
    164164    private List<ImageryOffsetBase> filterOffsets() {
    165         boolean showCalibration = Main.pref.getBoolean(PREF_CALIBRATION, true);
    166         boolean showDeprecated = Main.pref.getBoolean(PREF_DEPRECATED, false);
     165        boolean showCalibration = Config.getPref().getBoolean(PREF_CALIBRATION, true);
     166        boolean showDeprecated = Config.getPref().getBoolean(PREF_DEPRECATED, false);
    167167        List<ImageryOffsetBase> filteredOffsets = new ArrayList<>();
    168168        for (ImageryOffsetBase offset : offsets) {
     
    246246        boolean closeDialog = MODAL || selectedOffset == null
    247247                || selectedOffset instanceof CalibrationObject
    248                 || Main.pref.getBoolean("iodb.close.on.select", true);
     248                || Config.getPref().getBoolean("iodb.close.on.select", true);
    249249        if (closeDialog) {
    250250            MapView.removeZoomChangeListener(this);
     
    275275            ImageryOffsetWatcher.getInstance().markGood();
    276276            MainApplication.getMap().repaint();
    277             if (!Main.pref.getBoolean("iodb.offset.message", false)) {
    278                 JOptionPane.showMessageDialog(Main.parent,
     277            if (!Config.getPref().getBoolean("iodb.offset.message", false)) {
     278                JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    279279                        tr("The topmost imagery layer has been shifted to presumably match\n"
    280280                                + "OSM data in the area. Please check that the offset is still valid\n"
    281281                                + "by downloading GPS tracks and comparing them and OSM data to the imagery."),
    282282                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
    283                 Main.pref.putBoolean("iodb.offset.message", true);
     283                Config.getPref().putBoolean("iodb.offset.message", true);
    284284            }
    285285        } else if (selectedOffset instanceof CalibrationObject) {
     
    287287            MainApplication.getLayerManager().addLayer(clayer);
    288288            clayer.panToCenter();
    289             if (!Main.pref.getBoolean("iodb.calibration.message", false)) {
    290                 JOptionPane.showMessageDialog(Main.parent,
     289            if (!Config.getPref().getBoolean("iodb.calibration.message", false)) {
     290                JOptionPane.showMessageDialog(MainApplication.getMainFrame(),
    291291                        tr("A layer has been added with a calibration geometry. Hide data layers,\n"
    292292                                + "find the corresponding feature on the imagery layer and move it accordingly."),
    293293                        ImageryOffsetTools.DIALOG_TITLE, JOptionPane.INFORMATION_MESSAGE);
    294                 Main.pref.putBoolean("iodb.calibration.message", true);
     294                Config.getPref().putBoolean("iodb.calibration.message", true);
    295295            }
    296296        }
     
    332332        @Override
    333333        public void actionPerformed(ActionEvent e) {
    334             String base = Main.pref.get("url.openstreetmap-wiki", "https://wiki.openstreetmap.org/wiki/");
     334            String base = Config.getPref().get("url.openstreetmap-wiki", "https://wiki.openstreetmap.org/wiki/");
    335335            String lang = LanguageInfo.getWikiLanguagePrefix();
    336336            String page = "Imagery_Offset_Database";
Note: See TracChangeset for help on using the changeset viewer.