PageRenderTime 66ms CodeModel.GetById 54ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

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

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