Changeset 4635 in josm
- Timestamp:
- 2011-12-04T20:00:58+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r4380 r4635 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.io.BufferedReader; 11 import java.io.File; 12 import java.io.FileReader; 10 import java.util.HashSet; 11 import java.util.Map; 12 import java.util.Map.Entry; 13 import java.util.Set; 13 14 14 15 import javax.swing.JScrollPane; … … 16 17 17 18 import org.openstreetmap.josm.Main; 19 import org.openstreetmap.josm.data.Preferences.Setting; 18 20 import org.openstreetmap.josm.data.Version; 19 21 import org.openstreetmap.josm.data.osm.DataSet; … … 23 25 import org.openstreetmap.josm.tools.Shortcut; 24 26 import org.openstreetmap.josm.tools.Utils; 27 25 28 26 29 /** … … 83 86 text.append(getReportHeader()); 84 87 try { 85 BufferedReader input = new BufferedReader(new FileReader(Main.pref 86 .getPreferencesDirFile() 87 + File.separator + "preferences")); 88 try { 89 String line = null; 90 91 while ((line = input.readLine()) != null) { 92 String toCheck = line.trim().toLowerCase(); 93 if (toCheck.startsWith("osm-server.username") 94 || toCheck.startsWith("osm-server.password") 95 || toCheck.startsWith("marker.show") 96 || toCheck.startsWith("oauth.access-token.key") 97 || toCheck.startsWith("oauth.access-token.secret")) { 98 continue; 99 } 100 text.append(line); 101 text.append("\n"); 88 Map<String, Setting> settings = Main.pref.getAllSettings(); 89 settings.remove("osm-server.username"); 90 settings.remove("osm-server.password"); 91 settings.remove("oauth.access-token.key"); 92 settings.remove("oauth.access-token.secret"); 93 Set<String> keys = new HashSet<String>(settings.keySet()); 94 for (String key : keys) { 95 if (key.startsWith("marker.show")) { 96 settings.remove(key); 102 97 } 103 } finally { 104 input.close(); 98 } 99 for (Entry<String, Setting> entry : settings.entrySet()) { 100 text.append(entry.getKey()).append("=").append(entry.getValue().getValue().toString()).append("\n"); 105 101 } 106 102 } catch (Exception x) { -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r4634 r4635 61 61 * saved upon set-access. 62 62 * 63 * Each property is a simple key=value pair of Strings. 63 * Each property is a key=setting pair, where key is a String and setting can be one of 64 * 4 types: 65 * string, list, list of lists and list of maps. 64 66 * In addition, each key has a unique default value that is set when the value is first 65 67 * accessed using one of the get...() methods. You can use the same preference … … 69 71 * off all possible settings. 70 72 * 71 * At the moment, there is no such thing as an empty value.72 * If you put "" or null as value, the property is removed.73 * At the moment, you cannot put the empty string for string properties. 74 * put(key, "") means, the property is removed. 73 75 * 74 76 * @author imi … … 83 85 84 86 /** 85 * Map the property name to the property object. Does not contain null or "" values.87 * Map the property name to strings. Does not contain null or "" values. 86 88 */ 87 89 protected final SortedMap<String, String> properties = new TreeMap<String, String>(); 90 /** Map of defaults, can contain null values */ 88 91 protected final SortedMap<String, String> defaults = new TreeMap<String, String>(); 89 92 protected final SortedMap<String, String> colornames = new TreeMap<String, String>(); 90 93 94 /** Mapping for list settings. Must not conatin null values */ 91 95 protected final SortedMap<String, List<String>> collectionProperties = new TreeMap<String, List<String>>(); 96 /** Defaults, can contain null values */ 92 97 protected final SortedMap<String, List<String>> collectionDefaults = new TreeMap<String, List<String>>(); 93 98
Note:
See TracChangeset
for help on using the changeset viewer.