Ignore:
Timestamp:
2016-01-01T19:42:27+01:00 (4 years ago)
Author:
simon04
Message:

fix #7670 - Add Overpass settings to main preference

File:
1 edited

Legend:

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

    r9241 r9242  
    1515import java.awt.event.KeyEvent;
    1616import java.util.ArrayList;
    17 import java.util.Arrays;
    1817import java.util.Collection;
    1918import java.util.Collections;
     
    4140import org.openstreetmap.josm.data.preferences.CollectionProperty;
    4241import org.openstreetmap.josm.data.preferences.IntegerProperty;
    43 import org.openstreetmap.josm.data.preferences.StringProperty;
    4442import org.openstreetmap.josm.gui.HelpAwareOptionPane;
    4543import org.openstreetmap.josm.gui.download.DownloadDialog;
     44import org.openstreetmap.josm.gui.preferences.server.OverpassServerPreference;
    4645import org.openstreetmap.josm.gui.util.GuiHelper;
    4746import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
     
    5857 */
    5958public class OverpassDownloadAction extends JosmAction {
    60 
    61     /**
    62      * The {@link StringProperty property} of the currently selected Overpass server.
    63      *
    64      * @since 9241
    65      */
    66     public static final StringProperty OVERPASS_SERVER = new StringProperty("download.overpass.server", "http://overpass-api.de/api/");
    6759
    6860    /**
     
    8880            DownloadOsmTask task = new DownloadOsmTask();
    8981            Future<?> future = task.download(
    90                     new OverpassDownloadReader(area, dialog.getOverpassServer(), dialog.getOverpassQuery()),
     82                    new OverpassDownloadReader(area, OverpassServerPreference.getOverpassServer(), dialog.getOverpassQuery()),
    9183                    dialog.isNewLayerRequired(), area, null);
    9284            Main.worker.submit(new PostDownloadHandler(task, future));
     
    124116    private static final class OverpassDownloadDialog extends DownloadDialog {
    125117
    126         private HistoryComboBox overpassServer;
    127118        private HistoryComboBox overpassWizard;
    128119        private JosmTextArea overpassQuery;
    129120        private static OverpassDownloadDialog instance;
    130         private static final CollectionProperty OVERPASS_SERVER_HISTORY = new CollectionProperty("download.overpass.servers",
    131                 Arrays.asList("http://overpass-api.de/api/", "http://overpass.osm.rambler.ru/cgi/"));
    132121        private static final CollectionProperty OVERPASS_WIZARD_HISTORY = new CollectionProperty("download.overpass.wizard",
    133122                new ArrayList<String>());
     
    203192            pnl.add(pane, gbc);
    204193
    205             overpassServer = new HistoryComboBox();
    206             overpassServer.getEditor().getEditorComponent().addFocusListener(disableActionsFocusListener);
    207             pnl.add(new JLabel(tr("Overpass server: ")), GBC.std().insets(5, 5, 5, 5));
    208             pnl.add(overpassServer, GBC.eol().fill(GBC.HORIZONTAL));
    209         }
    210 
    211         public String getOverpassServer() {
    212             return overpassServer.getText();
    213194        }
    214195
     
    224205        public void restoreSettings() {
    225206            super.restoreSettings();
    226             overpassServer.setPossibleItems(OVERPASS_SERVER_HISTORY.get());
    227             overpassServer.setText(OVERPASS_SERVER.get());
    228207            overpassWizard.setPossibleItems(OVERPASS_WIZARD_HISTORY.get());
    229208        }
     
    233212            super.rememberSettings();
    234213            overpassWizard.addCurrentItemToHistory();
    235             OVERPASS_SERVER.put(getOverpassServer());
    236             OVERPASS_SERVER_HISTORY.put(overpassServer.getHistory());
    237214            OVERPASS_WIZARD_HISTORY.put(overpassWizard.getHistory());
    238215            OverpassQueryHistoryPopup.addToHistory(getOverpassQuery());
Note: See TracChangeset for help on using the changeset viewer.