Changeset 171 in josm
- Timestamp:
- 2006-11-29T12:32:42+01:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/Preferences.java
r149 r171 102 102 protected void save() { 103 103 try { 104 final PrintWriter out = new PrintWriter(new FileWriter( 105 getPreferencesDir() + "preferences")); 104 final PrintWriter out = new PrintWriter(new FileWriter(getPreferencesDir() + "preferences"), false); 106 105 for (final Entry<String, String> e : properties.entrySet()) 107 106 if (!e.getValue().equals("")) -
src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java
r168 r171 49 49 for (String s : new TreeSet<String>(orig.keySet())) 50 50 model.addRow(new String[]{s, Main.pref.get(s)}); 51 51 52 52 JButton add = new JButton(tr("Add")); 53 53 p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); … … 65 65 if (answer == JOptionPane.OK_OPTION) 66 66 model.addRow(new String[]{key.getText(), value.getText()}); 67 67 } 68 68 }); 69 69 70 70 JButton edit = new JButton(tr("Edit")); 71 71 p.add(edit, GBC.std().insets(5,5,5,0)); … … 73 73 public void actionPerformed(ActionEvent e) { 74 74 edit(gui, list); 75 75 } 76 76 }); 77 77 78 78 JButton delete = new JButton(tr("Delete")); 79 79 p.add(delete, GBC.std().insets(0,5,0,0)); … … 86 86 while (list.getSelectedRow() != -1) 87 87 model.removeRow(list.getSelectedRow()); 88 88 } 89 89 }); 90 90 91 91 list.addMouseListener(new MouseAdapter(){ 92 92 @Override public void mouseClicked(MouseEvent e) { 93 93 if (e.getClickCount() == 2) 94 94 edit(gui, list); 95 95 } 96 96 }); 97 97 } … … 107 107 } 108 108 for (Entry<String, String> e : orig.entrySet()) 109 Main.pref.put(e.getKey(), e.getValue());109 Main.pref.put(e.getKey(), null); 110 110 } 111 111 112 112 113 113 private void edit(final PreferenceDialog gui, final JTable list) { 114 115 116 117 118 119 120 121 114 if (list.getSelectedRowCount() != 1) { 115 JOptionPane.showMessageDialog(gui, tr("Please select the row to edit.")); 116 return; 117 } 118 String v = JOptionPane.showInputDialog(tr("New value for {0}", model.getValueAt(list.getSelectedRow(), 0)), model.getValueAt(list.getSelectedRow(), 1)); 119 if (v != null) 120 model.setValueAt(v, list.getSelectedRow(), 1); 121 } 122 122 } -
src/org/openstreetmap/josm/tools/SearchCompiler.java
r160 r171 119 119 @Override public String toString() {return "modified";} 120 120 } 121 122 private static class Selected extends Match { 123 @Override public boolean match(OsmPrimitive osm) { 124 return osm.selected; 125 } 126 @Override public String toString() {return "selected";} 127 } 121 128 122 129 private static class Incomplete extends Match { … … 124 131 return osm instanceof Way && ((Way)osm).isIncomplete(); 125 132 } 126 @Override public String toString() {return " modified";}133 @Override public String toString() {return "incomplete";} 127 134 } 128 135 … … 204 211 else if (value.equals("incomplete")) 205 212 c = new Incomplete(); 213 else if (value.equals("selected")) 214 c = new Selected(); 206 215 else 207 216 c = new Any(value); … … 211 220 if (key.equals("type")) 212 221 c = new ExactType(value); 213 else if (key.equals("id")) { 222 else if (key.equals("property")) { 223 String realKey = "", realValue = value; 224 int eqPos = value.indexOf("="); 225 if (eqPos != -1) { 226 realKey = value.substring(0,eqPos); 227 realValue = value.substring(eqPos+1); 228 } 229 c = new KeyValue(realKey, realValue, notValue); 230 } else if (key.equals("id")) { 214 231 try { 215 232 c = new Id(Long.parseLong(value));
Note:
See TracChangeset
for help on using the changeset viewer.