PageRenderTime 69ms CodeModel.GetById 61ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre14/org/gjt/sp/jedit/options/BrowserOptionPane.java

#
Java | 158 lines | 105 code | 15 blank | 38 comment | 9 complexity | d5f91aa5fbfde2f1d3d35de973018703 MD5 | raw file
  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
 23package org.gjt.sp.jedit.options;
 24
 25//{{{ Imports
 26import javax.swing.*;
 27import org.gjt.sp.jedit.*;
 28//}}}
 29
 30//{{{ BrowserOptionPane class
 31public class BrowserOptionPane extends AbstractOptionPane
 32{
 33	//{{{ BrowserOptionPane constructor
 34	public BrowserOptionPane()
 35	{
 36		super("browser.general");
 37	} //}}}
 38
 39	//{{{ _init() method
 40	public void _init()
 41	{
 42		/* Default directory */
 43		String[] dirs = {
 44			jEdit.getProperty("options.browser.general.defaultPath.favorites"),
 45			jEdit.getProperty("options.browser.general.defaultPath.home"),
 46			jEdit.getProperty("options.browser.general.defaultPath.last"),
 47			jEdit.getProperty("options.browser.general.defaultPath.buffer"),
 48			jEdit.getProperty("options.browser.general.defaultPath.working")
 49		};
 50
 51		defaultDirectory = new JComboBox(dirs);
 52		String defaultDir = jEdit.getProperty("vfs.browser.defaultPath");
 53		if("favorites".equals(defaultDir))
 54			defaultDirectory.setSelectedIndex(0);
 55		else if("home".equals(defaultDir))
 56			defaultDirectory.setSelectedIndex(1);
 57		else if("last".equals(defaultDir))
 58			defaultDirectory.setSelectedIndex(2);
 59		else if("buffer".equals(defaultDir))
 60			defaultDirectory.setSelectedIndex(3);
 61		else if("working".equals(defaultDir))
 62			defaultDirectory.setSelectedIndex(4);
 63		addComponent(jEdit.getProperty("options.browser.general.defaultPath"),
 64			defaultDirectory);
 65
 66		/* Show tool bar */
 67		showToolbar = new JCheckBox(jEdit.getProperty("options.browser"
 68			+ ".general.showToolbar"));
 69		showToolbar.setSelected(jEdit.getBooleanProperty("vfs.browser"
 70			+ ".showToolbar"));
 71		addComponent(showToolbar);
 72
 73		/* Show menu bar */
 74		showMenubar = new JCheckBox(jEdit.getProperty("options.browser"
 75			+ ".general.showMenubar"));
 76		showMenubar.setSelected(jEdit.getBooleanProperty("vfs.browser"
 77			+ ".showMenubar"));
 78		addComponent(showMenubar);
 79
 80		/* Show icons */
 81		showIcons = new JCheckBox(jEdit.getProperty("options.browser"
 82			+ ".general.showIcons"));
 83		showIcons.setSelected(jEdit.getBooleanProperty("vfs.browser"
 84			+ ".showIcons"));
 85		addComponent(showIcons);
 86
 87		/* Show hidden files */
 88		showHiddenFiles = new JCheckBox(jEdit.getProperty("options.browser"
 89			+ ".general.showHiddenFiles"));
 90		showHiddenFiles.setSelected(jEdit.getBooleanProperty("vfs.browser"
 91			+ ".showHiddenFiles"));
 92		addComponent(showHiddenFiles);
 93
 94		/* Ignore case when sorting */
 95		sortIgnoreCase = new JCheckBox(jEdit.getProperty("options.browser"
 96			+ ".general.sortIgnoreCase"));
 97		sortIgnoreCase.setSelected(jEdit.getBooleanProperty("vfs.browser"
 98			+ ".sortIgnoreCase"));
 99		addComponent(sortIgnoreCase);
100
101		/* Mix files and directories */
102		sortMixFilesAndDirs = new JCheckBox(jEdit.getProperty("options.browser"
103			+ ".general.sortMixFilesAndDirs"));
104		sortMixFilesAndDirs.setSelected(jEdit.getBooleanProperty("vfs.browser"
105			+ ".sortMixFilesAndDirs"));
106		addComponent(sortMixFilesAndDirs);
107
108		/* Double-click close */
109		doubleClickClose = new JCheckBox(jEdit.getProperty("options.browser"
110			+ ".general.doubleClickClose"));
111		doubleClickClose.setSelected(jEdit.getBooleanProperty("vfs.browser"
112			+ ".doubleClickClose"));
113		addComponent(doubleClickClose);
114
115		/* split VFSFileDialog horizontally */
116		currentBufferFilter = new JCheckBox(jEdit.getProperty("options.browser"
117			+ ".general.currentBufferFilter"));
118		currentBufferFilter.setSelected(jEdit.getBooleanProperty("vfs.browser"
119			+ ".currentBufferFilter"));
120		addComponent(currentBufferFilter);
121	} //}}}
122
123	//{{{ _save() method
124	public void _save()
125	{
126		String[] dirs = { "favorites", "home", "last", "buffer", "working"};
127		jEdit.setProperty("vfs.browser.defaultPath",dirs[defaultDirectory
128			.getSelectedIndex()]);
129		jEdit.setBooleanProperty("vfs.browser.showToolbar",
130			showToolbar.isSelected());
131		jEdit.setBooleanProperty("vfs.browser.showMenubar",
132			showMenubar.isSelected());
133		jEdit.setBooleanProperty("vfs.browser.showIcons",
134			showIcons.isSelected());
135		jEdit.setBooleanProperty("vfs.browser.showHiddenFiles",
136			showHiddenFiles.isSelected());
137		jEdit.setBooleanProperty("vfs.browser.sortIgnoreCase",
138			sortIgnoreCase.isSelected());
139		jEdit.setBooleanProperty("vfs.browser.sortMixFilesAndDirs",
140			sortMixFilesAndDirs.isSelected());
141		jEdit.setBooleanProperty("vfs.browser.doubleClickClose",
142			doubleClickClose.isSelected());
143		jEdit.setBooleanProperty("vfs.browser.currentBufferFilter",
144			currentBufferFilter.isSelected());
145	} //}}}
146
147	//{{{ Private members
148	private JComboBox defaultDirectory;
149	private JCheckBox showToolbar;
150	private JCheckBox showMenubar;
151	private JCheckBox showIcons;
152	private JCheckBox showHiddenFiles;
153	private JCheckBox sortIgnoreCase;
154	private JCheckBox sortMixFilesAndDirs;
155	private JCheckBox doubleClickClose;
156	private JCheckBox currentBufferFilter;
157	//}}}
158} //}}}