1 22 23 package org.gjt.sp.jedit.options; 24 25 import java.awt.Dialog ; 27 import java.awt.Frame ; 28 import org.gjt.sp.jedit.gui.OptionsDialog; 29 import org.gjt.sp.jedit.options.*; 30 import org.gjt.sp.jedit.*; 31 import org.gjt.sp.util.Log; 32 34 public class PluginOptions extends OptionsDialog 35 { 36 public PluginOptions(Frame frame) 38 { 39 super(frame,"plugin-options",jEdit.getProperty("plugin-options.last")); 40 } 42 public PluginOptions(Frame frame, String pane) 44 { 45 super(frame,"plugin-options",pane); 46 } 48 public PluginOptions(Dialog dialog) 50 { 51 super(dialog,"plugin-options",jEdit.getProperty("plugin-options.last")); 52 } 54 public PluginOptions(Dialog dialog, String pane) 56 { 57 super(dialog,"plugin-options",pane); 58 } 60 protected OptionTreeModel createOptionTreeModel() 62 { 63 OptionTreeModel paneTreeModel = new OptionTreeModel(); 64 OptionGroup rootGroup = (OptionGroup) paneTreeModel.getRoot(); 65 66 pluginsGroup = new OptionGroup("plugins"); 68 pluginsGroup.setSort(true); 69 70 EditPlugin[] plugins = jEdit.getPlugins(); 72 for(int i = 0; i < plugins.length; i++) 73 { 74 EditPlugin ep = plugins[i]; 75 if(ep instanceof EditPlugin.Broken) 76 continue; 77 78 String className = ep.getClassName(); 79 if(jEdit.getProperty("plugin." + className + ".activate") == null) 80 { 81 try 83 { 84 ep.createOptionPanes(this); 85 } 86 catch(Throwable t) 87 { 88 Log.log(Log.ERROR, ep, 89 "Error creating option pane"); 90 Log.log(Log.ERROR, ep, t); 91 } 92 } 93 else 94 { 95 String optionPane = jEdit.getProperty( 96 "plugin." + className + ".option-pane"); 97 if(optionPane != null) 98 pluginsGroup.addOptionPane(optionPane); 99 else 100 { 101 String options = jEdit.getProperty( 102 "plugin." + className 103 + ".option-group"); 104 if(options != null) 105 { 106 pluginsGroup.addOptionGroup( 107 new OptionGroup( 108 "plugin." + className, 109 jEdit.getProperty("plugin." 110 + className + ".name"), 111 options) 112 ); 113 } 114 } 115 } 116 } 117 118 if (pluginsGroup.getMemberCount() == 0) 120 pluginsGroup.addOptionPane(new NoPluginsPane()); 121 122 rootGroup.addOptionGroup(pluginsGroup); 123 124 return paneTreeModel; 125 } 127 protected OptionGroup getDefaultGroup() 129 { 130 return pluginsGroup; 131 } 133 private OptionGroup pluginsGroup; 135 137 public static class NoPluginsPane extends AbstractOptionPane 139 { 140 public NoPluginsPane() 141 { 142 super("no-plugins"); 143 } 144 } } 146 | Popular Tags |