- Timestamp:
- 2018-08-11T16:10:32+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 added
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r13926 r14119 40 40 import org.openstreetmap.josm.io.FileWatcher; 41 41 import org.openstreetmap.josm.io.OnlineResource; 42 import org.openstreetmap.josm.io.OsmApi;43 42 import org.openstreetmap.josm.spi.preferences.Config; 43 import org.openstreetmap.josm.spi.preferences.IUrls; 44 44 import org.openstreetmap.josm.tools.CheckParameterUtil; 45 45 import org.openstreetmap.josm.tools.ImageProvider; … … 58 58 */ 59 59 public abstract class Main { 60 61 /**62 * The JOSM website URL.63 * @since 6897 (was public from 6143 to 6896)64 */65 private static final String JOSM_WEBSITE = "https://josm.openstreetmap.de";66 67 /**68 * The OSM website URL.69 * @since 6897 (was public from 6453 to 6896)70 */71 private static final String OSM_WEBSITE = "https://www.openstreetmap.org";72 60 73 61 /** … … 539 527 * Returns the JOSM website URL. 540 528 * @return the josm website URL 529 * @deprecated Use {@link IUrls#getJOSMWebsite} 541 530 * @since 6897 542 531 */ 532 @Deprecated 543 533 public static String getJOSMWebsite() { 544 if (Config.getPref() != null) 545 return Config.getPref().get("josm.url", JOSM_WEBSITE); 546 return JOSM_WEBSITE; 534 return Config.getUrls().getJOSMWebsite(); 547 535 } 548 536 … … 550 538 * Returns the JOSM XML URL. 551 539 * @return the josm XML URL 540 * @deprecated Use {@link IUrls#getXMLBase} 552 541 * @since 6897 553 542 */ 543 @Deprecated 554 544 public static String getXMLBase() { 555 // Always return HTTP (issues reported with HTTPS) 556 return "http://josm.openstreetmap.de"; 545 return Config.getUrls().getXMLBase(); 557 546 } 558 547 … … 560 549 * Returns the OSM website URL. 561 550 * @return the OSM website URL 551 * @deprecated Use {@link IUrls#getOSMWebsite} 562 552 * @since 6897 563 553 */ 554 @Deprecated 564 555 public static String getOSMWebsite() { 565 if (Config.getPref() != null) 566 return Config.getPref().get("osm.url", OSM_WEBSITE); 567 return OSM_WEBSITE; 568 } 569 570 /** 571 * Returns the OSM website URL depending on the selected {@link OsmApi}. 572 * @return the OSM website URL depending on the selected {@link OsmApi} 573 */ 574 private static String getOSMWebsiteDependingOnSelectedApi() { 575 final String api = OsmApi.getOsmApi().getServerUrl(); 576 if (OsmApi.DEFAULT_API_URL.equals(api)) { 577 return getOSMWebsite(); 578 } else { 579 return api.replaceAll("/api$", ""); 580 } 556 return Config.getUrls().getOSMWebsite(); 581 557 } 582 558 … … 584 560 * Replies the base URL for browsing information about a primitive. 585 561 * @return the base URL, i.e. https://www.openstreetmap.org 562 * @deprecated Use {@link IUrls#getBaseBrowseUrl} 586 563 * @since 7678 587 564 */ 565 @Deprecated 588 566 public static String getBaseBrowseUrl() { 589 if (Config.getPref() != null) 590 return Config.getPref().get("osm-browse.url", getOSMWebsiteDependingOnSelectedApi()); 591 return getOSMWebsiteDependingOnSelectedApi(); 567 return Config.getUrls().getBaseBrowseUrl(); 592 568 } 593 569 … … 595 571 * Replies the base URL for browsing information about a user. 596 572 * @return the base URL, i.e. https://www.openstreetmap.org/user 573 * @deprecated Use {@link IUrls#getBaseUserUrl} 597 574 * @since 7678 598 575 */ 576 @Deprecated 599 577 public static String getBaseUserUrl() { 600 if (Config.getPref() != null) 601 return Config.getPref().get("osm-user.url", getOSMWebsiteDependingOnSelectedApi() + "/user"); 602 return getOSMWebsiteDependingOnSelectedApi() + "/user"; 578 return Config.getUrls().getBaseUserUrl(); 603 579 } 604 580 -
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r14107 r14119 33 33 import org.openstreetmap.josm.gui.widgets.UrlLabel; 34 34 import org.openstreetmap.josm.plugins.PluginHandler; 35 import org.openstreetmap.josm.spi.preferences.Config; 35 36 import org.openstreetmap.josm.tools.GBC; 36 37 import org.openstreetmap.josm.tools.ImageProvider; … … 100 101 info.add(label, GBC.eol().fill(GBC.HORIZONTAL).insets(10, 0, 0, 10)); 101 102 info.add(new JLabel(tr("Homepage")), GBC.std().insets(10, 0, 10, 0)); 102 info.add(new UrlLabel( Main.getJOSMWebsite(), 2), GBC.eol());103 info.add(new UrlLabel(Config.getUrls().getJOSMWebsite(), 2), GBC.eol()); 103 104 info.add(new JLabel(tr("Translations")), GBC.std().insets(10, 0, 10, 0)); 104 105 info.add(new UrlLabel("https://translations.launchpad.net/josm", 2), GBC.eol()); -
trunk/src/org/openstreetmap/josm/actions/HistoryInfoWebAction.java
r13954 r14119 7 7 import java.awt.event.KeyEvent; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.data.osm.IPrimitive; 11 10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 11 import org.openstreetmap.josm.spi.preferences.Config; 12 12 import org.openstreetmap.josm.tools.Shortcut; 13 13 … … 34 34 if (infoObject instanceof IPrimitive) { 35 35 IPrimitive primitive = (IPrimitive) infoObject; 36 return Main.getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getOsmId() + "/history"; 36 return Config.getUrls().getBaseBrowseUrl() 37 + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getOsmId() + "/history"; 37 38 } else { 38 39 return null; -
trunk/src/org/openstreetmap/josm/actions/InfoWebAction.java
r13954 r14119 8 8 import java.util.Collection; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.notes.Note; 12 11 import org.openstreetmap.josm.data.osm.IPrimitive; … … 14 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 15 14 import org.openstreetmap.josm.gui.MainApplication; 15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 import org.openstreetmap.josm.tools.Shortcut; 17 17 … … 38 38 if (infoObject instanceof IPrimitive) { 39 39 IPrimitive primitive = (IPrimitive) infoObject; 40 return Main.getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getOsmId();40 return Config.getUrls().getBaseBrowseUrl() + '/' + OsmPrimitiveType.from(primitive).getAPIName() + '/' + primitive.getOsmId(); 41 41 } else if (infoObject instanceof Note) { 42 42 Note note = (Note) infoObject; 43 return Main.getBaseBrowseUrl() + "/note/" + note.getId();43 return Config.getUrls().getBaseBrowseUrl() + "/note/" + note.getId(); 44 44 } else { 45 45 return null; -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r13647 r14119 198 198 199 199 String osmApi = OsmApi.getOsmApi().getServerUrl(); 200 if (! OsmApi.DEFAULT_API_URL.equals(osmApi.trim())) {200 if (!Config.getUrls().getDefaultOsmApiUrl().equals(osmApi.trim())) { 201 201 text.append("OSM API: ").append(osmApi).append("\n\n"); 202 202 } -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r14014 r14119 715 715 */ 716 716 public Collection<String> getPluginSites() { 717 return getList("pluginmanager.sites", Collections.singletonList( Main.getJOSMWebsite()+"/pluginicons%<?plugins=>"));717 return getList("pluginmanager.sites", Collections.singletonList(Config.getUrls().getJOSMWebsite()+"/pluginicons%<?plugins=>")); 718 718 } 719 719 … … 727 727 for (Iterator<String> it = pluginSites.iterator(); it.hasNext();) { 728 728 try { 729 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(it.next(), Main.getJOSMWebsite());729 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(it.next(), Config.getUrls().getJOSMWebsite()); 730 730 } catch (OfflineAccessException ex) { 731 731 Logging.log(Logging.LEVEL_WARN, ex); -
trunk/src/org/openstreetmap/josm/data/gpx/GpxConstants.java
r12186 r14119 7 7 import java.util.List; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.data.Bounds; 10 import org.openstreetmap.josm.spi.preferences.Config; 11 11 12 12 /** … … 103 103 * A namespace for josm GPX extensions 104 104 */ 105 String JOSM_EXTENSIONS_NAMESPACE_URI = Main.getXMLBase() + "/gpx-extensions-1.0";105 String JOSM_EXTENSIONS_NAMESPACE_URI = Config.getUrls().getXMLBase() + "/gpx-extensions-1.0"; 106 106 107 107 /** Elevation (in meters) of the point. */ -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r13890 r14119 18 18 import java.util.concurrent.ExecutorService; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.data.StructUtils; 22 21 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryPreferenceEntry; … … 50 49 51 50 private static final String[] DEFAULT_LAYER_SITES = { 52 Main.getJOSMWebsite()+"/maps%<?ids=>"51 Config.getUrls().getJOSMWebsite()+"/maps%<?ids=>" 53 52 }; 54 53 … … 162 161 boolean online = true; 163 162 try { 164 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(source, Main.getJOSMWebsite());163 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(source, Config.getUrls().getJOSMWebsite()); 165 164 } catch (OfflineAccessException e) { 166 165 Logging.log(Logging.LEVEL_WARN, e); -
trunk/src/org/openstreetmap/josm/data/oauth/OAuthParameters.java
r13173 r14119 4 4 import java.util.Objects; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.io.OsmApi; 8 7 import org.openstreetmap.josm.spi.preferences.Config; … … 56 55 } 57 56 58 if (apiUrl != null && ! OsmApi.DEFAULT_API_URL.equals(apiUrl)) {57 if (apiUrl != null && !Config.getUrls().getDefaultOsmApiUrl().equals(apiUrl)) { 59 58 consumerKey = ""; // a custom consumer key is required 60 59 consumerSecret = ""; // a custom consumer secret is requireds … … 63 62 consumerKey = DEFAULT_JOSM_CONSUMER_KEY; 64 63 consumerSecret = DEFAULT_JOSM_CONSUMER_SECRET; 65 serverUrl = Main.getOSMWebsite();64 serverUrl = Config.getUrls().getOSMWebsite(); 66 65 } 67 66 -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r14001 r14119 55 55 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 56 56 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 57 import org.openstreetmap.josm.spi.preferences.Config; 57 58 import org.openstreetmap.josm.tools.ListenerList; 58 59 import org.openstreetmap.josm.tools.Logging; … … 772 773 "JOSM expected to find primitive [{0} {1}] in dataset but it is not there. Please report this " 773 774 + "at {2}. This is not a critical error, it should be safe to continue in your work.", 774 primitiveId.getType(), Long.toString(primitiveId.getUniqueId()), Main.getJOSMWebsite()));775 primitiveId.getType(), Long.toString(primitiveId.getUniqueId()), Config.getUrls().getJOSMWebsite())); 775 776 Logging.error(new Exception()); 776 777 } -
trunk/src/org/openstreetmap/josm/data/preferences/PreferencesWriter.java
r12881 r14119 9 9 import java.util.stream.Stream; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.Version; 13 12 import org.openstreetmap.josm.io.XmlWriter; 14 import org.openstreetmap.josm.spi.preferences. Setting;13 import org.openstreetmap.josm.spi.preferences.Config; 15 14 import org.openstreetmap.josm.spi.preferences.ListListSetting; 16 import org.openstreetmap.josm.spi.preferences.SettingVisitor;17 15 import org.openstreetmap.josm.spi.preferences.ListSetting; 18 16 import org.openstreetmap.josm.spi.preferences.MapListSetting; 17 import org.openstreetmap.josm.spi.preferences.Setting; 18 import org.openstreetmap.josm.spi.preferences.SettingVisitor; 19 19 import org.openstreetmap.josm.spi.preferences.StringSetting; 20 20 … … 57 57 out.write(String.format("<?xml version=\"1.0\" encoding=\"UTF-8\"?>%n")); 58 58 String rootElement = defaults ? "preferences-defaults" : "preferences"; 59 out.write(String.format("<%s xmlns='%s/preferences-1.0'", rootElement, Main.getXMLBase()));59 out.write(String.format("<%s xmlns='%s/preferences-1.0'", rootElement, Config.getUrls().getXMLBase())); 60 60 if (defaults) { 61 61 out.write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"); -
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r13647 r14119 19 19 import javax.swing.event.HyperlinkListener; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.actions.DownloadPrimitiveAction; 23 22 import org.openstreetmap.josm.data.Version; … … 105 104 @Override 106 105 protected void checkOfflineAccess() { 107 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(new WikiReader().getBaseUrlWiki(), Main.getJOSMWebsite());106 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(new WikiReader().getBaseUrlWiki(), Config.getUrls().getJOSMWebsite()); 108 107 } 109 108 -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r14118 r14119 100 100 import org.openstreetmap.josm.data.osm.search.SearchMode; 101 101 import org.openstreetmap.josm.data.preferences.JosmBaseDirectories; 102 import org.openstreetmap.josm.data.preferences.JosmUrls; 102 103 import org.openstreetmap.josm.data.preferences.sources.SourceType; 103 104 import org.openstreetmap.josm.data.projection.ProjectionCLI; … … 298 299 */ 299 300 public static final NTV2GridShiftFileSource JOSM_WEBSITE_NTV2_SOURCE = gridFileName -> { 300 String location = Main.getJOSMWebsite() + "/proj/" + gridFileName;301 String location = Config.getUrls().getJOSMWebsite() + "/proj/" + gridFileName; 301 302 // Try to load grid file 302 303 CachedFile cf = new CachedFile(location); … … 918 919 Config.setPreferencesInstance(Main.pref); 919 920 Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance()); 921 Config.setUrlsProvider(JosmUrls.getInstance()); 920 922 921 923 if (args.showVersion()) { … … 1566 1568 userInfo.getUnreadMessages(), userInfo.getUnreadMessages())), 1567 1569 GBC.eol()); 1568 panel.add(new UrlLabel( Main.getBaseUserUrl() + '/' + userInfo.getDisplayName() + "/inbox",1570 panel.add(new UrlLabel(Config.getUrls().getBaseUserUrl() + '/' + userInfo.getDisplayName() + "/inbox", 1569 1571 tr("Click here to see your inbox.")), GBC.eol()); 1570 1572 panel.setOpaque(false); -
trunk/src/org/openstreetmap/josm/gui/bugreport/BugReportDialog.java
r13761 r14119 30 30 import org.openstreetmap.josm.plugins.PluginDownloadTask; 31 31 import org.openstreetmap.josm.plugins.PluginHandler; 32 import org.openstreetmap.josm.spi.preferences.Config; 32 33 import org.openstreetmap.josm.tools.GBC; 33 34 import org.openstreetmap.josm.tools.ImageProvider; … … 74 75 tr("Opening the bug report failed. Please report manually using this website:")), 75 76 GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 76 errorPanel.add(new UrlLabel( Main.getJOSMWebsite() + "/newticket", 2), GBC.eop().insets(8, 0, 0, 0));77 errorPanel.add(new UrlLabel(Config.getUrls().getJOSMWebsite() + "/newticket", 2), GBC.eop().insets(8, 0, 0, 0)); 77 78 errorPanel.add(new DebugTextDisplay(statusText)); 78 79 … … 142 143 143 144 panel.add(new JLabel(tr("Manually report at:")+' '), GBC.std()); 144 panel.add(new UrlLabel( Main.getJOSMWebsite() + "/newticket"), GBC.std().fill(GBC.HORIZONTAL));145 panel.add(new UrlLabel(Config.getUrls().getJOSMWebsite() + "/newticket"), GBC.std().fill(GBC.HORIZONTAL)); 145 146 JButton copy = new JButton("Copy to clipboard"); 146 147 copy.addActionListener(e -> textPanel.copyToClipboard()); -
trunk/src/org/openstreetmap/josm/gui/bugreport/JosmUpdatePanel.java
r13647 r14119 17 17 import org.openstreetmap.josm.gui.widgets.UrlLabel; 18 18 import org.openstreetmap.josm.io.CachedFile; 19 import org.openstreetmap.josm.spi.preferences.Config; 19 20 import org.openstreetmap.josm.tools.GBC; 20 21 import org.openstreetmap.josm.tools.ImageProvider; … … 61 62 62 63 private static int getTestedVersion() { 63 try (CachedFile testedVersion = new CachedFile( Main.getJOSMWebsite() + "/tested")) {64 try (CachedFile testedVersion = new CachedFile(Config.getUrls().getJOSMWebsite() + "/tested")) { 64 65 testedVersion.setMaxAge(60L * 15); // 15 Minutes 65 66 String testedString = new String(testedVersion.getByteContent(), StandardCharsets.ISO_8859_1); … … 91 92 private void showUpdateButton() { 92 93 add(new JMultilineLabel(tr("Before you file a bug report make sure you have updated to the latest version of JOSM here:")), GBC.eol()); 93 add(new UrlLabel( Main.getJOSMWebsite(), 2), GBC.eop().insets(8, 0, 0, 0));94 add(new UrlLabel(Config.getUrls().getJOSMWebsite(), 2), GBC.eop().insets(8, 0, 0, 0)); 94 95 JButton updateButton = new JButton(tr("Update JOSM"), ImageProvider.getIfAvailable("download")); 95 96 updateButton.addActionListener(e -> openJosmUpdateSite()); … … 99 100 private static void openJosmUpdateSite() { 100 101 try { 101 Main.platform.openUrl( Main.getJOSMWebsite());102 Main.platform.openUrl(Config.getUrls().getJOSMWebsite()); 102 103 } catch (IOException ex) { 103 104 Logging.log(Logging.LEVEL_WARN, "Unable to access JOSM website:", ex); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r13761 r14119 429 429 if (sel.size() > 10 && !AbstractInfoAction.confirmLaunchMultiple(sel.size())) 430 430 return; 431 String baseUrl = Main.getBaseBrowseUrl();431 String baseUrl = Config.getUrls().getBaseBrowseUrl(); 432 432 for (Changeset cs: sel) { 433 433 OpenBrowser.displayUrl(baseUrl + "/changeset/" + cs.getId()); -
trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
r12734 r14119 47 47 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 48 48 import org.openstreetmap.josm.gui.layer.NoteLayer; 49 import org.openstreetmap.josm.spi.preferences.Config; 49 50 import org.openstreetmap.josm.tools.ImageProvider; 50 51 import org.openstreetmap.josm.tools.OpenBrowser; … … 432 433 final Note note = displayList.getSelectedValue(); 433 434 if (note.getId() > 0) { 434 final String url = Main.getBaseBrowseUrl() + "/note/" + note.getId();435 final String url = Config.getUrls().getBaseBrowseUrl() + "/note/" + note.getId(); 435 436 OpenBrowser.displayUrl(url); 436 437 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r13926 r14119 31 31 import javax.swing.table.DefaultTableModel; 32 32 33 import org.openstreetmap.josm.Main;34 33 import org.openstreetmap.josm.actions.AbstractInfoAction; 35 34 import org.openstreetmap.josm.data.osm.DataSelectionListener; … … 48 47 import org.openstreetmap.josm.gui.util.GuiHelper; 49 48 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 49 import org.openstreetmap.josm.spi.preferences.Config; 50 50 import org.openstreetmap.josm.tools.ImageProvider; 51 51 import org.openstreetmap.josm.tools.Logging; … … 237 237 if (infoObject instanceof User) { 238 238 User user = (User) infoObject; 239 return Main.getBaseUserUrl() + '/' + Utils.encodeUrl(user.getName()).replaceAll("\\+", "%20");239 return Config.getUrls().getBaseUserUrl() + '/' + Utils.encodeUrl(user.getName()).replaceAll("\\+", "%20"); 240 240 } else { 241 241 return null; -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java
r13617 r14119 23 23 import javax.swing.event.HyperlinkEvent; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 27 26 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 29 28 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException; 30 29 import org.openstreetmap.josm.io.OsmApi; 30 import org.openstreetmap.josm.spi.preferences.Config; 31 31 import org.openstreetmap.josm.tools.ImageProvider; 32 32 import org.openstreetmap.josm.tools.Logging; … … 80 80 protected static List<String> getExamples() { 81 81 return Arrays.asList( 82 Main.getOSMWebsite()+"/history?open=true",82 Config.getUrls().getOSMWebsite()+"/history?open=true", 83 83 OsmApi.getOsmApi().getBaseUrl()+"/changesets?open=true"); 84 84 } -
trunk/src/org/openstreetmap/josm/gui/download/OverpassQueryWizardDialog.java
r13930 r14119 20 20 import javax.swing.text.JTextComponent; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.preferences.ListProperty; 24 23 import org.openstreetmap.josm.gui.ExtendedDialog; … … 26 25 import org.openstreetmap.josm.gui.util.GuiHelper; 27 26 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 27 import org.openstreetmap.josm.spi.preferences.Config; 28 28 import org.openstreetmap.josm.tools.GBC; 29 29 import org.openstreetmap.josm.tools.Logging; … … 196 196 .append(tr("The <i>Query Wizard</i> tool will transform those to a valid overpass query.")) 197 197 .append(tr("For more detailed description see ")) 198 .append(tr("<a href=\"{0}\">OSM Wiki</a>.", Main.getOSMWebsite() + "/wiki/Overpass_turbo/Wizard"))198 .append(tr("<a href=\"{0}\">OSM Wiki</a>.", Config.getUrls().getOSMWebsite() + "/wiki/Overpass_turbo/Wizard")) 199 199 .append("</p>") 200 200 .append(HEADLINE_START).append(tr("Hints")).append(HEADLINE_END) -
trunk/src/org/openstreetmap/josm/gui/help/HelpUtil.java
r12846 r14119 11 11 import javax.swing.KeyStroke; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.HelpAction; 15 14 import org.openstreetmap.josm.gui.MainApplication; … … 34 33 */ 35 34 public static String getWikiBaseUrl() { 36 return Config.getPref().get("help.baseurl", Main.getJOSMWebsite());35 return Config.getPref().get("help.baseurl", Config.getUrls().getJOSMWebsite()); 37 36 } 38 37 -
trunk/src/org/openstreetmap/josm/gui/history/OpenChangesetPopupMenu.java
r13043 r14119 15 15 import javax.swing.JPopupMenu; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.data.StructUtils; 19 18 import org.openstreetmap.josm.data.StructUtils.StructEntry; … … 52 51 53 52 private static final List<ChangesetViewerEntry> DEFAULT_ENTRIES = Arrays.asList( 54 new ChangesetViewerEntry(tr("View changeset in web browser"), Main.getBaseBrowseUrl() + "/changeset/{0}"),53 new ChangesetViewerEntry(tr("View changeset in web browser"), Config.getUrls().getBaseBrowseUrl() + "/changeset/{0}"), 55 54 new ChangesetViewerEntry(tr("Open {0}", "achavi (Augmented OSM Change Viewer)"), "https://overpass-api.de/achavi/?changeset={0}"), 56 55 new ChangesetViewerEntry(tr("Open {0}", "OSMCha (OSM Changeset Analyzer)"), "https://osmcha.mapbox.com/changesets/{0}"), -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r13853 r14119 26 26 import javax.swing.plaf.basic.BasicArrowButton; 27 27 28 import org.openstreetmap.josm.Main;29 28 import org.openstreetmap.josm.data.UserIdentityManager; 30 29 import org.openstreetmap.josm.data.osm.Changeset; … … 39 38 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 40 39 import org.openstreetmap.josm.gui.widgets.UrlLabel; 40 import org.openstreetmap.josm.spi.preferences.Config; 41 41 import org.openstreetmap.josm.tools.CheckParameterUtil; 42 42 import org.openstreetmap.josm.tools.GBC; … … 215 215 216 216 protected static String getUserUrl(String username) { 217 return Main.getBaseUserUrl() + '/' + Utils.encodeUrl(username).replaceAll("\\+", "%20");217 return Config.getUrls().getBaseUserUrl() + '/' + Utils.encodeUrl(username).replaceAll("\\+", "%20"); 218 218 } 219 219 … … 248 248 if (!isLatest && cs != null) { 249 249 User user = cs.getUser(); 250 String url = Main.getBaseBrowseUrl() + "/changeset/" + cs.getId();250 String url = Config.getUrls().getBaseBrowseUrl() + "/changeset/" + cs.getId(); 251 251 lblChangeset.setUrl(url); 252 252 lblChangeset.setDescription(Long.toString(cs.getId())); -
trunk/src/org/openstreetmap/josm/gui/history/VersionTable.java
r13130 r14119 27 27 import javax.swing.table.TableCellRenderer; 28 28 29 import org.openstreetmap.josm.Main;30 29 import org.openstreetmap.josm.actions.AbstractInfoAction; 31 30 import org.openstreetmap.josm.data.osm.User; … … 162 161 if (infoObject instanceof HistoryOsmPrimitive) { 163 162 HistoryOsmPrimitive prim = (HistoryOsmPrimitive) infoObject; 164 return Main.getBaseBrowseUrl() + "/changeset/" + prim.getChangesetId();163 return Config.getUrls().getBaseBrowseUrl() + "/changeset/" + prim.getChangesetId(); 165 164 } else { 166 165 return null; … … 199 198 if (infoObject instanceof HistoryOsmPrimitive) { 200 199 HistoryOsmPrimitive hp = (HistoryOsmPrimitive) infoObject; 201 return hp.getUser() == null ? null : Main.getBaseUserUrl() + '/' + hp.getUser().getName();200 return hp.getUser() == null ? null : Config.getUrls().getBaseUserUrl() + '/' + hp.getUser().getName(); 202 201 } else { 203 202 return null; -
trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java
r13842 r14119 40 40 import org.openstreetmap.josm.io.OsmTransferException; 41 41 import org.openstreetmap.josm.io.UploadStrategySpecification; 42 import org.openstreetmap.josm.spi.preferences.Config; 42 43 import org.openstreetmap.josm.tools.ImageProvider; 43 44 import org.openstreetmap.josm.tools.Logging; … … 342 343 if (lastException == null) { 343 344 HtmlPanel panel = new HtmlPanel( 344 "<h3><a href=\"" + Main.getBaseBrowseUrl() + "/changeset/" + changeset.getId() + "\">"345 "<h3><a href=\"" + Config.getUrls().getBaseBrowseUrl() + "/changeset/" + changeset.getId() + "\">" 345 346 + tr("Upload successful!") + "</a></h3>"); 346 347 panel.enableClickableHyperlinks(); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java
r14108 r14119 366 366 + "If you want to upload traces, look here:</html>")), 367 367 GBC.eol()); 368 msg.add(new UrlLabel( Main.getOSMWebsite() + "/traces", 2), GBC.eop());368 msg.add(new UrlLabel(Config.getUrls().getOSMWebsite() + "/traces", 2), GBC.eop()); 369 369 if (!ConditionalOptionPaneUtil.showConfirmationDialog("convert_to_data", Main.parent, msg, tr("Warning"), 370 370 JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_OPTION)) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java
r14118 r14119 30 30 import org.openstreetmap.josm.data.osm.DataSet; 31 31 import org.openstreetmap.josm.data.preferences.JosmBaseDirectories; 32 import org.openstreetmap.josm.data.preferences.JosmUrls; 32 33 import org.openstreetmap.josm.data.projection.Projection; 33 34 import org.openstreetmap.josm.data.projection.Projections; … … 423 424 Config.setBaseDirectoriesProvider(JosmBaseDirectories.getInstance()); // for right-left-hand traffic cache file 424 425 Config.setPreferencesInstance(new MemoryPreferences()); 426 Config.setUrlsProvider(JosmUrls.getInstance()); 425 427 Config.getPref().putBoolean("mappaint.auto_reload_local_styles", false); // unnecessary to listen for external changes 426 428 String projCode = Optional.ofNullable(argProjection).orElse("epsg:3857"); -
trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
r13892 r14119 46 46 import org.openstreetmap.josm.gui.util.WindowGeometry; 47 47 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 48 import org.openstreetmap.josm. io.OsmApi;48 import org.openstreetmap.josm.spi.preferences.Config; 49 49 import org.openstreetmap.josm.tools.CheckParameterUtil; 50 50 import org.openstreetmap.josm.tools.ImageProvider; … … 152 152 lbl.setLabelFor(cbAuthorisationProcedure); 153 153 154 if (! OsmApi.DEFAULT_API_URL.equals(apiUrl)) {154 if (!Config.getUrls().getDefaultOsmApiUrl().equals(apiUrl)) { 155 155 gc.gridy = 3; 156 156 gc.gridwidth = 2; -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r13797 r14119 72 72 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 73 73 import org.openstreetmap.josm.gui.widgets.JosmEditorPane; 74 import org.openstreetmap.josm.spi.preferences.Config; 74 75 import org.openstreetmap.josm.tools.GBC; 75 76 import org.openstreetmap.josm.tools.ImageProvider; … … 378 379 379 380 HtmlPanel help = new HtmlPanel(tr("New default entries can be added in the <a href=\"{0}\">Wiki</a>.", 380 Main.getJOSMWebsite()+"/wiki/Maps"));381 Config.getUrls().getJOSMWebsite()+"/wiki/Maps")); 381 382 help.enableClickableHyperlinks(); 382 383 add(help, GBC.eol().insets(10, 0, 0, 0).fill(GBC.HORIZONTAL)); -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r12846 r14119 14 14 import javax.swing.JPanel; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 18 17 import org.openstreetmap.josm.data.preferences.sources.MapPaintPrefHelper; … … 86 85 87 86 MapPaintSourceEditor() { 88 super(SourceType.MAP_PAINT_STYLE, Main.getJOSMWebsite()+"/styles", styleSourceProviders, true);87 super(SourceType.MAP_PAINT_STYLE, Config.getUrls().getJOSMWebsite()+"/styles", styleSourceProviders, true); 89 88 } 90 89 -
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r13761 r14119 187 187 188 188 TaggingPresetSourceEditor() { 189 super(SourceType.TAGGING_PRESET, Main.getJOSMWebsite()+"/presets", presetSourceProviders, true);189 super(SourceType.TAGGING_PRESET, Config.getUrls().getJOSMWebsite()+"/presets", presetSourceProviders, true); 190 190 } 191 191 -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r13613 r14119 72 72 73 73 protected JComponent buildDefaultServerUrlPanel() { 74 cbUseDefaultServerUrl = new JCheckBox(tr("<html>Use the default OSM server URL (<strong>{0}</strong>)</html>", OsmApi.DEFAULT_API_URL)); 74 cbUseDefaultServerUrl = new JCheckBox( 75 tr("<html>Use the default OSM server URL (<strong>{0}</strong>)</html>", Config.getUrls().getDefaultOsmApiUrl())); 75 76 cbUseDefaultServerUrl.addItemListener(new UseDefaultServerUrlChangeHandler()); 76 77 cbUseDefaultServerUrl.setFont(cbUseDefaultServerUrl.getFont().deriveFont(Font.PLAIN)); … … 128 129 String url = OsmApi.getOsmApi().getServerUrl(); 129 130 tfOsmServerUrl.setPossibleItems(SERVER_URL_HISTORY.get()); 130 if ( OsmApi.DEFAULT_API_URL.equals(url.trim())) {131 if (Config.getUrls().getDefaultOsmApiUrl().equals(url.trim())) { 131 132 cbUseDefaultServerUrl.setSelected(true); 132 propagator.propagate( OsmApi.DEFAULT_API_URL);133 propagator.propagate(Config.getUrls().getDefaultOsmApiUrl()); 133 134 } else { 134 135 cbUseDefaultServerUrl.setSelected(false); … … 144 145 String oldUrl = OsmApi.getOsmApi().getServerUrl(); 145 146 String hmiUrl = getStrippedApiUrl(); 146 if (cbUseDefaultServerUrl.isSelected() || OsmApi.DEFAULT_API_URL.equals(hmiUrl)) {147 if (cbUseDefaultServerUrl.isSelected() || Config.getUrls().getDefaultOsmApiUrl().equals(hmiUrl)) { 147 148 Config.getPref().put("osm-server.url", null); 148 149 } else { … … 278 279 case ItemEvent.SELECTED: 279 280 setApiUrlInputEnabled(false); 280 propagator.propagate( OsmApi.DEFAULT_API_URL);281 propagator.propagate(Config.getUrls().getDefaultOsmApiUrl()); 281 282 break; 282 283 case ItemEvent.DESELECTED: -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java
r12846 r14119 10 10 import java.util.List; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 14 13 import org.openstreetmap.josm.data.preferences.sources.SourceEntry; … … 25 24 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 26 25 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference; 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 28 28 /** … … 58 58 59 59 TagCheckerRulesSourceEditor() { 60 super(SourceType.TAGCHECKER_RULE, Main.getJOSMWebsite()+"/rules", ruleSourceProviders, false);60 super(SourceType.TAGCHECKER_RULE, Config.getUrls().getJOSMWebsite()+"/rules", ruleSourceProviders, false); 61 61 } 62 62 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r13998 r14119 43 43 import org.openstreetmap.josm.io.CachedFile; 44 44 import org.openstreetmap.josm.io.UTFInputStreamReader; 45 import org.openstreetmap.josm.spi.preferences.Config; 45 46 import org.openstreetmap.josm.tools.I18n; 46 47 import org.openstreetmap.josm.tools.Logging; … … 178 179 179 180 if (validate) { 180 parser.startWithValidation(in, Main.getXMLBase()+"/tagging-preset-1.0", "resource://data/tagging-preset.xsd");181 parser.startWithValidation(in, Config.getUrls().getXMLBase()+"/tagging-preset-1.0", "resource://data/tagging-preset.xsd"); 181 182 } else { 182 183 parser.start(in); -
trunk/src/org/openstreetmap/josm/io/AbstractReader.java
r14099 r14119 62 62 * @param pp postprocessor 63 63 * @see #deregisterPostprocessor 64 * @since xxx(moved from OsmReader)64 * @since 14119 (moved from OsmReader) 65 65 */ 66 66 public static void registerPostprocessor(OsmServerReadPostprocessor pp) { … … 75 75 * @param pp postprocessor 76 76 * @see #registerPostprocessor 77 * @since xxx(moved from OsmReader)77 * @since 14119 (moved from OsmReader) 78 78 */ 79 79 public static void deregisterPostprocessor(OsmServerReadPostprocessor pp) { -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r13881 r14119 541 541 542 542 private static void checkOfflineAccess(String urlString) { 543 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(urlString, Main.getJOSMWebsite());543 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(urlString, Config.getUrls().getJOSMWebsite()); 544 544 OnlineResource.OSM_API.checkOfflineAccess(urlString, OsmApi.getOsmApi().getServerUrl()); 545 545 } -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r13647 r14119 37 37 import org.openstreetmap.josm.io.auth.CredentialsManager; 38 38 import org.openstreetmap.josm.spi.preferences.Config; 39 import org.openstreetmap.josm.spi.preferences.IUrls; 39 40 import org.openstreetmap.josm.tools.CheckParameterUtil; 40 41 import org.openstreetmap.josm.tools.HttpClient; … … 73 74 /** 74 75 * Default URL of the standard OSM API. 76 * @deprecated Use {@link IUrls#getDefaultOsmApiUrl} 75 77 * @since 5422 76 78 */ 79 @Deprecated 77 80 public static final String DEFAULT_API_URL = "https://api.openstreetmap.org/api"; 78 81 … … 136 139 137 140 private static String getServerUrlFromPref() { 138 return Config.getPref().get("osm-server.url", DEFAULT_API_URL);141 return Config.getPref().get("osm-server.url", Config.getUrls().getDefaultOsmApiUrl()); 139 142 } 140 143 -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r14005 r14119 14 14 import javax.xml.parsers.ParserConfigurationException; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.gpx.GpxData; 18 17 import org.openstreetmap.josm.data.notes.Note; … … 21 20 import org.openstreetmap.josm.io.auth.CredentialsAgentException; 22 21 import org.openstreetmap.josm.io.auth.CredentialsManager; 22 import org.openstreetmap.josm.spi.preferences.Config; 23 23 import org.openstreetmap.josm.tools.HttpClient; 24 24 import org.openstreetmap.josm.tools.Logging; … … 155 155 boolean uncompressAccordingToContentDisposition, String httpMethod, byte[] requestBody) throws OsmTransferException { 156 156 try { 157 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(urlStr, Main.getJOSMWebsite());157 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(urlStr, Config.getUrls().getJOSMWebsite()); 158 158 OnlineResource.OSM_API.checkOfflineAccess(urlStr, OsmApi.getOsmApi().getServerUrl()); 159 159 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r13929 r14119 10 10 import java.util.Set; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 14 13 import org.openstreetmap.josm.actions.downloadtasks.DownloadTask; … … 75 74 public String[] getUsageExamples() { 76 75 return new String[] {"/import?url=" + Utils.encodeUrl( 77 Main.getJOSMWebsite()+"/browser/josm/trunk/data_nodist/direction-arrows.osm?format=txt")};76 Config.getUrls().getJOSMWebsite()+"/browser/josm/trunk/data_nodist/direction-arrows.osm?format=txt")}; 78 77 } 79 78 -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r14104 r14119 536 536 for (String updateSite : Main.pref.getPluginSites()) { 537 537 try { 538 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(updateSite, Main.getJOSMWebsite());538 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(updateSite, Config.getUrls().getJOSMWebsite()); 539 539 } catch (OfflineAccessException e) { 540 540 Logging.trace(e); -
trunk/src/org/openstreetmap/josm/spi/preferences/Config.java
r12855 r14119 12 12 private static IPreferences preferences; 13 13 private static IBaseDirectories baseDirectories; 14 private static IUrls urls; 14 15 15 16 private Config() { … … 36 37 37 38 /** 39 * Get class that provides the value of certain URLs 40 * @return the global {@link IUrls} instance 41 * @since 14119 42 */ 43 public static IUrls getUrls() { 44 return urls; 45 } 46 47 /** 38 48 * Install the global preference instance. 39 49 * @param preferences the global preference instance to set (must not be null) … … 53 63 Config.baseDirectories = Objects.requireNonNull(baseDirectories, "baseDirectories"); 54 64 } 65 66 /** 67 * Install the global URLs provider. 68 * @param urls the global URLs provider instance to set (must not be null) 69 * @since xx 70 */ 71 public static void setUrlsProvider(IUrls urls) { 72 Config.urls = Objects.requireNonNull(urls, "urls"); 73 } 55 74 } -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r12869 r14119 10 10 import java.util.function.Supplier; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.Bounds; 14 13 import org.openstreetmap.josm.data.coor.EastNorth; … … 17 16 import org.openstreetmap.josm.data.projection.Projection; 18 17 import org.openstreetmap.josm.data.projection.Projections; 18 import org.openstreetmap.josm.spi.preferences.Config; 19 19 20 20 /** … … 290 290 double lon = Math.round(dlon * decimals); 291 291 lon /= decimals; 292 return Main.getOSMWebsite() + "/#map="+zoom+'/'+lat+'/'+lon;292 return Config.getUrls().getOSMWebsite() + "/#map="+zoom+'/'+lat+'/'+lon; 293 293 } 294 294 } -
trunk/src/org/openstreetmap/josm/tools/WikiReader.java
r12846 r14119 6 6 import java.net.URL; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.spi.preferences.Config; 10 9 import org.openstreetmap.josm.tools.LanguageInfo.LocaleType; … … 31 30 */ 32 31 public WikiReader() { 33 this(Config.getPref().get("help.baseurl", Main.getJOSMWebsite()));32 this(Config.getPref().get("help.baseurl", Config.getUrls().getJOSMWebsite())); 34 33 } 35 34 -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportSender.java
r13901 r14119 16 16 import javax.xml.xpath.XPathFactory; 17 17 18 import org.openstreetmap.josm. Main;18 import org.openstreetmap.josm.spi.preferences.Config; 19 19 import org.openstreetmap.josm.tools.HttpClient; 20 20 import org.openstreetmap.josm.tools.HttpClient.Response; … … 136 136 137 137 private static String getJOSMTicketURL() { 138 return Main.getJOSMWebsite() + "/josmticket";138 return Config.getUrls().getJOSMWebsite() + "/josmticket"; 139 139 } 140 140
Note:
See TracChangeset
for help on using the changeset viewer.