Search in sources :

Example 1 with DefaultConditionalManager

use of jmri.managers.DefaultConditionalManager in project JMRI by JMRI.

the class DefaultConditionalManagerXml method replaceConditionalManager.

/**
     * Replace the current ConditionalManager, if there is one, with one newly
     * created during a load operation. This is skipped if they are of the same
     * absolute type.
     */
protected void replaceConditionalManager() {
    if (InstanceManager.getDefault(jmri.ConditionalManager.class).getClass().getName().equals(DefaultConditionalManager.class.getName())) {
        return;
    }
    // if old manager exists, remove it from configuration process
    if (InstanceManager.getNullableDefault(jmri.ConditionalManager.class) != null) {
        InstanceManager.getDefault(jmri.ConfigureManager.class).deregister(InstanceManager.getDefault(jmri.ConditionalManager.class));
    }
    // register new one with InstanceManager
    DefaultConditionalManager pManager = DefaultConditionalManager.instance();
    InstanceManager.store(pManager, ConditionalManager.class);
    InstanceManager.setDefault(ConditionalManager.class, pManager);
    // register new one for configuration
    InstanceManager.getDefault(jmri.ConfigureManager.class).registerConfig(pManager, jmri.Manager.CONDITIONALS);
}
Also used : DefaultConditionalManager(jmri.managers.DefaultConditionalManager) ConditionalManager(jmri.ConditionalManager) DefaultConditionalManager(jmri.managers.DefaultConditionalManager)

Aggregations

ConditionalManager (jmri.ConditionalManager)1 DefaultConditionalManager (jmri.managers.DefaultConditionalManager)1