1 22 23 package org.gjt.sp.jedit.options; 24 25 import javax.swing.*; 27 import org.gjt.sp.jedit.*; 28 30 35 public class BrowserOptionPane extends AbstractOptionPane 36 { 37 public BrowserOptionPane() 39 { 40 super("browser.general"); 41 } 43 public void _init() 45 { 46 47 String [] dirs = { 48 jEdit.getProperty("options.browser.general.defaultPath.favorites"), 49 jEdit.getProperty("options.browser.general.defaultPath.home"), 50 jEdit.getProperty("options.browser.general.defaultPath.last"), 51 jEdit.getProperty("options.browser.general.defaultPath.buffer"), 52 jEdit.getProperty("options.browser.general.defaultPath.working") 53 }; 54 55 defaultDirectory = new JComboBox(dirs); 56 String defaultDir = jEdit.getProperty("vfs.browser.defaultPath"); 57 if("favorites".equals(defaultDir)) 58 defaultDirectory.setSelectedIndex(0); 59 else if("home".equals(defaultDir)) 60 defaultDirectory.setSelectedIndex(1); 61 else if("last".equals(defaultDir)) 62 defaultDirectory.setSelectedIndex(2); 63 else if("buffer".equals(defaultDir)) 64 defaultDirectory.setSelectedIndex(3); 65 else if("working".equals(defaultDir)) 66 defaultDirectory.setSelectedIndex(4); 67 addComponent(jEdit.getProperty("options.browser.general.defaultPath"), 68 defaultDirectory); 69 70 71 showToolbar = new JCheckBox(jEdit.getProperty("options.browser" 72 + ".general.showToolbar")); 73 showToolbar.setSelected(jEdit.getBooleanProperty("vfs.browser" 74 + ".showToolbar")); 75 addComponent(showToolbar); 76 77 78 showMenubar = new JCheckBox(jEdit.getProperty("options.browser" 79 + ".general.showMenubar")); 80 showMenubar.setSelected(jEdit.getBooleanProperty("vfs.browser" 81 + ".showMenubar")); 82 addComponent(showMenubar); 83 84 85 showIcons = new JCheckBox(jEdit.getProperty("options.browser" 86 + ".general.showIcons")); 87 showIcons.setSelected(jEdit.getBooleanProperty("vfs.browser" 88 + ".showIcons")); 89 addComponent(showIcons); 90 91 92 showHiddenFiles = new JCheckBox(jEdit.getProperty("options.browser" 93 + ".general.showHiddenFiles")); 94 showHiddenFiles.setSelected(jEdit.getBooleanProperty("vfs.browser" 95 + ".showHiddenFiles")); 96 addComponent(showHiddenFiles); 97 98 99 sortIgnoreCase = new JCheckBox(jEdit.getProperty("options.browser" 100 + ".general.sortIgnoreCase")); 101 sortIgnoreCase.setSelected(jEdit.getBooleanProperty("vfs.browser" 102 + ".sortIgnoreCase")); 103 addComponent(sortIgnoreCase); 104 105 106 sortMixFilesAndDirs = new JCheckBox(jEdit.getProperty("options.browser" 107 + ".general.sortMixFilesAndDirs")); 108 sortMixFilesAndDirs.setSelected(jEdit.getBooleanProperty("vfs.browser" 109 + ".sortMixFilesAndDirs")); 110 addComponent(sortMixFilesAndDirs); 111 112 113 doubleClickClose = new JCheckBox(jEdit.getProperty("options.browser" 114 + ".general.doubleClickClose")); 115 doubleClickClose.setSelected(jEdit.getBooleanProperty("vfs.browser" 116 + ".doubleClickClose")); 117 addComponent(doubleClickClose); 118 119 120 currentBufferFilter = new JCheckBox(jEdit.getProperty("options.browser" 121 + ".general.currentBufferFilter")); 122 currentBufferFilter.setSelected(jEdit.getBooleanProperty("vfs.browser" 123 + ".currentBufferFilter")); 124 addComponent(currentBufferFilter); 125 126 127 useDefaultIcons = new JCheckBox(jEdit.getProperty("options.browser.general.useDefaultIcons")); 128 useDefaultIcons.setSelected(jEdit.getBooleanProperty("vfs.browser.useDefaultIcons")); 129 addComponent(useDefaultIcons); 130 } 132 public void _save() 134 { 135 String [] dirs = { "favorites", "home", "last", "buffer", "working"}; 136 jEdit.setProperty("vfs.browser.defaultPath",dirs[defaultDirectory 137 .getSelectedIndex()]); 138 jEdit.setBooleanProperty("vfs.browser.showToolbar", 139 showToolbar.isSelected()); 140 jEdit.setBooleanProperty("vfs.browser.showMenubar", 141 showMenubar.isSelected()); 142 jEdit.setBooleanProperty("vfs.browser.showIcons", 143 showIcons.isSelected()); 144 jEdit.setBooleanProperty("vfs.browser.showHiddenFiles", 145 showHiddenFiles.isSelected()); 146 jEdit.setBooleanProperty("vfs.browser.sortIgnoreCase", 147 sortIgnoreCase.isSelected()); 148 jEdit.setBooleanProperty("vfs.browser.sortMixFilesAndDirs", 149 sortMixFilesAndDirs.isSelected()); 150 jEdit.setBooleanProperty("vfs.browser.doubleClickClose", 151 doubleClickClose.isSelected()); 152 jEdit.setBooleanProperty("vfs.browser.currentBufferFilter", 153 currentBufferFilter.isSelected()); 154 jEdit.setBooleanProperty("vfs.browser.useDefaultIcons", 155 useDefaultIcons.isSelected()); 156 } 158 private JComboBox defaultDirectory; 160 private JCheckBox showToolbar; 161 private JCheckBox showMenubar; 162 private JCheckBox showIcons; 163 private JCheckBox showHiddenFiles; 164 private JCheckBox sortIgnoreCase; 165 private JCheckBox sortMixFilesAndDirs; 166 private JCheckBox doubleClickClose; 167 private JCheckBox currentBufferFilter; 168 private JCheckBox useDefaultIcons; 169 } | Popular Tags |