tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.addTab("Main", ball, splitPane, "Main Commands");
tabbedPane.addTab("Get/Set", ball, propertieScrollPane, "Properties Panel");
QSAdminPluginConfig qsAdminPluginConfig = null;
PluginPanel pluginPanel = null;
//-- start of loadPlugins
try {
File xmlFile = null;
ClassLoader classLoader = null;
Class mainClass = null;
File file = new File(pluginDir);
File dirs[] = null;
if(file.canRead())
dirs = file.listFiles(new DirFileList());
for(int i=0;dirs!=null && i<dirs.length;i++) {
xmlFile = new File(dirs[i].getAbsolutePath()+
File.separator+"plugin.xml");
if(xmlFile.canRead()) {
qsAdminPluginConfig = PluginConfigReader.read(xmlFile);
if(qsAdminPluginConfig.getActive().equals("yes") &&
qsAdminPluginConfig.getType().equals("javax.swing.JPanel")) {
classLoader = ClassUtil.getClassLoaderFromJars( dirs[i].getAbsolutePath() );
mainClass = classLoader.loadClass(qsAdminPluginConfig.getMainClass());
logger.fine("Got PluginMainClass "+mainClass);
pluginPanel = (PluginPanel) mainClass.newInstance();
if( JPanel.class.isInstance(pluginPanel)==true ) {
logger.info("Loading plugin : "+qsAdminPluginConfig.getName());
pluginPanelMap.put(""+(2+i), pluginPanel);
plugins.add(pluginPanel);
tabbedPane.addTab(qsAdminPluginConfig.getName(),
ball, (JPanel)pluginPanel, qsAdminPluginConfig.getDesc());
pluginPanel.setQSAdminMain(qsadminMain);
pluginPanel.init();
}
} else {
logger.info("Plugin "+dirs[i]+" is disabled so skipping");