PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/org/gjt/sp/jedit/options/BrowserOptionPane.java

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