1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.gui.preferences;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import javax.swing.JCheckBox;
|
---|
7 | import javax.swing.JSeparator;
|
---|
8 | import javax.swing.SwingConstants;
|
---|
9 |
|
---|
10 | import org.openstreetmap.josm.Main;
|
---|
11 | import org.openstreetmap.josm.tools.GBC;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Out of pure laziness, I add the file stuff to connection tab.
|
---|
15 | * Feel free to fix this.
|
---|
16 | *
|
---|
17 | * @author imi
|
---|
18 | */
|
---|
19 | public class FilePreferences implements PreferenceSetting {
|
---|
20 |
|
---|
21 | public static class Factory implements PreferenceSettingFactory {
|
---|
22 | public PreferenceSetting createPreferenceSetting() {
|
---|
23 | return new FilePreferences();
|
---|
24 | }
|
---|
25 | }
|
---|
26 |
|
---|
27 | private JCheckBox keepBackup = new JCheckBox(tr("Keep backup files"));
|
---|
28 |
|
---|
29 | public void addGui(PreferenceDialog gui) {
|
---|
30 | gui.connection.add(new JSeparator(SwingConstants.HORIZONTAL), GBC.eol().fill(GBC.HORIZONTAL));
|
---|
31 | keepBackup.setSelected(Main.pref.getBoolean("save.keepbackup"));
|
---|
32 | keepBackup.setToolTipText(tr("When saving, keep backup files ending with a ~"));
|
---|
33 | gui.connection.add(keepBackup, GBC.eol().insets(20,0,0,0));
|
---|
34 | }
|
---|
35 |
|
---|
36 | public boolean ok() {
|
---|
37 | Main.pref.put("save.keepbackup", keepBackup.isSelected());
|
---|
38 | return false;
|
---|
39 | }
|
---|
40 | }
|
---|