PageRenderTime 16ms CodeModel.GetById 2ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 157 lines | 105 code | 15 blank | 37 comment | 7 complexity | fa8e0647bcc3e738654d4c6a370fa1ca 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
122	//{{{ _save() method
123	public void _save()
124	{
125		String[] dirs = { "buffer", "home", "favorites", "last" };
126		jEdit.setProperty("vfs.browser.defaultPath",dirs[defaultDirectory
127			.getSelectedIndex()]);
128		jEdit.setBooleanProperty("vfs.browser.showToolbar",
129			showToolbar.isSelected());
130		jEdit.setBooleanProperty("vfs.browser.showIcons",
131			showIcons.isSelected());
132		jEdit.setBooleanProperty("vfs.browser.showHiddenFiles",
133			showHiddenFiles.isSelected());
134		jEdit.setBooleanProperty("vfs.browser.sortFiles",
135			sortFiles.isSelected());
136		jEdit.setBooleanProperty("vfs.browser.sortIgnoreCase",
137			sortIgnoreCase.isSelected());
138		jEdit.setBooleanProperty("vfs.browser.sortMixFilesAndDirs",
139			sortMixFilesAndDirs.isSelected());
140		jEdit.setBooleanProperty("vfs.browser.doubleClickClose",
141			doubleClickClose.isSelected());
142		jEdit.setBooleanProperty("vfs.browser.currentBufferFilter",
143			currentBufferFilter.isSelected());
144	} //}}}
145
146	//{{{ Private members
147	private JComboBox defaultDirectory;
148	private JCheckBox showToolbar;
149	private JCheckBox showIcons;
150	private JCheckBox showHiddenFiles;
151	private JCheckBox sortFiles;
152	private JCheckBox sortIgnoreCase;
153	private JCheckBox sortMixFilesAndDirs;
154	private JCheckBox doubleClickClose;
155	private JCheckBox currentBufferFilter;
156	//}}}
157}