PageRenderTime 209ms CodeModel.GetById 202ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre14/org/gjt/sp/jedit/options/AutosaveBackupOptionPane.java

#
Java | 94 lines | 49 code | 11 blank | 34 comment | 0 complexity | 48ababf9baa1b9e4e8d5f13c1c71de7c MD5 | raw file
 1/*
 2 * AutosaveBackupOptionPane.java - Autosave & backup options
 3 * :tabSize=8:indentSize=8:noTabs=false:
 4 * :folding=explicit:collapseFolds=1:
 5 *
 6 * Copyright (C) 2003 Slava Pestov
 7 *
 8 * This program is free software; you can redistribute it and/or
 9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 */
22
23package org.gjt.sp.jedit.options;
24
25//{{{ Imports
26import javax.swing.*;
27import java.awt.event.*;
28import java.util.StringTokenizer;
29import org.gjt.sp.jedit.*;
30//}}}
31
32public class AutosaveBackupOptionPane extends AbstractOptionPane
33{
34	//{{{ AutosaveBackupOptionPane constructor
35	public AutosaveBackupOptionPane()
36	{
37		super("auto-back");
38	} //}}}
39
40	//{{{ _init() method
41	protected void _init()
42	{
43		/* Autosave interval */
44		autosave = new JTextField(jEdit.getProperty("autosave"));
45		addComponent(jEdit.getProperty("options.auto-back.autosave"),autosave);
46
47		/* Backup count */
48		backups = new JTextField(jEdit.getProperty("backups"));
49		addComponent(jEdit.getProperty("options.auto-back.backups"),backups);
50
51		/* Backup directory */
52		backupDirectory = new JTextField(jEdit.getProperty(
53			"backup.directory"));
54		addComponent(jEdit.getProperty("options.auto-back.backupDirectory"),
55			backupDirectory);
56
57		/* Backup filename prefix */
58		backupPrefix = new JTextField(jEdit.getProperty("backup.prefix"));
59		addComponent(jEdit.getProperty("options.auto-back.backupPrefix"),
60			backupPrefix);
61
62		/* Backup suffix */
63		backupSuffix = new JTextField(jEdit.getProperty(
64			"backup.suffix"));
65		addComponent(jEdit.getProperty("options.auto-back.backupSuffix"),
66			backupSuffix);
67
68		/* Backup on every save */
69		backupEverySave = new JCheckBox(jEdit.getProperty(
70			"options.auto-back.backupEverySave"));
71		backupEverySave.setSelected(jEdit.getBooleanProperty("backupEverySave"));
72		addComponent(backupEverySave);
73	} //}}}
74
75	//{{{ _save() method
76	protected void _save()
77	{
78		jEdit.setProperty("autosave",autosave.getText());
79		jEdit.setProperty("backups",backups.getText());
80		jEdit.setProperty("backup.directory",backupDirectory.getText());
81		jEdit.setProperty("backup.prefix",backupPrefix.getText());
82		jEdit.setProperty("backup.suffix",backupSuffix.getText());
83		jEdit.setBooleanProperty("backupEverySave", backupEverySave.isSelected());
84	} //}}}
85
86	//{{{ Private members
87	private JTextField autosave;
88	private JTextField backups;
89	private JTextField backupDirectory;
90	private JTextField backupPrefix;
91	private JTextField backupSuffix;
92	private JCheckBox backupEverySave;
93	//}}}
94}