Example usage for weka.gui.beans PluginManager addFromProperties

List of usage examples for weka.gui.beans PluginManager addFromProperties

Introduction

In this page you can find the example usage for weka.gui.beans PluginManager addFromProperties.

Prototype

public static synchronized void addFromProperties(Properties props) throws Exception 

Source Link

Document

Add all key value pairs from the supplied properties object

Usage

From source file:meka.gui.goe.GenericObjectEditor.java

License:Open Source License

public static void determineAllClasses() {
    weka.gui.GenericObjectEditor.determineClasses();
    try {/*from  w  ww.  j  av a 2 s  .  c  o  m*/
        GenericPropertiesCreator creator = new GenericPropertiesCreator();
        try {
            creator.execute(false);
            MEKA_EDITOR_PROPERTIES = creator.getOutputProperties();
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null,
                    "Could not determine the properties for the generic object\n"
                            + "editor. This exception was produced:\n" + e.toString(),
                    "MEKA GenericObjectEditor", JOptionPane.ERROR_MESSAGE);
        }

        if (MEKA_EDITOR_PROPERTIES == null) {
            JOptionPane.showMessageDialog(null, "Could not initialize the MEKA GenericPropertiesCreator. ",
                    "MEKA GenericObjectEditor", JOptionPane.ERROR_MESSAGE);
        } else {
            PluginManager.addFromProperties(MEKA_EDITOR_PROPERTIES);
            Enumeration<String> keys = (Enumeration<String>) MEKA_EDITOR_PROPERTIES.propertyNames();
            while (keys.hasMoreElements()) {
                String key = keys.nextElement();
                // merged property?
                if (EDITOR_PROPERTIES.containsKey(key))
                    EDITOR_PROPERTIES.setProperty(key,
                            EDITOR_PROPERTIES.getProperty(key) + "," + MEKA_EDITOR_PROPERTIES.getProperty(key));
                else
                    EDITOR_PROPERTIES.setProperty(key, MEKA_EDITOR_PROPERTIES.getProperty(key));
            }
        }
    } catch (Exception e) {
        JOptionPane.showMessageDialog(
                null, "Could not initialize the MEKA GenericPropertiesCreator. "
                        + "This exception was produced:\n" + e.toString(),
                "MEKA GenericObjectEditor", JOptionPane.ERROR_MESSAGE);
    }
    if (DEBUG)
        System.out.println("start<GenericObjectEditor.determineAllClasses()>\n"
                + PropsUtils.toString(EDITOR_PROPERTIES, null)
                + "end<GenericObjectEditor.determineAllClasses()>\n");
}