Changeset 199 in josm
- Timestamp:
- 2007-02-14T13:58:04+01:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/ServerSidePreferences.java
r197 r199 15 15 import java.util.Collection; 16 16 import java.util.Collections; 17 import java.util.LinkedList; 18 import java.util.StringTokenizer; 17 19 import java.util.Map.Entry; 18 20 … … 119 121 if (!properties.containsKey("osm-server.password") && password != null) 120 122 properties.put("osm-server.password", password); 121 123 Reader in = new StringReader(connection.download()); 122 124 try { 123 124 125 126 127 128 125 XmlObjectParser.Uniform<Prop> parser = new XmlObjectParser.Uniform<Prop>(in, "tag", Prop.class); 126 for (Prop p : parser) 127 properties.put(p.key, p.value); 128 } catch (RuntimeException e) { 129 e.printStackTrace(); 130 } 129 131 } 130 132 … … 138 140 StringBuilder b = new StringBuilder("<preferences>\n"); 139 141 for (Entry<String, String> p : properties.entrySet()) { 142 if (p.getKey().equals("osm-server.password")) 143 continue; // do not upload password. It would get stored in plain! 140 144 b.append("<tag key='"); 141 145 b.append(XmlWriter.encode(p.getKey())); … … 149 153 150 154 @Override public Collection<Bookmark> loadBookmarks() { 151 return Collections.<Bookmark>emptyList(); 155 try { 156 Collection<Bookmark> bookmarks; 157 BufferedReader in = new BufferedReader(new InputStreamReader(new URL("http://"+connection.serverUrl.getHost()+"/josm/bookmarks").openStream())); 158 bookmarks = new LinkedList<Bookmark>(); 159 for (String line = in.readLine(); line != null; line = in.readLine()) { 160 StringTokenizer st = new StringTokenizer(line, ","); 161 if (st.countTokens() < 5) 162 continue; 163 Bookmark b = new Bookmark(); 164 b.name = st.nextToken(); 165 try { 166 for (int i = 0; i < b.latlon.length; ++i) 167 b.latlon[i] = Double.parseDouble(st.nextToken()); 168 bookmarks.add(b); 169 } catch (NumberFormatException x) { 170 // line not parsed 171 } 172 } 173 in.close(); 174 return bookmarks; 175 } catch (MalformedURLException e) { 176 e.printStackTrace(); 177 } catch (IOException e) { 178 e.printStackTrace(); 179 } 180 return Collections.emptyList(); 152 181 } 153 182 -
src/org/openstreetmap/josm/gui/MainApplet.java
r195 r199 53 53 }; 54 54 55 private Map<String, Collection<String>> args = new HashMap<String, Collection<String>>(); 55 private Map<String, Collection<String>> args = new HashMap<String, Collection<String>>(); 56 private UploadPreferencesAction uploadPreferences = new UploadPreferencesAction(); 56 57 57 58 @Override public String[][] getParameterInfo() { … … 99 100 // remove offending stuff from JOSM (that would break the SecurityManager) 100 101 m.remove(m.fileMenu); 101 m.editMenu.add( new UploadPreferencesAction());102 m.editMenu.add(uploadPreferences); 102 103 m.open.setEnabled(false); 103 104 m.exit.setEnabled(false); -
src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r198 r199 78 78 public void actionPerformed(ActionEvent e) { 79 79 final JFrame f = new JFrame(name); 80 f.setAlwaysOnTop(true); 80 try {f.setAlwaysOnTop(true);} catch (SecurityException e1) {} 81 81 parent.remove(ToggleDialog.this); 82 82 f.getContentPane().add(ToggleDialog.this); -
src/org/openstreetmap/josm/plugins/Plugin.java
r168 r199 42 42 public Plugin() { 43 43 URL[] urls = ((URLClassLoader)getClass().getClassLoader()).getURLs(); 44 String s = urls[urls.length-1].toString(); 45 int lastSlash = s.lastIndexOf('/'); 46 name = s.substring(lastSlash+1, s.length()-4); 44 name = urls[urls.length-1].toString(); 45 if (name.toLowerCase().endsWith(".jar")) { 46 int lastSlash = name.lastIndexOf('/'); 47 name = name.substring(lastSlash+1, name.length()-4); 48 } 47 49 } 48 50
Note:
See TracChangeset
for help on using the changeset viewer.