Search in sources :

Example 1 with DefaultLogixManager

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

the class DefaultLogixManagerXml method replaceLogixManager.

/**
     * Replace the current LogixManager, 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 replaceLogixManager() {
    if (InstanceManager.getDefault(jmri.LogixManager.class).getClass().getName().equals(DefaultLogixManager.class.getName())) {
        return;
    }
    // if old manager exists, remove it from configuration process
    if (InstanceManager.getNullableDefault(jmri.LogixManager.class) != null) {
        ConfigureManager cmOD = InstanceManager.getNullableDefault(jmri.ConfigureManager.class);
        if (cmOD != null) {
            cmOD.deregister(InstanceManager.getDefault(jmri.LogixManager.class));
        }
    }
    // register new one with InstanceManager
    DefaultLogixManager pManager = DefaultLogixManager.instance();
    InstanceManager.store(pManager, LogixManager.class);
    // register new one for configuration
    ConfigureManager cmOD = InstanceManager.getNullableDefault(jmri.ConfigureManager.class);
    if (cmOD != null) {
        cmOD.registerConfig(pManager, jmri.Manager.LOGIXS);
    }
}
Also used : ConfigureManager(jmri.ConfigureManager) DefaultLogixManager(jmri.managers.DefaultLogixManager) LogixManager(jmri.LogixManager) DefaultLogixManager(jmri.managers.DefaultLogixManager)

Aggregations

ConfigureManager (jmri.ConfigureManager)1 LogixManager (jmri.LogixManager)1 DefaultLogixManager (jmri.managers.DefaultLogixManager)1