PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. package org.gjt.sp.jedit.options;
  23. //{{{ Imports
  24. import javax.swing.*;
  25. import java.awt.event.*;
  26. import java.util.StringTokenizer;
  27. import org.gjt.sp.jedit.*;
  28. //}}}
  29. public class AutosaveBackupOptionPane extends AbstractOptionPane
  30. {
  31. //{{{ AutosaveBackupOptionPane constructor
  32. public AutosaveBackupOptionPane()
  33. {
  34. super("auto-back");
  35. } //}}}
  36. //{{{ _init() method
  37. protected void _init()
  38. {
  39. /* Autosave interval */
  40. autosave = new JTextField(jEdit.getProperty("autosave"));
  41. addComponent(jEdit.getProperty("options.auto-back.autosave"),autosave);
  42. /* Backup count */
  43. backups = new JTextField(jEdit.getProperty("backups"));
  44. addComponent(jEdit.getProperty("options.auto-back.backups"),backups);
  45. /* Backup directory */
  46. backupDirectory = new JTextField(jEdit.getProperty(
  47. "backup.directory"));
  48. addComponent(jEdit.getProperty("options.auto-back.backupDirectory"),
  49. backupDirectory);
  50. /* Backup filename prefix */
  51. backupPrefix = new JTextField(jEdit.getProperty("backup.prefix"));
  52. addComponent(jEdit.getProperty("options.auto-back.backupPrefix"),
  53. backupPrefix);
  54. /* Backup suffix */
  55. backupSuffix = new JTextField(jEdit.getProperty(
  56. "backup.suffix"));
  57. addComponent(jEdit.getProperty("options.auto-back.backupSuffix"),
  58. backupSuffix);
  59. /* Backup on every save */
  60. backupEverySave = new JCheckBox(jEdit.getProperty(
  61. "options.auto-back.backupEverySave"));
  62. backupEverySave.setSelected(jEdit.getBooleanProperty("backupEverySave"));
  63. addComponent(backupEverySave);
  64. } //}}}
  65. //{{{ _save() method
  66. protected void _save()
  67. {
  68. jEdit.setProperty("autosave",autosave.getText());
  69. jEdit.setProperty("backups",backups.getText());
  70. jEdit.setProperty("backup.directory",backupDirectory.getText());
  71. jEdit.setProperty("backup.prefix",backupPrefix.getText());
  72. jEdit.setProperty("backup.suffix",backupSuffix.getText());
  73. jEdit.setBooleanProperty("backupEverySave", backupEverySave.isSelected());
  74. } //}}}
  75. //{{{ Private members
  76. private JTextField autosave;
  77. private JTextField backups;
  78. private JTextField backupDirectory;
  79. private JTextField backupPrefix;
  80. private JTextField backupSuffix;
  81. private JCheckBox backupEverySave;
  82. //}}}
  83. }