Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java
r13613 r13617 12 12 import java.net.MalformedURLException; 13 13 import java.net.URL; 14 import java.util.Arrays; 15 import java.util.List; 16 import java.util.stream.Collectors; 14 17 15 18 import javax.swing.BorderFactory; … … 75 78 } 76 79 80 protected static List<String> getExamples() { 81 return Arrays.asList( 82 Main.getOSMWebsite()+"/history?open=true", 83 OsmApi.getOsmApi().getBaseUrl()+"/changesets?open=true"); 84 } 85 77 86 protected JPanel buildHelpPanel() { 78 87 String apiUrl = OsmApi.getOsmApi().getBaseUrl(); … … 83 92 + "<p><strong>" + tr("Examples") + "</strong></p>" 84 93 + "<ul>" 85 + "<li><a href=\""+Main.getOSMWebsite()+"/history?open=true\">"+Main.getOSMWebsite()+"/history?open=true</a></li>"86 + "<li><a href=\""+apiUrl+"/changesets?open=true\">"+apiUrl+"/changesets?open=true</a></li>"94 + String.join("", getExamples().stream().map( 95 s -> "<li><a href=\""+s+"\">"+s+"</a></li>").collect(Collectors.toList())) 87 96 + "</ul>" 88 97 + tr("Note that changeset queries are currently always submitted to ''{0}'', regardless of the " … … 121 130 } 122 131 123 protected boolean isValidChangesetQueryUrl(String text) {132 protected static boolean isValidChangesetQueryUrl(String text) { 124 133 return buildChangesetQuery(text) != null; 125 134 } 126 135 127 protected ChangesetQuery buildChangesetQuery(String text) {136 protected static ChangesetQuery buildChangesetQuery(String text) { 128 137 URL url = null; 129 138 try { … … 133 142 } 134 143 String path = url.getPath(); 135 if (path == null || !path.endsWith("/changesets"))144 if (path == null || (!path.endsWith("/changesets") && !path.endsWith("/history"))) 136 145 return null; 137 146 -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanelTest.java
r10962 r13617 3 3 4 4 import static org.junit.Assert.assertNotNull; 5 import static org.junit.Assert.assertTrue; 5 6 6 7 import org.junit.Rule; … … 29 30 assertNotNull(new UrlBasedQueryPanel()); 30 31 } 32 33 /** 34 * Checks that examples displayed in panel are correct. 35 */ 36 @Test 37 public void testExamplesAreCorrect() { 38 for (String example : UrlBasedQueryPanel.getExamples()) { 39 assertTrue(example, UrlBasedQueryPanel.isValidChangesetQueryUrl(example)); 40 } 41 } 31 42 }
Note:
See TracChangeset
for help on using the changeset viewer.