1 22 23 package org.gjt.sp.jedit.options; 24 25 import javax.swing.*; 27 import java.awt.event.*; 28 import java.awt.*; 29 import org.gjt.sp.jedit.*; 30 import org.gjt.sp.jedit.browser.VFSBrowser; 31 33 39 public class SaveBackupOptionPane extends AbstractOptionPane 40 { 41 public SaveBackupOptionPane() 43 { 44 super("save-back"); 45 } 47 protected void _init() 49 { 50 51 twoStageSave = new JCheckBox(jEdit.getProperty( 52 "options.save-back.twoStageSave")); 53 twoStageSave.setSelected(jEdit.getBooleanProperty( 54 "twoStageSave")); 55 addComponent(twoStageSave); 56 57 58 confirmSaveAll = new JCheckBox(jEdit.getProperty( 59 "options.save-back.confirmSaveAll")); 60 confirmSaveAll.setSelected(jEdit.getBooleanProperty( 61 "confirmSaveAll")); 62 addComponent(confirmSaveAll); 63 64 65 autosave = new JTextField(jEdit.getProperty("autosave")); 66 addComponent(jEdit.getProperty("options.save-back.autosave"),autosave); 67 68 69 backups = new JTextField(jEdit.getProperty("backups")); 70 addComponent(jEdit.getProperty("options.save-back.backups"),backups); 71 72 73 backupDirectory = new JTextField(jEdit.getProperty( 74 "backup.directory")); 75 JButton browseBackupDirectory = new JButton("..."); 76 browseBackupDirectory.addActionListener(new MyActionListener()); 77 JPanel panel = new JPanel(new BorderLayout()); 78 panel.add(backupDirectory); 79 panel.add(browseBackupDirectory, BorderLayout.EAST); 80 addComponent(jEdit.getProperty("options.save-back.backupDirectory"), 81 panel); 82 83 84 backupPrefix = new JTextField(jEdit.getProperty("backup.prefix")); 85 addComponent(jEdit.getProperty("options.save-back.backupPrefix"), 86 backupPrefix); 87 88 89 backupSuffix = new JTextField(jEdit.getProperty( 90 "backup.suffix")); 91 addComponent(jEdit.getProperty("options.save-back.backupSuffix"), 92 backupSuffix); 93 94 95 backupEverySave = new JCheckBox(jEdit.getProperty( 96 "options.save-back.backupEverySave")); 97 backupEverySave.setSelected(jEdit.getBooleanProperty("backupEverySave")); 98 addComponent(backupEverySave); 99 } 101 protected void _save() 103 { 104 jEdit.setBooleanProperty("twoStageSave",twoStageSave.isSelected()); 105 jEdit.setBooleanProperty("confirmSaveAll",confirmSaveAll.isSelected()); 106 jEdit.setProperty("autosave",autosave.getText()); 107 jEdit.setProperty("backups",backups.getText()); 108 jEdit.setProperty("backup.directory",backupDirectory.getText()); 109 jEdit.setProperty("backup.prefix",backupPrefix.getText()); 110 jEdit.setProperty("backup.suffix",backupSuffix.getText()); 111 jEdit.setBooleanProperty("backupEverySave", backupEverySave.isSelected()); 112 } 114 private JCheckBox twoStageSave; 116 private JCheckBox confirmSaveAll; 117 private JTextField autosave; 118 private JTextField backups; 119 private JTextField backupDirectory; 120 private JTextField backupPrefix; 121 private JTextField backupSuffix; 122 private JCheckBox backupEverySave; 123 125 private class MyActionListener implements ActionListener 126 { 127 public void actionPerformed(ActionEvent e) 128 { 129 String [] choosenFolder = 130 GUIUtilities.showVFSFileDialog(null, 131 backupDirectory.getText(), 132 VFSBrowser.CHOOSE_DIRECTORY_DIALOG, 133 false); 134 if (choosenFolder != null) 135 backupDirectory.setText(choosenFolder[0]); 136 } 137 } 138 } 139 | Popular Tags |