Changeset 10035 in josm for trunk/src/org/openstreetmap/josm/gui/preferences
- Timestamp:
- 2016-03-23T22:36:15+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/preferences
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r9576 r10035 22 22 import javax.swing.JComponent; 23 23 import javax.swing.JDialog; 24 import javax.swing.JOptionPane;25 24 import javax.swing.JPanel; 26 25 import javax.swing.KeyStroke; … … 79 78 80 79 public PreferenceDialog(Component parent) { 81 super( JOptionPane.getFrameForComponent(parent), tr("Preferences"), ModalityType.DOCUMENT_MODAL);80 super(GuiHelper.getFrameForComponent(parent), tr("Preferences"), ModalityType.DOCUMENT_MODAL); 82 81 build(); 83 82 this.setMinimumSize(new Dimension(600, 350)); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r10024 r10035 904 904 .createFileChooser(true, null, Arrays.asList(ff, FileFilterAllFiles.getInstance()), ff, JFileChooser.FILES_ONLY); 905 905 prepareFileChooser(tfURL.getText(), fcm.getFileChooser()); 906 AbstractFileChooser fc = fcm.openFileChooser( JOptionPane.getFrameForComponent(SourceEditor.this));906 AbstractFileChooser fc = fcm.openFileChooser(GuiHelper.getFrameForComponent(SourceEditor.this)); 907 907 if (fc != null) { 908 908 tfURL.setText(fc.getSelectedFile().toString()); … … 1634 1634 } 1635 1635 prepareFileChooser(tfFileName.getText(), fcm.getFileChooser()); 1636 AbstractFileChooser fc = fcm.openFileChooser( JOptionPane.getFrameForComponent(SourceEditor.this));1636 AbstractFileChooser fc = fcm.openFileChooser(GuiHelper.getFrameForComponent(SourceEditor.this)); 1637 1637 if (fc != null) { 1638 1638 tfFileName.setText(fc.getSelectedFile().toString()); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java
r9759 r10035 105 105 final PrefEntry e = (PrefEntry) model.getValueAt(getSelectedRow(), 1); 106 106 Setting<?> stg = e.getValue(); 107 boolean ok = false; 107 108 if (stg instanceof StringSetting) { 108 109 editCellAt(getSelectedRow(), 1); … … 112 113 } 113 114 } else if (stg instanceof ListSetting) { 114 ListSetting lSetting = (ListSetting) stg; 115 ListEditor lEditor = new ListEditor(gui, e, lSetting); 116 lEditor.showDialog(); 117 if (lEditor.getValue() == 1) { 118 List<String> data = lEditor.getData(); 119 if (!lSetting.equalVal(data)) { 120 e.setValue(new ListSetting(data)); 121 return true; 122 } 123 } 115 ok = doEditList(gui, e, (ListSetting) stg); 124 116 } else if (stg instanceof ListListSetting) { 125 ListListSetting llSetting = (ListListSetting) stg; 126 ListListEditor llEditor = new ListListEditor(gui, e, llSetting); 127 llEditor.showDialog(); 128 if (llEditor.getValue() == 1) { 129 List<List<String>> data = llEditor.getData(); 130 if (!llSetting.equalVal(data)) { 131 e.setValue(new ListListSetting(data)); 132 return true; 133 } 134 } 117 ok = doEditListList(gui, e, (ListListSetting) stg); 135 118 } else if (stg instanceof MapListSetting) { 136 MapListSetting mlSetting = (MapListSetting) stg; 137 MapListEditor mlEditor = new MapListEditor(gui, e, mlSetting); 138 mlEditor.showDialog(); 139 if (mlEditor.getValue() == 1) { 140 List<Map<String, String>> data = mlEditor.getData(); 141 if (!mlSetting.equalVal(data)) { 142 e.setValue(new MapListSetting(data)); 143 return true; 144 } 119 ok = doEditMapList(gui, e, (MapListSetting) stg); 120 } 121 return ok; 122 } 123 124 static boolean doEditList(final JComponent gui, final PrefEntry e, ListSetting lSetting) { 125 ListEditor lEditor = new ListEditor(gui, e, lSetting); 126 lEditor.showDialog(); 127 if (lEditor.getValue() == 1) { 128 List<String> data = lEditor.getData(); 129 if (!lSetting.equalVal(data)) { 130 e.setValue(new ListSetting(data)); 131 return true; 132 } 133 } 134 return false; 135 } 136 137 static boolean doEditListList(final JComponent gui, final PrefEntry e, ListListSetting llSetting) { 138 ListListEditor llEditor = new ListListEditor(gui, e, llSetting); 139 llEditor.showDialog(); 140 if (llEditor.getValue() == 1) { 141 List<List<String>> data = llEditor.getData(); 142 if (!llSetting.equalVal(data)) { 143 e.setValue(new ListListSetting(data)); 144 return true; 145 } 146 } 147 return false; 148 } 149 150 static boolean doEditMapList(final JComponent gui, final PrefEntry e, MapListSetting mlSetting) { 151 MapListEditor mlEditor = new MapListEditor(gui, e, mlSetting); 152 mlEditor.showDialog(); 153 if (mlEditor.getValue() == 1) { 154 List<Map<String, String>> data = mlEditor.getData(); 155 if (!mlSetting.equalVal(data)) { 156 e.setValue(new MapListSetting(data)); 157 return true; 145 158 } 146 159 } … … 190 203 StringSetting sSetting = new StringSetting(null); 191 204 pe = new PrefEntry(tkey.getText(), sSetting, sSetting, false); 192 StringEditor sEditor = new StringEditor(gui, pe, sSetting); 193 sEditor.showDialog(); 194 if (sEditor.getValue() == 1) { 195 String data = sEditor.getData(); 196 if (!Objects.equals(sSetting.getValue(), data)) { 197 pe.setValue(new StringSetting(data)); 198 ok = true; 199 } 200 } 205 ok = doAddSimple(gui, pe, sSetting); 201 206 } else if (rbList.isSelected()) { 202 207 ListSetting lSetting = new ListSetting(null); 203 208 pe = new PrefEntry(tkey.getText(), lSetting, lSetting, false); 204 ListEditor lEditor = new ListEditor(gui, pe, lSetting); 205 lEditor.showDialog(); 206 if (lEditor.getValue() == 1) { 207 List<String> data = lEditor.getData(); 208 if (!lSetting.equalVal(data)) { 209 pe.setValue(new ListSetting(data)); 210 ok = true; 211 } 212 } 209 ok = doAddList(gui, pe, lSetting); 213 210 } else if (rbListList.isSelected()) { 214 211 ListListSetting llSetting = new ListListSetting(null); 215 212 pe = new PrefEntry(tkey.getText(), llSetting, llSetting, false); 216 ListListEditor llEditor = new ListListEditor(gui, pe, llSetting); 217 llEditor.showDialog(); 218 if (llEditor.getValue() == 1) { 219 List<List<String>> data = llEditor.getData(); 220 if (!llSetting.equalVal(data)) { 221 pe.setValue(new ListListSetting(data)); 222 ok = true; 223 } 224 } 213 ok = doAddListList(gui, pe, llSetting); 225 214 } else if (rbMapList.isSelected()) { 226 215 MapListSetting mlSetting = new MapListSetting(null); 227 216 pe = new PrefEntry(tkey.getText(), mlSetting, mlSetting, false); 228 MapListEditor mlEditor = new MapListEditor(gui, pe, mlSetting); 229 mlEditor.showDialog(); 230 if (mlEditor.getValue() == 1) { 231 List<Map<String, String>> data = mlEditor.getData(); 232 if (!mlSetting.equalVal(data)) { 233 pe.setValue(new MapListSetting(data)); 234 ok = true; 235 } 236 } 237 } 238 } 239 if (ok) 240 return pe; 241 else 242 return null; 217 ok = doAddMapList(gui, pe, mlSetting); 218 } 219 } 220 return ok ? pe : null; 221 } 222 223 static boolean doAddSimple(final JComponent gui, PrefEntry pe, StringSetting sSetting) { 224 StringEditor sEditor = new StringEditor(gui, pe, sSetting); 225 sEditor.showDialog(); 226 if (sEditor.getValue() == 1) { 227 String data = sEditor.getData(); 228 if (!Objects.equals(sSetting.getValue(), data)) { 229 pe.setValue(new StringSetting(data)); 230 return true; 231 } 232 } 233 return false; 234 } 235 236 static boolean doAddList(final JComponent gui, PrefEntry pe, ListSetting lSetting) { 237 ListEditor lEditor = new ListEditor(gui, pe, lSetting); 238 lEditor.showDialog(); 239 if (lEditor.getValue() == 1) { 240 List<String> data = lEditor.getData(); 241 if (!lSetting.equalVal(data)) { 242 pe.setValue(new ListSetting(data)); 243 return true; 244 } 245 } 246 return false; 247 } 248 249 static boolean doAddListList(final JComponent gui, PrefEntry pe, ListListSetting llSetting) { 250 ListListEditor llEditor = new ListListEditor(gui, pe, llSetting); 251 llEditor.showDialog(); 252 if (llEditor.getValue() == 1) { 253 List<List<String>> data = llEditor.getData(); 254 if (!llSetting.equalVal(data)) { 255 pe.setValue(new ListListSetting(data)); 256 return true; 257 } 258 } 259 return false; 260 } 261 262 static boolean doAddMapList(final JComponent gui, PrefEntry pe, MapListSetting mlSetting) { 263 MapListEditor mlEditor = new MapListEditor(gui, pe, mlSetting); 264 mlEditor.showDialog(); 265 if (mlEditor.getValue() == 1) { 266 List<Map<String, String>> data = mlEditor.getData(); 267 if (!mlSetting.equalVal(data)) { 268 pe.setValue(new MapListSetting(data)); 269 return true; 270 } 271 } 272 return false; 243 273 } 244 274 -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r9621 r10035 543 543 public void actionPerformed(ActionEvent e) { 544 544 String s = JOptionPane.showInputDialog( 545 JOptionPane.getFrameForComponent(PluginConfigurationSitesPanel.this),545 GuiHelper.getFrameForComponent(PluginConfigurationSitesPanel.this), 546 546 tr("Add JOSM Plugin description URL."), 547 547 tr("Enter URL"), … … 558 558 if (list.getSelectedValue() == null) { 559 559 JOptionPane.showMessageDialog( 560 JOptionPane.getFrameForComponent(PluginConfigurationSitesPanel.this),560 GuiHelper.getFrameForComponent(PluginConfigurationSitesPanel.this), 561 561 tr("Please select an entry."), 562 562 tr("Warning"), … … 584 584 if (list.getSelectedValue() == null) { 585 585 JOptionPane.showMessageDialog( 586 JOptionPane.getFrameForComponent(PluginConfigurationSitesPanel.this),586 GuiHelper.getFrameForComponent(PluginConfigurationSitesPanel.this), 587 587 tr("Please select an entry."), 588 588 tr("Warning"),
Note:
See TracChangeset
for help on using the changeset viewer.