PageRenderTime 39ms CodeModel.GetById 34ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/org/gjt/sp/jedit/options/GlobalOptions.java

#
Java | 108 lines | 66 code | 11 blank | 31 comment | 2 complexity | b50d818cb7115e51c20dd211afcc6457 MD5 | raw file
  1/*
  2 * GlobalOptions.java - Global options dialog
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 2002 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 java.awt.Dialog;
 27import java.awt.Frame;
 28import org.gjt.sp.jedit.gui.OptionsDialog;
 29import org.gjt.sp.jedit.msg.PropertiesChanging;
 30import org.gjt.sp.jedit.*;
 31//}}}
 32
 33public class GlobalOptions extends OptionsDialog
 34{
 35	//{{{ GlobalOptions constructor
 36	public GlobalOptions(Frame frame)
 37	{
 38		super(frame,"options",jEdit.getProperty("options.last"));
 39	} //}}}
 40
 41	//{{{ GlobalOptions constructor
 42	public GlobalOptions(Frame frame, String pane)
 43	{
 44		super(frame,"options",pane);
 45	} //}}}
 46
 47	//{{{ GlobalOptions constructor
 48	public GlobalOptions(Dialog dialog)
 49	{
 50		super(dialog,"options",jEdit.getProperty("options.last"));
 51	} //}}}
 52
 53	//{{{ GlobalOptions constructor
 54	public GlobalOptions(Dialog dialog, String pane)
 55	{
 56		super(dialog,"options",pane);
 57	} //}}}
 58
 59	//{{{ createOptionTreeModel() method
 60	@Override
 61	protected OptionTreeModel createOptionTreeModel()
 62	{
 63		OptionTreeModel paneTreeModel = new OptionTreeModel();
 64		OptionGroup rootGroup = (OptionGroup) paneTreeModel.getRoot();
 65
 66		String optionGroups = jEdit.getProperty("options.groups");
 67		String[] groups = optionGroups.split(" ");
 68		for (String group : groups)
 69		{
 70			OptionGroup optionGroup = new OptionGroup(group);
 71			String optionPanes = jEdit.getProperty("options.group." + group);
 72			String[] panes = optionPanes.split(" ");
 73			for (String pane : panes)
 74			{
 75				optionGroup.addOptionPane(pane);
 76			}
 77			rootGroup.addOptionGroup(optionGroup);
 78		}
 79		return paneTreeModel;
 80	} //}}}
 81
 82	//{{{ cancel() method
 83	@Override
 84	public void cancel()
 85	{
 86		EditBus.send(
 87			new PropertiesChanging(null,
 88				PropertiesChanging.State.CANCELED));
 89		super.cancel();
 90	} //}}}
 91
 92	//{{{ init() method
 93	@Override
 94	protected void init(String name, String pane)
 95	{
 96		EditBus.send(
 97			new PropertiesChanging(null,
 98				PropertiesChanging.State.LOADING));
 99		super.init(name, pane);
100	} //}}}
101
102	//{{{ getDefaultGroup() method
103	@Override
104	protected OptionGroup getDefaultGroup()
105	{
106		return null;
107	} //}}}
108}