PageRenderTime 106ms CodeModel.GetById 96ms app.highlight 4ms RepoModel.GetById 5ms app.codeStats 0ms

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

#
Java | 103 lines | 66 code | 15 blank | 22 comment | 2 complexity | 8d6f86c902ee7226cb9ab1df8d7e46cb MD5 | raw file
  1/*
  2 * GlobalOptions.java - Global options dialog
  3 * Copyright (C) 2002 Slava Pestov
  4 *
  5 * This program is free software; you can redistribute it and/or
  6 * modify it under the terms of the GNU General Public License
  7 * as published by the Free Software Foundation; either version 2
  8 * of the License, or any later version.
  9 *
 10 * This program is distributed in the hope that it will be useful,
 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13 * GNU General Public License for more details.
 14 *
 15 * You should have received a copy of the GNU General Public License
 16 * along with this program; if not, write to the Free Software
 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 18 */
 19
 20package org.gjt.sp.jedit.options;
 21
 22import org.gjt.sp.jedit.gui.OptionsDialog;
 23import org.gjt.sp.jedit.options.*;
 24import org.gjt.sp.jedit.*;
 25import org.gjt.sp.util.Log;
 26
 27public class GlobalOptions extends OptionsDialog
 28{
 29	public GlobalOptions(View view)
 30	{
 31		super(view,"options");
 32	}
 33
 34	protected OptionTreeModel createOptionTreeModel()
 35	{
 36		OptionTreeModel paneTreeModel = new OptionTreeModel();
 37		OptionGroup rootGroup = (OptionGroup) paneTreeModel.getRoot();
 38
 39		addOptionPane(new OverviewOptionPane(), rootGroup);
 40
 41		// initialize the jEdit branch of the options tree
 42		jEditGroup = new OptionGroup("jedit");
 43
 44		addOptionPane(new GeneralOptionPane(), jEditGroup);
 45		addOptionPane(new AppearanceOptionPane(), jEditGroup);
 46		addOptionPane(new TextAreaOptionPane(), jEditGroup);
 47		addOptionPane(new GutterOptionPane(), jEditGroup);
 48		addOptionPane(new SyntaxHiliteOptionPane(), jEditGroup);
 49		addOptionPane(new LoadSaveOptionPane(), jEditGroup);
 50		addOptionPane(new EditingOptionPane(), jEditGroup);
 51		addOptionPane(new ModeOptionPane(), jEditGroup);
 52		addOptionPane(new AbbrevsOptionPane(), jEditGroup);
 53		addOptionPane(new ShortcutsOptionPane(), jEditGroup);
 54		addOptionPane(new DockingOptionPane(), jEditGroup);
 55		addOptionPane(new ContextOptionPane(), jEditGroup);
 56		addOptionPane(new ToolBarOptionPane(), jEditGroup);
 57		addOptionPane(new PrintOptionPane(), jEditGroup);
 58		addOptionPane(new FirewallOptionPane(), jEditGroup);
 59
 60		OptionGroup browserGroup = new OptionGroup("browser");
 61		addOptionPane(new BrowserOptionPane(), browserGroup);
 62		addOptionPane(new BrowserColorsOptionPane(), browserGroup);
 63		addOptionGroup(browserGroup, jEditGroup);
 64
 65		addOptionGroup(jEditGroup, rootGroup);
 66
 67		// initialize the Plugins branch of the options tree
 68		pluginsGroup = new OptionGroup("plugins");
 69
 70		// Query plugins for option panes
 71		EditPlugin[] plugins = jEdit.getPlugins();
 72		for(int i = 0; i < plugins.length; i++)
 73		{
 74			EditPlugin ep = plugins[i];
 75			try
 76			{
 77				ep.createOptionPanes(this);
 78			}
 79			catch(Throwable t)
 80			{
 81				Log.log(Log.ERROR, ep,
 82					"Error creating option pane");
 83				Log.log(Log.ERROR, ep, t);
 84			}
 85		}
 86
 87		// only add the Plugins branch if there are OptionPanes
 88		if (pluginsGroup.getMemberCount() > 0)
 89		{
 90			addOptionGroup(pluginsGroup, rootGroup);
 91		}
 92
 93		return paneTreeModel;
 94	}
 95
 96	protected OptionGroup getDefaultGroup()
 97	{
 98		return pluginsGroup;
 99	}
100
101	private OptionGroup jEditGroup;
102	private OptionGroup pluginsGroup;
103}