Changeset 962 in josm for trunk/src/org
- Timestamp:
- 2008-09-14T10:59:50+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/HelpAction.java
r693 r962 46 46 } 47 47 48 private String languageCode = tr("En:"); 48 49 private JFrame helpBrowser = new JFrame(tr("JOSM Online Help")); 49 50 private String baseurl = Main.pref.get("help.baseurl", "http://josm.openstreetmap.de"); … … 162 163 */ 163 164 public void setHelpUrl(String url) { 164 this.url = url; 165 try { 166 help.read(new StringReader(reader.read(url)), help.getEditorKit().createDefaultDocument()); 167 } catch (IOException e) { 168 help.setText(tr("Error while loading page {0}",url)); 169 } 165 int i = url.lastIndexOf("/")+1; 166 String title = url.substring(i); 167 if(!title.startsWith(languageCode)) 168 title = languageCode + title; 169 String langurl = url.substring(0, i) + title; 170 if(langurl.equals(this.url) || langurl.equals(url)) 171 { 172 this.url = url; 173 try { 174 help.read(new StringReader(reader.read(url)), help.getEditorKit().createDefaultDocument()); 175 } catch (IOException ex) { 176 help.setText(tr("Error while loading page {0}",url)); 177 } 178 } 179 else 180 { 181 try { 182 help.read(new StringReader(reader.read(langurl)), help.getEditorKit().createDefaultDocument()); 183 String message = help.getText(); 184 String le = "http://josm-extern." + langurl.substring(7); 185 if(message.indexOf("Describe "") >= 0 && message.indexOf(le) >= 0) 186 throw new IOException(); 187 this.url = langurl; 188 } catch (IOException e) { 189 this.url = url; 190 try { 191 help.read(new StringReader(reader.read(url)), help.getEditorKit().createDefaultDocument()); 192 } catch (IOException ex) { 193 help.setText(tr("Error while loading page {0}",url)); 194 } 195 } 196 } 170 197 helpBrowser.setVisible(true); 171 198 }
Note:
See TracChangeset
for help on using the changeset viewer.