Changeset 1520 in josm for trunk/src/org/openstreetmap/josm
- Timestamp:
- 2009-03-31T16:30:42+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/HelpAction.java
r1512 r1520 49 49 private JFrame helpBrowser = new JFrame(tr("JOSM Online Help")); 50 50 private String baseurl = Main.pref.get("help.baseurl", "http://josm.openstreetmap.de"); 51 private String pathbase = Main.pref.get("help.pathbase", "/wiki/"); 52 private String pathhelp = Main.pref.get("help.pathhelp", "Help/"); 53 private String pathmenu = Main.pref.get("help.pathmenu", "Menu/"); 51 54 private JEditorPane help = new JEditorPane(); 52 55 private WikiReader reader = new WikiReader(baseurl); … … 119 122 if (topic == null) { 120 123 helpBrowser.setVisible(false); 121 setHelpUrl(baseurl+ "/wiki/Help");124 setHelpUrl(baseurl+pathbase+"Help"); 122 125 } else 123 126 help(topic); 124 127 } else { 125 128 helpBrowser.setVisible(false); 126 setHelpUrl(baseurl+ "/wiki/Help");129 setHelpUrl(baseurl+pathbase+"Help"); 127 130 } 128 131 } … … 138 141 if (b.getClientProperty("help") != null) 139 142 return (String)b.getClientProperty("help"); 140 return "Menu/"+b.getText();143 return pathmenu+b.getText(); 141 144 } 142 145 if (c instanceof AbstractButton) { … … 159 162 public void help(String topic) { 160 163 helpBrowser.setVisible(false); 161 setHelpUrl(baseurl+ "/wiki/Help/"+topic);164 setHelpUrl(baseurl+pathbase+pathhelp+topic); 162 165 } 163 166 … … 167 170 */ 168 171 public void setHelpUrl(String url) { 169 int i = url.indexOf("/wiki/Help")+6;170 172 String langurl = url; 171 if( i > 0)173 if(url.startsWith(baseurl+pathbase)) 172 174 { 175 int i = pathbase.length()+baseurl.length(); 173 176 String title = url.substring(i); 174 177 if(languageCode.length() != 0 && !title.startsWith(languageCode)) … … 193 196 boolean loaded = false; 194 197 try { 195 help.read(new StringReader(reader.read(this.url)), 196 help.getEditorKit().createDefaultDocument()); 197 if(help.getText().length() == 0) 198 String txt = reader.read(this.url); 199 if(txt.length() == 0) 198 200 { 199 201 if(lang) … … 203 205 if(url.equals(langurl)) 204 206 { 205 help.setText("<HTML>"+tr("Helppage missing. Create it in <A HREF=\"{0}\">english</A>.",207 txt = ("<HTML>"+tr("Helppage missing. Create it in <A HREF=\"{0}\">english</A>.", 206 208 url+"?action=edit")+"</HTML>"); 207 209 } 208 210 else 209 211 { 210 help.setText("<HTML>"+tr("Helppage missing. Create it in <A HREF=\"{0}\">english</A> or <A HREF=\"{1}\">your language</A>.",212 txt = ("<HTML>"+tr("Helppage missing. Create it in <A HREF=\"{0}\">english</A> or <A HREF=\"{1}\">your language</A>.", 211 213 url+"?action=edit", langurl+"?action=edit")+"</HTML>"); 212 214 } 213 215 } 214 216 } 217 help.setText(txt); 218 help.setCaretPosition(0); 215 219 loaded = true; 216 220 } catch (IOException ex) {
Note:
See TracChangeset
for help on using the changeset viewer.