[jsword-svn] r1771 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book bibledesktop/src/main/java/org/crosswire/bibledesktop/display common/src/main/java/org/crosswire/common/config common/src/main/java/org/crosswire/common/util common/src/main/java/org/crosswire/common/xml common-swing/src/main/java/org/crosswire/common/config/swing jsword-limbo/src/main/java/org/crosswire/jsword/book/search
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Fri Mar 7 19:29:57 MST 2008
Author: dmsmith
Date: 2008-03-07 19:29:56 -0700 (Fri, 07 Mar 2008)
New Revision: 1771
Added:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.plugin
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.plugin
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.plugin
trunk/common/src/main/java/org/crosswire/common/config/Choice.plugin
trunk/common/src/main/java/org/crosswire/common/util/PluginUtil.java
trunk/common/src/main/java/org/crosswire/common/xml/Converter.plugin
trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.plugin
Removed:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.properties
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.properties
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.properties
trunk/common/src/main/java/org/crosswire/common/config/Choice.properties
trunk/common/src/main/java/org/crosswire/common/xml/Converter.properties
trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.properties
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane_control.properties
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplayFactory.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditorFactory.java
trunk/common-swing/src/main/java/org/crosswire/common/config/swing/FieldMap.java
trunk/common/src/main/java/org/crosswire/common/config/ChoiceFactory.java
trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ThesaurusFactory.java
Log:
Changed plugin model to be more explicit.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2008-03-08 02:29:56 UTC (rev 1771)
@@ -34,7 +34,6 @@
import java.io.IOException;
import java.io.ObjectInputStream;
-import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
@@ -179,7 +178,6 @@
}
});
btnKey = new JButton(actions.getAction(MORE));
- btnKey.setIcon(ICON_SELECT);
btnKeyGo = new JButton(actions.getAction(GO_PASSAGE));
txtSearch = new JTextField();
@@ -201,15 +199,15 @@
this.add(lblKey, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
this.add(txtKey, new GridBagConstraints(2, 1, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 1, 2), 0, 0));
- this.add(btnKey, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 2), 0, 0));
- this.add(btnKeyGo, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ this.add(btnKeyGo, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ this.add(btnKey, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 2), 0, 0));
this.add(btnHelp, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
this.add(lblSearch, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
this.add(btnIndex, new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 0, 2, 2), 0, 0));
this.add(txtSearch, new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 3, 2), 0, 0));
- this.add(btnAdvanced, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 2), 0, 0));
- this.add(btnSearch, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ this.add(btnSearch, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ this.add(btnAdvanced, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 2), 0, 0));
enableComponents();
GuiUtil.applyDefaultOrientation(this);
@@ -788,8 +786,6 @@
private static final String BIBLE = "Bible"; //$NON-NLS-1$
private static final String INDEX = "Index"; //$NON-NLS-1$
- private static final ImageIcon ICON_SELECT = GuiUtil.getIcon("toolbarButtonGraphics/general/Edit16.gif"); //$NON-NLS-1$
-
/**
* Keep the selection up to date with indexing.
*/
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane_control.properties
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane_control.properties 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane_control.properties 2008-03-08 02:29:56 UTC (rev 1771)
@@ -1,4 +1,2 @@
HelpAction.SmallIcon=toolbarButtonGraphics/general/ContextualHelp16.gif
HelpAction.LargeIcon=toolbarButtonGraphics/general/ContextualHelp24.gif
-Advanced.SmallIcon=toolbarButtonGraphics/general/Find16.gif
-Advanced.LargeIcon=toolbarButtonGraphics/general/Find24.gif
Copied: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.plugin (from rev 1768, trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.properties)
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.plugin (rev 0)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.plugin 2008-03-08 02:29:56 UTC (rev 1771)
@@ -0,0 +1,3 @@
+
+default=org.crosswire.bibledesktop.display.basic.TextPaneBookDataDisplay
+#default=org.crosswire.bibledesktop.display.jdtb.JDTBBookDataDisplay
Deleted: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.properties
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.properties 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.properties 2008-03-08 02:29:56 UTC (rev 1771)
@@ -1,3 +0,0 @@
-
-default=org.crosswire.bibledesktop.display.basic.TextPaneBookDataDisplay
-#default=org.crosswire.bibledesktop.display.jdtb.JDTBBookDataDisplay
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplayFactory.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplayFactory.java 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplayFactory.java 2008-03-08 02:29:56 UTC (rev 1771)
@@ -23,7 +23,7 @@
import java.io.IOException;
-import org.crosswire.common.util.ClassUtil;
+import org.crosswire.common.util.PluginUtil;
/**
* Factory for OSIS renderers.
@@ -49,7 +49,7 @@
Exception ex = null;
try
{
- return (BookDataDisplay) ClassUtil.getImplementation(BookDataDisplay.class);
+ return (BookDataDisplay) PluginUtil.getImplementation(BookDataDisplay.class);
}
catch (ClassCastException e)
{
Copied: trunk/common/src/main/java/org/crosswire/common/config/Choice.plugin (from rev 1767, trunk/common/src/main/java/org/crosswire/common/config/Choice.properties)
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/Choice.plugin (rev 0)
+++ trunk/common/src/main/java/org/crosswire/common/config/Choice.plugin 2008-03-08 02:29:56 UTC (rev 1771)
@@ -0,0 +1,13 @@
+string=org.crosswire.common.config.StringChoice
+password=org.crosswire.common.config.StringChoice
+boolean=org.crosswire.common.config.BooleanChoice
+int-options=org.crosswire.common.config.IntOptionsChoice
+map-options=org.crosswire.common.config.MappedOptionsChoice
+string-options=org.crosswire.common.config.StringOptionsChoice
+string-array=org.crosswire.common.config.StringArrayChoice
+file=org.crosswire.common.config.FileChoice
+path=org.crosswire.common.config.PathChoice
+directory=org.crosswire.common.config.DirectoryChoice
+number=org.crosswire.common.config.NumberChoice
+font=org.crosswire.common.config.FontChoice
+class=org.crosswire.common.config.ClassChoice
Deleted: trunk/common/src/main/java/org/crosswire/common/config/Choice.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/Choice.properties 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/common/src/main/java/org/crosswire/common/config/Choice.properties 2008-03-08 02:29:56 UTC (rev 1771)
@@ -1,13 +0,0 @@
-string=org.crosswire.common.config.StringChoice
-password=org.crosswire.common.config.StringChoice
-boolean=org.crosswire.common.config.BooleanChoice
-int-options=org.crosswire.common.config.IntOptionsChoice
-map-options=org.crosswire.common.config.MappedOptionsChoice
-string-options=org.crosswire.common.config.StringOptionsChoice
-string-array=org.crosswire.common.config.StringArrayChoice
-file=org.crosswire.common.config.FileChoice
-path=org.crosswire.common.config.PathChoice
-directory=org.crosswire.common.config.DirectoryChoice
-number=org.crosswire.common.config.NumberChoice
-font=org.crosswire.common.config.FontChoice
-class=org.crosswire.common.config.ClassChoice
Modified: trunk/common/src/main/java/org/crosswire/common/config/ChoiceFactory.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/ChoiceFactory.java 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/common/src/main/java/org/crosswire/common/config/ChoiceFactory.java 2008-03-08 02:29:56 UTC (rev 1771)
@@ -25,7 +25,7 @@
import java.util.Map;
import java.util.ResourceBundle;
-import org.crosswire.common.util.ClassUtil;
+import org.crosswire.common.util.PluginUtil;
import org.jdom.Element;
/**
@@ -92,6 +92,6 @@
*/
static
{
- map = ClassUtil.getImplementorsMap(Choice.class);
+ map = PluginUtil.getImplementorsMap(Choice.class);
}
}
Added: trunk/common/src/main/java/org/crosswire/common/util/PluginUtil.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/util/PluginUtil.java (rev 0)
+++ trunk/common/src/main/java/org/crosswire/common/util/PluginUtil.java 2008-03-08 02:29:56 UTC (rev 1771)
@@ -0,0 +1,235 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2008
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: PluginUtil.java 1505 2007-07-21 19:40:19Z dmsmith $
+ */
+package org.crosswire.common.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Properties;
+
+/**
+ * A plugin maps one or more implementations to an interface
+ * or abstract class via a properties file whose suffix is "plugin".
+ * When there is more than one implementation, one is marked as a default.
+ *
+ * @see gnu.lgpl.License for license details.<br>
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public final class PluginUtil
+{
+ /**
+ * Prevent instantiation
+ */
+ private PluginUtil()
+ {
+ }
+
+ /**
+ * Get the known implementors of some interface or abstract class.
+ * This is currently done by looking up a plugin file by the name of
+ * the given class, and assuming that values are implementors of said
+ * class. Those that are not are warned, but ignored.
+ * @param clazz The class or interface to find implementors of.
+ * @return The list of implementing classes.
+ */
+ public static Class[] getImplementors(Class clazz)
+ {
+ try
+ {
+ List matches = new ArrayList();
+ Properties props = getPlugin(clazz);
+ Iterator it = props.values().iterator();
+ while (it.hasNext())
+ {
+ try
+ {
+ String name = (String) it.next();
+ Class impl = Class.forName(name);
+ if (clazz.isAssignableFrom(impl))
+ {
+ matches.add(impl);
+ }
+ else
+ {
+ log.warn("Class " + impl.getName() + " does not implement " + clazz.getName() + ". Ignoring."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Failed to add class to list: " + clazz.getName(), ex); //$NON-NLS-1$
+ }
+ }
+
+ log.debug("Found " + matches.size() + " implementors of " + clazz.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ return (Class[]) matches.toArray(new Class[matches.size()]);
+ }
+ catch (IOException ex)
+ {
+ log.error("Failed to get any classes.", ex); //$NON-NLS-1$
+ return new Class[0];
+ }
+ }
+
+ /**
+ * Get a map of known implementors of some interface or abstract class.
+ * This is currently done by looking up a plugins file by the name of
+ * the given class, and assuming that values are implementors of said
+ * class. Those that are not are warned, but ignored. The reply is in the
+ * form of a map of keys=strings, and values=classes in case you need to get
+ * at the names given to the classes in the plugin file.
+ * @see PluginUtil#getImplementors(Class)
+ * @param clazz The class or interface to find implementors of.
+ * @return The map of implementing classes.
+ */
+ public static Map getImplementorsMap(Class clazz)
+ {
+ Map matches = new HashMap();
+
+ try
+ {
+ Properties props = getPlugin(clazz);
+ Iterator it = props.keySet().iterator();
+ while (it.hasNext())
+ {
+ try
+ {
+ String key = (String) it.next();
+ String value = props.getProperty(key);
+ Class impl = Class.forName(value);
+ if (clazz.isAssignableFrom(impl))
+ {
+ matches.put(key, impl);
+ }
+ else
+ {
+ log.warn("Class " + impl.getName() + " does not implement " + clazz.getName() + ". Ignoring."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ log.warn("Failed to add class to list: " + clazz.getName(), ex); //$NON-NLS-1$
+ }
+ }
+
+ log.debug("Found " + matches.size() + " implementors of " + clazz.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ catch (IOException ex)
+ {
+ log.error("Failed to get any classes.", ex); //$NON-NLS-1$
+ }
+
+ return matches;
+ }
+
+ /**
+ * Get the preferred implementor of some interface or abstract class.
+ * This is currently done by looking up a plugins file by the name of
+ * the given class, and assuming that the "default" key is an implementation
+ * of said class. Warnings are given otherwise.
+ * @param clazz The class or interface to find an implementation of.
+ * @return The configured implementing class.
+ * @throws MalformedURLException if the plugin file can not be found
+ * @throws IOException if there is a problem reading the found file
+ * @throws ClassNotFoundException if the read contents are not found
+ * @throws ClassCastException if the read contents are not valid
+ * @see PluginUtil#getImplementors(Class)
+ */
+ public static Class getImplementor(Class clazz) throws IOException, ClassNotFoundException, ClassCastException
+ {
+ Properties props = getPlugin(clazz);
+ String name = props.getProperty(DEFAULT);
+
+ Class impl = Class.forName(name);
+ if (!clazz.isAssignableFrom(impl))
+ {
+ throw new ClassCastException(Msg.NOT_ASSIGNABLE.toString(new Object[] { impl.getName(), clazz.getName() }));
+ }
+
+ return impl;
+ }
+
+ /**
+ * Get and instantiate the preferred implementor of some interface or abstract class.
+ * @param clazz The class or interface to find an implementation of.
+ * @return The configured implementing class.
+ * @throws MalformedURLException if the plugin file can not be found
+ * @throws IOException if there is a problem reading the found file
+ * @throws ClassNotFoundException if the read contents are not found
+ * @throws ClassCastException if the read contents are not valid
+ * @throws InstantiationException if the new object can not be instantiated
+ * @throws IllegalAccessException if the new object can not be instantiated
+ * @see PluginUtil#getImplementors(Class)
+ */
+ public static Object getImplementation(Class clazz) throws MalformedURLException, ClassCastException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
+ {
+ return getImplementor(clazz).newInstance();
+ }
+
+ /**
+ * Get and load a plugin file by looking it up as a resource.
+ * @param clazz The name of the desired resource
+ * @return The found and loaded plugin file
+ * @throws IOException if the resource can not be loaded
+ * @throws MissingResourceException if the resource can not be found
+ */
+ private static Properties getPlugin(Class clazz) throws IOException
+ {
+ String subject = ClassUtil.getShortClassName(clazz);
+
+ try
+ {
+ String lookup = subject + PluginUtil.EXTENSION_PLUGIN;
+ InputStream in = ResourceUtil.getResourceAsStream(clazz, lookup);
+
+ Properties prop = new Properties();
+ prop.load(in);
+ return prop;
+ }
+ catch (MissingResourceException e)
+ {
+ return new Properties();
+ }
+ }
+
+ /**
+ * Extension for properties files
+ */
+ public static final String EXTENSION_PLUGIN = ".plugin"; //$NON-NLS-1$
+
+ /**
+ * The string for default implementations
+ */
+ private static final String DEFAULT = "default"; //$NON-NLS-1$
+
+ /**
+ * The log stream
+ */
+ private static final Logger log = Logger.getLogger(PluginUtil.class);
+
+}
Copied: trunk/common/src/main/java/org/crosswire/common/xml/Converter.plugin (from rev 1767, trunk/common/src/main/java/org/crosswire/common/xml/Converter.properties)
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/Converter.plugin (rev 0)
+++ trunk/common/src/main/java/org/crosswire/common/xml/Converter.plugin 2008-03-08 02:29:56 UTC (rev 1771)
@@ -0,0 +1,5 @@
+# see org.crosswire.jsword.util.ConverterFactory which has a hardcoded
+# default from this list. There might be a better way to do this?
+Configurable=org.crosswire.bibledesktop.util.ConfigurableSwingConverter
+
+#web=org.crosswire.jsword.view.web.util.SimpleWebConverter
Deleted: trunk/common/src/main/java/org/crosswire/common/xml/Converter.properties
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/xml/Converter.properties 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/common/src/main/java/org/crosswire/common/xml/Converter.properties 2008-03-08 02:29:56 UTC (rev 1771)
@@ -1,5 +0,0 @@
-# see org.crosswire.jsword.util.ConverterFactory which has a hardcoded
-# default from this list. There might be a better way to do this?
-Configurable=org.crosswire.bibledesktop.util.ConfigurableSwingConverter
-
-#web=org.crosswire.jsword.view.web.util.SimpleWebConverter
Copied: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.plugin (from rev 1766, trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.properties)
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.plugin (rev 0)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.plugin 2008-03-08 02:29:56 UTC (rev 1771)
@@ -0,0 +1,2 @@
+
+default=org.crosswire.common.config.swing.TreeConfigEditor
Deleted: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.properties
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.properties 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditor.properties 2008-03-08 02:29:56 UTC (rev 1771)
@@ -1,2 +0,0 @@
-
-default=org.crosswire.common.config.swing.TreeConfigEditor
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditorFactory.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditorFactory.java 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/ConfigEditorFactory.java 2008-03-08 02:29:56 UTC (rev 1771)
@@ -28,8 +28,8 @@
import java.net.URI;
import org.crosswire.common.config.Config;
-import org.crosswire.common.util.ClassUtil;
import org.crosswire.common.util.LucidRuntimeException;
+import org.crosswire.common.util.PluginUtil;
import org.crosswire.common.util.Reporter;
/**
@@ -61,7 +61,7 @@
Exception ex = null;
try
{
- ConfigEditor base = (ConfigEditor) ClassUtil.getImplementation(ConfigEditor.class);
+ ConfigEditor base = (ConfigEditor) PluginUtil.getImplementation(ConfigEditor.class);
base.construct(config);
base.showDialog(parent, al);
}
Copied: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.plugin (from rev 1766, trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.properties)
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.plugin (rev 0)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.plugin 2008-03-08 02:29:56 UTC (rev 1771)
@@ -0,0 +1,13 @@
+string=org.crosswire.common.config.swing.TextField
+password=org.crosswire.common.config.swing.PasswordField
+boolean=org.crosswire.common.config.swing.BooleanField
+int-options=org.crosswire.common.config.swing.MappedOptionsField
+map-options=org.crosswire.common.config.swing.MappedOptionsField
+string-options=org.crosswire.common.config.swing.StringArrayField
+string-array=org.crosswire.common.config.swing.StringArrayField
+file=org.crosswire.common.config.swing.FileField
+path=org.crosswire.common.config.swing.PathField
+directory=org.crosswire.common.config.swing.DirectoryField
+number=org.crosswire.common.config.swing.NumberField
+font=org.crosswire.common.config.swing.FontField
+class=org.crosswire.common.config.swing.TextField
Deleted: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.properties
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.properties 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/Field.properties 2008-03-08 02:29:56 UTC (rev 1771)
@@ -1,13 +0,0 @@
-string=org.crosswire.common.config.swing.TextField
-password=org.crosswire.common.config.swing.PasswordField
-boolean=org.crosswire.common.config.swing.BooleanField
-int-options=org.crosswire.common.config.swing.MappedOptionsField
-map-options=org.crosswire.common.config.swing.MappedOptionsField
-string-options=org.crosswire.common.config.swing.StringArrayField
-string-array=org.crosswire.common.config.swing.StringArrayField
-file=org.crosswire.common.config.swing.FileField
-path=org.crosswire.common.config.swing.PathField
-directory=org.crosswire.common.config.swing.DirectoryField
-number=org.crosswire.common.config.swing.NumberField
-font=org.crosswire.common.config.swing.FontField
-class=org.crosswire.common.config.swing.TextField
Modified: trunk/common-swing/src/main/java/org/crosswire/common/config/swing/FieldMap.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/config/swing/FieldMap.java 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/common-swing/src/main/java/org/crosswire/common/config/swing/FieldMap.java 2008-03-08 02:29:56 UTC (rev 1771)
@@ -25,8 +25,8 @@
import org.crosswire.common.config.Choice;
import org.crosswire.common.config.MultipleChoice;
-import org.crosswire.common.util.ClassUtil;
import org.crosswire.common.util.Logger;
+import org.crosswire.common.util.PluginUtil;
import org.crosswire.common.util.Reporter;
/**
@@ -114,7 +114,7 @@
*/
static
{
- map = ClassUtil.getImplementorsMap(Field.class);
+ map = PluginUtil.getImplementorsMap(Field.class);
}
/**
Copied: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.plugin (from rev 1765, trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.properties)
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.plugin (rev 0)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.plugin 2008-03-08 02:29:56 UTC (rev 1771)
@@ -0,0 +1,2 @@
+
+default=org.crosswire.jsword.book.search.basic.NullThesaurus
Deleted: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.properties
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.properties 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/Thesaurus.properties 2008-03-08 02:29:56 UTC (rev 1771)
@@ -1,2 +0,0 @@
-
-default=org.crosswire.jsword.book.search.basic.NullThesaurus
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ThesaurusFactory.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ThesaurusFactory.java 2008-03-07 00:42:15 UTC (rev 1770)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/search/ThesaurusFactory.java 2008-03-08 02:29:56 UTC (rev 1771)
@@ -21,8 +21,8 @@
*/
package org.crosswire.jsword.book.search;
-import org.crosswire.common.util.ClassUtil;
import org.crosswire.common.util.Logger;
+import org.crosswire.common.util.PluginUtil;
/**
* Factory method for creating a new Thesaurus.
@@ -47,10 +47,7 @@
{
try
{
- Class impl = ClassUtil.getImplementor(Thesaurus.class);
- Thesaurus thesaurus = (Thesaurus) impl.newInstance();
-
- return thesaurus;
+ return (Thesaurus) PluginUtil.getImplementation(Thesaurus.class);
}
catch (Exception ex)
{
More information about the jsword-svn
mailing list