Changeset 1180 in josm
- Timestamp:
- 2008-12-25T18:58:04+01:00 (16 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DiskAccessAction.java
r1169 r1180 19 19 public DiskAccessAction(String name, String iconName, String tooltip, Shortcut shortcut) { 20 20 super(name, iconName, tooltip, shortcut, true); 21 }22 23 @Deprecated24 public DiskAccessAction(String name, String iconName, String tooltip, int shortcut, int modifiers) {25 super(name, iconName, tooltip, shortcut, modifiers, true);26 21 } 27 22 -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r1169 r1180 25 25 abstract public class JosmAction extends AbstractAction implements Destroyable { 26 26 27 @Deprecated28 public KeyStroke shortcut;29 27 protected Shortcut sc; 30 28 … … 36 34 } 37 35 return sc; 38 }39 40 @Deprecated41 public JosmAction(String name, String iconName, String tooltip, int shortcut, int modifier, boolean register) {42 super(name, iconName == null ? null : ImageProvider.get(iconName));43 setHelpId();44 if (shortcut != 0) {45 int group = Shortcut.GROUP_LAYER; //GROUP_NONE;46 if (((modifier & InputEvent.CTRL_MASK) != 0) || ((modifier & InputEvent.CTRL_DOWN_MASK) != 0)) {47 group = Shortcut.GROUP_MENU;48 } else if (modifier == 0) {49 group = Shortcut.GROUP_EDIT;50 }51 sc = Shortcut.registerShortcut("auto:"+name, name, shortcut, group);52 this.shortcut = sc.getKeyStroke();53 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), name);54 Main.contentPane.getActionMap().put(name, this);55 }56 putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tooltip, sc));57 putValue("toolbar", iconName);58 if (register)59 Main.toolbar.register(this);60 36 } 61 37 … … 80 56 sc = shortcut; 81 57 if (sc != null) { 82 this.shortcut = sc.getKeyStroke();83 58 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(sc.getKeyStroke(), name); 84 59 Main.contentPane.getActionMap().put(name, this); … … 91 66 92 67 public void destroy() { 93 if (s hortcut!= null) {68 if (sc != null) { 94 69 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).remove(sc.getKeyStroke()); 95 70 Main.contentPane.getActionMap().remove(sc.getKeyStroke()); -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r1169 r1180 30 30 public SaveActionBase(String name, String iconName, String tooltip, Shortcut shortcut, Layer layer) { 31 31 super(name, iconName, tooltip, shortcut); 32 this.layer = layer;33 }34 35 @Deprecated36 public SaveActionBase(String name, String iconName, String tooltip, int shortcut, int modifiers, Layer layer) {37 super(name, iconName, tooltip, shortcut, modifiers);38 32 this.layer = layer; 39 33 } -
trunk/src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java
r1169 r1180 24 24 } 25 25 26 @Deprecated27 public AudioFastSlowAction(String name, String iconName, String tooltip, int shortcut, int modifier, boolean fast) {28 super(name, iconName, tooltip, shortcut, modifier, true);29 try {30 multiplier = Double.parseDouble(Main.pref.get("audio.fastfwdmultiplier","1.3"));31 } catch (NumberFormatException e) {32 multiplier = 1.3;33 }34 if (! fast)35 multiplier = 1.0 / multiplier;36 }37 38 26 public void actionPerformed(ActionEvent e) { 39 27 double speed = AudioPlayer.speed(); -
trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java
r1169 r1180 31 31 public MapMode(String name, String iconName, String tooltip, Shortcut shortcut, MapFrame mapFrame, Cursor cursor) { 32 32 super(name, "mapmode/"+iconName, tooltip, shortcut, false); 33 this.cursor = cursor;34 putValue("active", false);35 }36 37 /**38 * Constructor for mapmodes without an menu39 */40 @Deprecated41 public MapMode(String name, String iconName, String tooltip, int keystroke, MapFrame mapFrame, Cursor cursor) {42 super(name, "mapmode/"+iconName, tooltip, keystroke, 0, false);43 33 this.cursor = cursor; 44 34 putValue("active", false); -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r1169 r1180 208 208 } 209 209 210 synchronized public voidput(final String key, String value) {210 synchronized public boolean put(final String key, String value) { 211 211 String oldvalue = properties.get(key); 212 212 if(value != null && value.length() == 0) … … 221 221 save(); 222 222 firePreferenceChanged(key, value); 223 } 224 } 225 226 synchronized public void put(final String key, final boolean value) { 227 put(key, Boolean.toString(value)); 223 return true; 224 } 225 return false; 226 } 227 228 synchronized public boolean put(final String key, final boolean value) { 229 return put(key, Boolean.toString(value)); 230 } 231 232 synchronized public boolean putInteger(final String key, final Integer value) { 233 return put(key, Integer.toString(value)); 234 } 235 236 synchronized public boolean putDouble(final String key, final Double value) { 237 return put(key, Double.toString(value)); 228 238 } 229 239 … … 343 353 } 344 354 345 // only for compatibility. Don't use any more.346 @Deprecated347 public static Color getPreferencesColor(String colName, Color def)348 {349 return Main.pref.getColor(colName, def);350 }351 352 355 /** 353 356 * Convenience method for accessing colour preferences. … … 372 375 } 373 376 374 synchronized public voidputColor(String colName, Color val) {375 put("color."+colName, val != null ? ColorHelper.color2html(val) : null);377 synchronized public boolean putColor(String colName, Color val) { 378 return put("color."+colName, val != null ? ColorHelper.color2html(val) : null); 376 379 } 377 380 … … 431 434 return Arrays.asList(s.split(";")); 432 435 } 433 else if(def != null) 434 return def; 435 return null; 436 return def; 436 437 } 437 438 synchronized public void removeFromCollection(String key, String value) { … … 443 444 } 444 445 } 445 synchronized public voidputCollection(String key, Collection<String> val) {446 synchronized public boolean putCollection(String key, Collection<String> val) { 446 447 String s = null; 447 448 if(val != null) … … 456 457 } 457 458 458 put(key, s);459 return put(key, s); 459 460 } 460 461 -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r1169 r1180 103 103 relations.add((Relation) osm); 104 104 } 105 }106 107 /**108 * Remove the selection of the whole dataset.109 * @deprecated Use {@link #setSelected(Collection) setSelected} instead.110 */111 @Deprecated public void clearSelection() {112 clearSelection(nodes);113 clearSelection(ways);114 clearSelection(relations);115 Collection<OsmPrimitive> sel = Collections.emptyList();116 fireSelectionChanged(sel);117 105 } 118 106 -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r1169 r1180 117 117 return name; 118 118 } 119 120 @Deprecated121 public boolean isIncomplete() {122 return incomplete;123 }124 119 } -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r1169 r1180 144 144 * handled by the OS are not duplicated on the menu. 145 145 */ 146 public static void add(JMenu menu, JosmAction action) { 146 public static JMenuItem add(JMenu menu, JosmAction action) { 147 JMenuItem menuitem = null; 147 148 if (!action.getShortcut().getAutomatic()) { 148 JMenuItemmenuitem = menu.add(action);149 menuitem = menu.add(action); 149 150 KeyStroke ks = action.getShortcut().getKeyStroke(); 150 151 if (ks != null) { … … 152 153 } 153 154 } 155 return menuitem; 154 156 } 155 157 -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r1169 r1180 21 21 import org.openstreetmap.josm.actions.mapmode.SelectAction; 22 22 import org.openstreetmap.josm.actions.mapmode.ZoomAction; 23 import org.openstreetmap.josm.gui.ScrollViewport; 23 24 import org.openstreetmap.josm.gui.dialogs.CommandStackDialog; 24 25 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; … … 52 53 * instead of adding directly to this list. To add a new mode use addMapMode. 53 54 */ 54 p ublicJToolBar toolBarActions = new JToolBar(JToolBar.VERTICAL);55 p ublicJToolBar toolBarToggle = new JToolBar(JToolBar.VERTICAL);55 private JToolBar toolBarActions = new JToolBar(JToolBar.VERTICAL); 56 private JToolBar toolBarToggle = new JToolBar(JToolBar.VERTICAL); 56 57 /** 57 58 * The status line below the map … … 145 146 * @param dlg The toggle dialog. It must not be in the list already. 146 147 */ 147 public voidaddToggleDialog(ToggleDialog dlg) {148 public IconToggleButton addToggleDialog(ToggleDialog dlg) { 148 149 IconToggleButton button = new IconToggleButton(dlg.action); 149 150 dlg.action.button = button; … … 151 152 toolBarToggle.add(button); 152 153 toggleDialogs.add(dlg); 154 return button; 153 155 } 154 156 … … 197 199 jb.addSeparator(); 198 200 jb.add(toolBarToggle); 199 panel.add(jb, BorderLayout.WEST); 201 panel.add(new ScrollViewport(jb, ScrollViewport.VERTICAL_DIRECTION), 202 BorderLayout.WEST); 200 203 if (statusLine != null) 201 204 panel.add(statusLine, BorderLayout.SOUTH); -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r1179 r1180 57 57 58 58 /** 59 * Interface to notify listeners of the change of the active layer.60 * @author imi61 * @deprecated Use Layer.LayerChangeListener instead62 */63 @Deprecated public interface LayerChangeListener {64 void activeLayerChange(Layer oldLayer, Layer newLayer);65 void layerAdded(Layer newLayer);66 void layerRemoved(Layer oldLayer);67 }68 69 /**70 59 * A list of all layers currently loaded. 71 60 */ … … 92 81 93 82 private BufferedImage offscreenBuffer; 94 95 /**96 * The listener of the active layer changes.97 * @deprecated Use Layer.listener instead.98 */99 @Deprecated private Collection<LayerChangeListener> listeners = new LinkedList<LayerChangeListener>();100 83 101 84 public MapView() { … … 180 163 layers.add(pos, layer); 181 164 182 // TODO: Deprecated183 for (LayerChangeListener l : listeners)184 l.layerAdded(layer);185 165 for (Layer.LayerChangeListener l : Layer.listeners) 186 166 l.layerAdded(layer); … … 214 194 public void removeLayer(Layer layer) { 215 195 if (layers.remove(layer)) { 216 // TODO: Deprecated217 for (LayerChangeListener l : listeners)218 l.layerRemoved(layer);219 196 for (Layer.LayerChangeListener l : Layer.listeners) 220 197 l.layerRemoved(layer); … … 347 324 348 325 /** 349 * Add a listener for changes of active layer.350 * @param listener The listener that get added.351 * @deprecated Use Layer.listener.add instead.352 */353 @Deprecated public void addLayerChangeListener(LayerChangeListener listener) {354 if (listener != null)355 listeners.add(listener);356 }357 358 /**359 * Remove the listener.360 * @param listener The listener that get removed from the list.361 * @deprecated Use Layer.listener.remove instead362 */363 @Deprecated public void removeLayerChangeListener(LayerChangeListener listener) {364 listeners.remove(listener);365 }366 367 /**368 326 * @return An unmodificable list of all layers 369 327 */ … … 388 346 activeLayer = layer; 389 347 if (old != layer) { 390 // TODO: Deprecated391 for (LayerChangeListener l : listeners)392 l.activeLayerChange(old, layer);393 348 for (Layer.LayerChangeListener l : Layer.listeners) 394 349 l.activeLayerChange(old, layer); -
trunk/src/org/openstreetmap/josm/gui/SideButton.java
r1169 r1180 25 25 addActionListener(actionListener); 26 26 setToolTipText(tooltip); 27 }28 @Deprecated29 public SideButton(String name, String imagename, String property, String tooltip, int mnemonic, ActionListener actionListener)30 {31 super(tr(name), ImageProvider.get("dialogs", imagename));32 setMnemonic(mnemonic);33 setup(name, property, tooltip, actionListener);34 27 } 35 28 public SideButton(String name, String imagename, String property, String tooltip, Shortcut shortcut, ActionListener actionListener) -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r1169 r1180 61 61 public JPanel parent; 62 62 private final JPanel titleBar = new JPanel(new GridBagLayout()); 63 64 @Deprecated65 public ToggleDialog(final String name, String iconName, String tooltip, int shortcut, int preferredHeight) {66 super(new BorderLayout());67 this.prefName = iconName;68 ToggleDialogInit(name, iconName, tooltip, Shortcut.registerShortcut("auto:"+name, tooltip, shortcut, Shortcut.GROUP_LAYER), preferredHeight);69 }70 63 71 64 public ToggleDialog(final String name, String iconName, String tooltip, Shortcut shortcut, int preferredHeight) { -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r1169 r1180 104 104 105 105 /** 106 * @deprecated Use Main.main.undoRedo.add(...) instead.107 */108 @Deprecated public void add(final Command c) {109 Main.main.undoRedo.add(c);110 }111 112 /**113 106 * The data behind this layer. 114 107 */ -
trunk/src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java
r1169 r1180 134 134 } 135 135 136 public voidok() {136 public boolean ok() { 137 137 for (int i = 0; i < model.getRowCount(); ++i) { 138 138 String value = model.getValueAt(i,1).toString(); … … 148 148 for (Entry<String, String> e : orig.entrySet()) 149 149 Main.pref.put(e.getKey(), null); 150 return false; 150 151 } 151 152 -
trunk/src/org/openstreetmap/josm/gui/preferences/AudioPreference.java
r1169 r1180 158 158 } 159 159 160 public voidok() {160 public boolean ok() { 161 161 Main.pref.put("audio.menuinvisible", ! audioMenuVisible.isSelected()); 162 162 Main.pref.put("marker.traceaudio", markerAudioTraceVisible.isSelected()); … … 171 171 Main.pref.put("audio.leadin", audioLeadIn.getText()); 172 172 Main.pref.put("audio.calibration", audioCalibration.getText()); 173 return false; 173 174 } 174 175 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java
r1169 r1180 175 175 } 176 176 177 public voidok() {177 public boolean ok() { 178 178 for (int i = 0; i < colors.getRowCount(); ++i) { 179 String name = (String)colors.getValueAt(i, 0); 180 Color col = (Color)colors.getValueAt(i, 1); 181 Main.pref.put("color." + name, ColorHelper.color2html(col)); 179 Main.pref.putColor((String)colors.getValueAt(i, 0), (Color)colors.getValueAt(i, 1)); 182 180 } 183 181 org.openstreetmap.josm.gui.layer.OsmDataLayer.createHatchTexture(); 182 return false; 184 183 } 185 184 } -
trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
r1169 r1180 166 166 } 167 167 168 public voidok() {168 public boolean ok() { 169 169 Main.pref.put("draw.rawgps.lines", drawRawGpsLines.isSelected()); 170 170 Main.pref.put("draw.rawgps.max-line-length", drawRawGpsMaxLineLength.getText()); … … 184 184 if(virtualNodes.isSelected()) { if (vn < 1) vn = 8; } 185 185 else { vn = 0; } 186 Main.pref.put("mappaint.node.virtual-size", Integer.toString(vn)); 186 Main.pref.putInteger("mappaint.node.virtual-size", vn); 187 return false; 187 188 } 188 189 } -
trunk/src/org/openstreetmap/josm/gui/preferences/FilePreferences.java
r1169 r1180 28 28 } 29 29 30 public voidok() {30 public boolean ok() { 31 31 Main.pref.put("save.keepbackup", keepBackup.isSelected()); 32 return false; 32 33 } 33 34 } -
trunk/src/org/openstreetmap/josm/gui/preferences/LafPreference.java
r1178 r1180 63 63 } 64 64 }); 65 lafCombo.addActionListener(gui.requireRestartAction);66 65 67 66 panel = new JPanel(new GridBagLayout()); … … 89 88 } 90 89 91 public void ok() { 92 Main.pref.put("laf", ((LookAndFeelInfo)lafCombo.getSelectedItem()).getClassName()); 90 public boolean ok() { 93 91 Main.pref.put("draw.splashscreen", showSplashScreen.isSelected()); 94 92 Main.pref.put("osm-primitives.showid", showID.isSelected()); 93 return Main.pref.put("laf", ((LookAndFeelInfo)lafCombo.getSelectedItem()).getClassName()); 95 94 } 96 95 -
trunk/src/org/openstreetmap/josm/gui/preferences/LanguagePreference.java
r1169 r1180 53 53 } 54 54 }); 55 langCombo.addActionListener(gui.requireRestartAction);56 55 57 56 JPanel panel = null; … … 67 66 } 68 67 69 public voidok() {68 public boolean ok() { 70 69 if(langCombo.getSelectedItem() == null) 71 { 72 Main.pref.put("language", null); 73 } 70 return Main.pref.put("language", null); 74 71 else 75 { 76 String l = ((Locale)langCombo.getSelectedItem()).toString(); 77 Main.pref.put("language", l); 78 } 72 return Main.pref.put("language", 73 ((Locale)langCombo.getSelectedItem()).toString()); 79 74 } 80 75 } -
trunk/src/org/openstreetmap/josm/gui/preferences/MapPaintPreference.java
r1169 r1180 10 10 } 11 11 12 public voidok() {13 // dummy12 public boolean ok() { 13 return false; // dummy 14 14 } 15 15 -
trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
r1169 r1180 351 351 } 352 352 353 public voidok() {353 public boolean ok() { 354 354 Collection<PluginDescription> toDownload = new LinkedList<PluginDescription>(); 355 355 String msg = ""; … … 375 375 } 376 376 377 String oldPlugins = Main.pref.get("plugins"); 378 LinkedList<String> plugins = new LinkedList<String>(); 377 LinkedList<String> plugins = new LinkedList<String>(); 379 378 Object pd[] = pluginMap.keySet().toArray(); 380 379 Arrays.sort(pd); … … 384 383 } 385 384 386 Main.pref.putCollection("plugins", plugins); 387 String newPlugins = Main.pref.get("plugins"); 388 if(oldPlugins == null && plugins == null) 389 return; 390 if(plugins == null || oldPlugins == null || !plugins.equals(oldPlugins)) 391 gui.requiresRestart = true; 385 return Main.pref.putCollection("plugins", plugins); 392 386 } 393 387 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r1169 r1180 35 35 36 36 public final static Collection<PreferenceSetting> settings = new LinkedList<PreferenceSetting>(); 37 38 public boolean requiresRestart = false;39 public final RequireRestartAction requireRestartAction = new RequireRestartAction();40 37 41 38 // some common tabs … … 91 88 } 92 89 93 94 95 private final class RequireRestartAction implements ActionListener { 96 public void actionPerformed(ActionEvent e) { 97 requiresRestart = true; 90 public void ok() { 91 boolean requiresRestart = false; 92 for (PreferenceSetting setting : settings) 93 { 94 if(setting.ok()) 95 requiresRestart = true; 98 96 } 99 }100 101 public void ok() {102 for (PreferenceSetting setting : settings)103 setting.ok();104 97 if (requiresRestart) 105 98 JOptionPane.showMessageDialog(Main.parent,tr("You have to restart JOSM for some settings to take effect.")); -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceSetting.java
r1169 r1180 12 12 /** 13 13 * Called when OK is pressed to save the setting in the preferences file. 14 * Return true when restart is required. 14 15 */ 15 voidok();16 boolean ok(); 16 17 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
r1169 r1180 41 41 } 42 42 43 projectionCombo.addActionListener(gui.requireRestartAction);44 coordinatesCombo.addActionListener(gui.requireRestartAction);45 46 43 JPanel projPanel = new JPanel(); 47 44 projPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.gray), tr("Map Projection"))); … … 56 53 } 57 54 58 public void ok() { 59 Main.pref.put("projection", projectionCombo.getSelectedItem().getClass().getName()); 60 Main.pref.put("coordinates", ((CoordinateFormat)coordinatesCombo.getSelectedItem()).name()); 55 public boolean ok() { 56 boolean restart = Main.pref.put("projection", 57 projectionCombo.getSelectedItem().getClass().getName()); 58 if(Main.pref.put("coordinates", 59 ((CoordinateFormat)coordinatesCombo.getSelectedItem()).name())) 60 restart = true; 61 return restart; 61 62 } 62 63 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ProxyPreferences.java
r1169 r1180 78 78 } 79 79 80 public voidok() {80 public boolean ok() { 81 81 Main.pref.put(PROXY_ENABLE, proxyEnable.isSelected()); 82 82 Main.pref.put(PROXY_HOST, proxyHost.getText()); … … 85 85 Main.pref.put(PROXY_USER, proxyUser.getText()); 86 86 Main.pref.put(PROXY_PASS, new String(proxyPass.getPassword())); 87 return false; 87 88 } 88 89 89 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ServerAccessPreference.java
r1169 r1180 51 51 } 52 52 53 public voidok() {53 public boolean ok() { 54 54 Main.pref.put("osm-server.url", osmDataServer.getText()); 55 55 Main.pref.put("osm-server.username", osmDataUsername.getText()); 56 String pwd = String.valueOf(osmDataPassword.getPassword()); 57 if (pwd.equals("")) 58 pwd = null; 59 Main.pref.put("osm-server.password", pwd); 56 Main.pref.put("osm-server.password", String.valueOf(osmDataPassword.getPassword())); 57 return false; 60 58 } 61 59 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ShortcutPreference.java
r1169 r1180 30 30 } 31 31 32 public void ok() { 33 } 32 public boolean ok() { 33 return false; 34 } 34 35 35 36 // Maybe move this to prefPanel? There's no need for it to be here. … … 89 90 } 90 91 } 91 92 92 } -
trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java
r1169 r1180 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.ActionListener; 10 import java.util.ArrayList; 10 11 import java.util.Collection; 11 12 import java.util.HashMap; … … 44 45 Main.pref.getBoolean("taggingpreset.enable-defaults", true)); 45 46 46 String annos = Main.pref.get("taggingpreset.sources");47 StringTokenizer st = new StringTokenizer(annos, ";");48 while (st.hasMoreTokens())49 ((DefaultListModel)taggingPresetSources.getModel()).addElement(st.nextToken());47 Collection<String> sources = Main.pref.getCollection("taggingpreset.sources", null); 48 if(sources != null) 49 for(String s : sources) 50 ((DefaultListModel)taggingPresetSources.getModel()).addElement(s); 50 51 51 52 JButton addAnno = new JButton(tr("Add")); … … 53 54 public void actionPerformed(ActionEvent e) { 54 55 String source = JOptionPane.showInputDialog(Main.parent, tr("Tagging preset source")); 55 if (source == null) 56 return; 57 ((DefaultListModel)taggingPresetSources.getModel()).addElement(source); 58 gui.requiresRestart = true; 56 if (source != null) 57 ((DefaultListModel)taggingPresetSources.getModel()).addElement(source); 59 58 } 60 59 }); … … 67 66 else { 68 67 String source = JOptionPane.showInputDialog(Main.parent, tr("Tagging preset source"), taggingPresetSources.getSelectedValue()); 69 if (source == null) 70 return; 71 ((DefaultListModel)taggingPresetSources.getModel()).setElementAt(source, taggingPresetSources.getSelectedIndex()); 72 gui.requiresRestart = true; 68 if (source != null) 69 ((DefaultListModel)taggingPresetSources.getModel()).setElementAt(source, taggingPresetSources.getSelectedIndex()); 73 70 } 74 71 } … … 82 79 else { 83 80 ((DefaultListModel)taggingPresetSources.getModel()).remove(taggingPresetSources.getSelectedIndex()); 84 gui.requiresRestart = true;85 81 } 86 82 } … … 107 103 } 108 104 109 public voidok() {105 public boolean ok() { 110 106 Main.pref.put("taggingpreset.enable-defaults", enableDefault.getSelectedObjects() != null); 111 if (taggingPresetSources.getModel().getSize() > 0) { 112 StringBuilder sb = new StringBuilder(); 113 for (int i = 0; i < taggingPresetSources.getModel().getSize(); ++i) 114 sb.append(";"+taggingPresetSources.getModel().getElementAt(i)); 115 Main.pref.put("taggingpreset.sources", sb.toString().substring(1)); 116 } else 117 Main.pref.put("taggingpreset.sources", null); 107 int num = taggingPresetSources.getModel().getSize(); 108 boolean restart; 109 if (num > 0) 110 { 111 ArrayList<String> l = new ArrayList<String>(); 112 for (int i = 0; i < num; ++i) 113 l.add((String)taggingPresetSources.getModel().getElementAt(i)); 114 restart = Main.pref.putCollection("taggingpreset.sources", l); 115 } 116 else 117 restart = Main.pref.putCollection("taggingpreset.sources", null); 118 return restart; 118 119 } 119 120 -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r1169 r1180 234 234 } 235 235 236 public voidok() {236 public boolean ok() { 237 237 StringBuilder b = new StringBuilder(); 238 238 for (int i = 0; i < selected.size(); ++i) { … … 250 250 Main.pref.put("toolbar", s); 251 251 refreshToolbarControl(); 252 return false; 252 253 } 253 254
Note:
See TracChangeset
for help on using the changeset viewer.