001: /*
002: * BrowserOptionPane.java - Browser options panel
003: * :tabSize=8:indentSize=8:noTabs=false:
004: * :folding=explicit:collapseFolds=1:
005: *
006: * Copyright (C) 2000, 2001 Slava Pestov
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public License
010: * as published by the Free Software Foundation; either version 2
011: * of the License, or any later version.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with this program; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
021: */
022:
023: package org.gjt.sp.jedit.options;
024:
025: //{{{ Imports
026: import javax.swing.*;
027: import org.gjt.sp.jedit.*;
028:
029: //}}}
030:
031: //{{{ BrowserOptionPane class
032: /**
033: * @author Slava Pestov
034: * @version $Id: BrowserOptionPane.java 8581 2007-01-13 18:42:18Z kpouer $
035: */
036: public class BrowserOptionPane extends AbstractOptionPane {
037: //{{{ BrowserOptionPane constructor
038: public BrowserOptionPane() {
039: super ("browser.general");
040: } //}}}
041:
042: //{{{ _init() method
043: public void _init() {
044: /* Default directory */
045: String[] dirs = {
046: jEdit
047: .getProperty("options.browser.general.defaultPath.favorites"),
048: jEdit
049: .getProperty("options.browser.general.defaultPath.home"),
050: jEdit
051: .getProperty("options.browser.general.defaultPath.last"),
052: jEdit
053: .getProperty("options.browser.general.defaultPath.buffer"),
054: jEdit
055: .getProperty("options.browser.general.defaultPath.working") };
056:
057: defaultDirectory = new JComboBox(dirs);
058: String defaultDir = jEdit
059: .getProperty("vfs.browser.defaultPath");
060: if ("favorites".equals(defaultDir))
061: defaultDirectory.setSelectedIndex(0);
062: else if ("home".equals(defaultDir))
063: defaultDirectory.setSelectedIndex(1);
064: else if ("last".equals(defaultDir))
065: defaultDirectory.setSelectedIndex(2);
066: else if ("buffer".equals(defaultDir))
067: defaultDirectory.setSelectedIndex(3);
068: else if ("working".equals(defaultDir))
069: defaultDirectory.setSelectedIndex(4);
070: addComponent(jEdit
071: .getProperty("options.browser.general.defaultPath"),
072: defaultDirectory);
073:
074: /* Show tool bar */
075: showToolbar = new JCheckBox(jEdit.getProperty("options.browser"
076: + ".general.showToolbar"));
077: showToolbar.setSelected(jEdit.getBooleanProperty("vfs.browser"
078: + ".showToolbar"));
079: addComponent(showToolbar);
080:
081: /* Show menu bar */
082: showMenubar = new JCheckBox(jEdit.getProperty("options.browser"
083: + ".general.showMenubar"));
084: showMenubar.setSelected(jEdit.getBooleanProperty("vfs.browser"
085: + ".showMenubar"));
086: addComponent(showMenubar);
087:
088: /* Show icons */
089: showIcons = new JCheckBox(jEdit.getProperty("options.browser"
090: + ".general.showIcons"));
091: showIcons.setSelected(jEdit.getBooleanProperty("vfs.browser"
092: + ".showIcons"));
093: addComponent(showIcons);
094:
095: /* Show hidden files */
096: showHiddenFiles = new JCheckBox(jEdit
097: .getProperty("options.browser"
098: + ".general.showHiddenFiles"));
099: showHiddenFiles
100: .setSelected(jEdit.getBooleanProperty("vfs.browser"
101: + ".showHiddenFiles"));
102: addComponent(showHiddenFiles);
103:
104: /* Ignore case when sorting */
105: sortIgnoreCase = new JCheckBox(jEdit
106: .getProperty("options.browser"
107: + ".general.sortIgnoreCase"));
108: sortIgnoreCase.setSelected(jEdit
109: .getBooleanProperty("vfs.browser" + ".sortIgnoreCase"));
110: addComponent(sortIgnoreCase);
111:
112: /* Mix files and directories */
113: sortMixFilesAndDirs = new JCheckBox(jEdit
114: .getProperty("options.browser"
115: + ".general.sortMixFilesAndDirs"));
116: sortMixFilesAndDirs.setSelected(jEdit
117: .getBooleanProperty("vfs.browser"
118: + ".sortMixFilesAndDirs"));
119: addComponent(sortMixFilesAndDirs);
120:
121: /* Double-click close */
122: doubleClickClose = new JCheckBox(jEdit
123: .getProperty("options.browser"
124: + ".general.doubleClickClose"));
125: doubleClickClose
126: .setSelected(jEdit.getBooleanProperty("vfs.browser"
127: + ".doubleClickClose"));
128: addComponent(doubleClickClose);
129:
130: /* split VFSFileDialog horizontally */
131: currentBufferFilter = new JCheckBox(jEdit
132: .getProperty("options.browser"
133: + ".general.currentBufferFilter"));
134: currentBufferFilter.setSelected(jEdit
135: .getBooleanProperty("vfs.browser"
136: + ".currentBufferFilter"));
137: addComponent(currentBufferFilter);
138:
139: /* use default icons. */
140: useDefaultIcons = new JCheckBox(jEdit
141: .getProperty("options.browser.general.useDefaultIcons"));
142: useDefaultIcons.setSelected(jEdit
143: .getBooleanProperty("vfs.browser.useDefaultIcons"));
144: addComponent(useDefaultIcons);
145: } //}}}
146:
147: //{{{ _save() method
148: public void _save() {
149: String[] dirs = { "favorites", "home", "last", "buffer",
150: "working" };
151: jEdit.setProperty("vfs.browser.defaultPath",
152: dirs[defaultDirectory.getSelectedIndex()]);
153: jEdit.setBooleanProperty("vfs.browser.showToolbar", showToolbar
154: .isSelected());
155: jEdit.setBooleanProperty("vfs.browser.showMenubar", showMenubar
156: .isSelected());
157: jEdit.setBooleanProperty("vfs.browser.showIcons", showIcons
158: .isSelected());
159: jEdit.setBooleanProperty("vfs.browser.showHiddenFiles",
160: showHiddenFiles.isSelected());
161: jEdit.setBooleanProperty("vfs.browser.sortIgnoreCase",
162: sortIgnoreCase.isSelected());
163: jEdit.setBooleanProperty("vfs.browser.sortMixFilesAndDirs",
164: sortMixFilesAndDirs.isSelected());
165: jEdit.setBooleanProperty("vfs.browser.doubleClickClose",
166: doubleClickClose.isSelected());
167: jEdit.setBooleanProperty("vfs.browser.currentBufferFilter",
168: currentBufferFilter.isSelected());
169: jEdit.setBooleanProperty("vfs.browser.useDefaultIcons",
170: useDefaultIcons.isSelected());
171: } //}}}
172:
173: //{{{ Private members
174: private JComboBox defaultDirectory;
175: private JCheckBox showToolbar;
176: private JCheckBox showMenubar;
177: private JCheckBox showIcons;
178: private JCheckBox showHiddenFiles;
179: private JCheckBox sortIgnoreCase;
180: private JCheckBox sortMixFilesAndDirs;
181: private JCheckBox doubleClickClose;
182: private JCheckBox currentBufferFilter;
183: private JCheckBox useDefaultIcons;
184: //}}}
185: } //}}}
|