KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > sp > jedit > options > BrowserOptionPane


1 /*
2  * BrowserOptionPane.java - Browser options panel
3  * :tabSize=8:indentSize=8:noTabs=false:
4  * :folding=explicit:collapseFolds=1:
5  *
6  * Copyright (C) 2000, 2001 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
23 package org.gjt.sp.jedit.options;
24
25 //{{{ Imports
26
import javax.swing.*;
27 import org.gjt.sp.jedit.*;
28 //}}}
29

30 //{{{ BrowserOptionPane class
31
/**
32  * @author Slava Pestov
33  * @version $Id: BrowserOptionPane.java 8581 2007-01-13 18:42:18Z kpouer $
34  */

35 public class BrowserOptionPane extends AbstractOptionPane
36 {
37     //{{{ BrowserOptionPane constructor
38
public BrowserOptionPane()
39     {
40         super("browser.general");
41     } //}}}
42

43     //{{{ _init() method
44
public void _init()
45     {
46         /* Default directory */
47         String JavaDoc[] 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 JavaDoc 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         /* Show tool bar */
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         /* Show menu bar */
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         /* Show icons */
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         /* Show hidden files */
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         /* Ignore case when sorting */
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         /* Mix files and directories */
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         /* Double-click close */
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         /* split VFSFileDialog horizontally */
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         /* use default icons. */
127         useDefaultIcons = new JCheckBox(jEdit.getProperty("options.browser.general.useDefaultIcons"));
128         useDefaultIcons.setSelected(jEdit.getBooleanProperty("vfs.browser.useDefaultIcons"));
129         addComponent(useDefaultIcons);
130     } //}}}
131

132     //{{{ _save() method
133
public void _save()
134     {
135         String JavaDoc[] 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     } //}}}
157

158     //{{{ Private members
159
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     //}}}
170
} //}}}
171
Popular Tags