PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. package org.gjt.sp.jedit.options;
  20. import org.gjt.sp.jedit.gui.OptionsDialog;
  21. import org.gjt.sp.jedit.options.*;
  22. import org.gjt.sp.jedit.*;
  23. import org.gjt.sp.util.Log;
  24. public class GlobalOptions extends OptionsDialog
  25. {
  26. public GlobalOptions(View view)
  27. {
  28. super(view,"options");
  29. }
  30. protected OptionTreeModel createOptionTreeModel()
  31. {
  32. OptionTreeModel paneTreeModel = new OptionTreeModel();
  33. OptionGroup rootGroup = (OptionGroup) paneTreeModel.getRoot();
  34. addOptionPane(new OverviewOptionPane(), rootGroup);
  35. // initialize the jEdit branch of the options tree
  36. jEditGroup = new OptionGroup("jedit");
  37. addOptionPane(new GeneralOptionPane(), jEditGroup);
  38. addOptionPane(new AppearanceOptionPane(), jEditGroup);
  39. addOptionPane(new TextAreaOptionPane(), jEditGroup);
  40. addOptionPane(new GutterOptionPane(), jEditGroup);
  41. addOptionPane(new SyntaxHiliteOptionPane(), jEditGroup);
  42. addOptionPane(new LoadSaveOptionPane(), jEditGroup);
  43. addOptionPane(new EditingOptionPane(), jEditGroup);
  44. addOptionPane(new ModeOptionPane(), jEditGroup);
  45. addOptionPane(new AbbrevsOptionPane(), jEditGroup);
  46. addOptionPane(new ShortcutsOptionPane(), jEditGroup);
  47. addOptionPane(new DockingOptionPane(), jEditGroup);
  48. addOptionPane(new ContextOptionPane(), jEditGroup);
  49. addOptionPane(new ToolBarOptionPane(), jEditGroup);
  50. addOptionPane(new PrintOptionPane(), jEditGroup);
  51. addOptionPane(new FirewallOptionPane(), jEditGroup);
  52. OptionGroup browserGroup = new OptionGroup("browser");
  53. addOptionPane(new BrowserOptionPane(), browserGroup);
  54. addOptionPane(new BrowserColorsOptionPane(), browserGroup);
  55. addOptionGroup(browserGroup, jEditGroup);
  56. addOptionGroup(jEditGroup, rootGroup);
  57. // initialize the Plugins branch of the options tree
  58. pluginsGroup = new OptionGroup("plugins");
  59. // Query plugins for option panes
  60. EditPlugin[] plugins = jEdit.getPlugins();
  61. for(int i = 0; i < plugins.length; i++)
  62. {
  63. EditPlugin ep = plugins[i];
  64. try
  65. {
  66. ep.createOptionPanes(this);
  67. }
  68. catch(Throwable t)
  69. {
  70. Log.log(Log.ERROR, ep,
  71. "Error creating option pane");
  72. Log.log(Log.ERROR, ep, t);
  73. }
  74. }
  75. // only add the Plugins branch if there are OptionPanes
  76. if (pluginsGroup.getMemberCount() > 0)
  77. {
  78. addOptionGroup(pluginsGroup, rootGroup);
  79. }
  80. return paneTreeModel;
  81. }
  82. protected OptionGroup getDefaultGroup()
  83. {
  84. return pluginsGroup;
  85. }
  86. private OptionGroup jEditGroup;
  87. private OptionGroup pluginsGroup;
  88. }