Search in sources :

Example 1 with StartupActionModelUtil

use of apps.startup.StartupActionModelUtil in project JMRI by JMRI.

the class AbstractSerialConnectionConfig method addToActionList.

protected final void addToActionList() {
    StartupActionModelUtil util = InstanceManager.getNullableDefault(StartupActionModelUtil.class);
    ResourceBundle bundle = getActionModelResourceBundle();
    if (bundle == null || util == null) {
        return;
    }
    Enumeration<String> e = bundle.getKeys();
    while (e.hasMoreElements()) {
        String key = e.nextElement();
        try {
            util.addAction(key, bundle.getString(key));
        } catch (ClassNotFoundException ex) {
            log.error("Did not find class \"{}\"", key);
        }
    }
}
Also used : ResourceBundle(java.util.ResourceBundle) StartupActionModelUtil(apps.startup.StartupActionModelUtil)

Example 2 with StartupActionModelUtil

use of apps.startup.StartupActionModelUtil in project JMRI by JMRI.

the class AbstractSerialConnectionConfig method removeFromActionList.

protected void removeFromActionList() {
    StartupActionModelUtil util = InstanceManager.getNullableDefault(StartupActionModelUtil.class);
    ResourceBundle bundle = getActionModelResourceBundle();
    if (bundle == null || util == null) {
        return;
    }
    Enumeration<String> e = bundle.getKeys();
    while (e.hasMoreElements()) {
        String key = e.nextElement();
        try {
            util.removeAction(key);
        } catch (ClassNotFoundException ex) {
            log.error("Did not find class \"{}\"", key);
        }
    }
}
Also used : ResourceBundle(java.util.ResourceBundle) StartupActionModelUtil(apps.startup.StartupActionModelUtil)

Example 3 with StartupActionModelUtil

use of apps.startup.StartupActionModelUtil in project JMRI by JMRI.

the class SystemConnectionMemo method removeFromActionList.

protected final void removeFromActionList() {
    StartupActionModelUtil util = StartupActionModelUtil.getDefault();
    ResourceBundle rb = getActionModelResourceBundle();
    if (rb == null) {
        // don't bother trying if there is no ActionModelResourceBundle
        return;
    }
    log.debug("Removing actions from bundle {}", rb.getBaseBundleName());
    Enumeration<String> e = rb.getKeys();
    while (e.hasMoreElements()) {
        String key = e.nextElement();
        try {
            util.removeAction(key);
        } catch (ClassNotFoundException ex) {
            log.error("Did not find class \"{}\"", key);
        }
    }
}
Also used : ResourceBundle(java.util.ResourceBundle) StartupActionModelUtil(apps.startup.StartupActionModelUtil)

Example 4 with StartupActionModelUtil

use of apps.startup.StartupActionModelUtil in project JMRI by JMRI.

the class SystemConnectionMemo method addToActionList.

protected final void addToActionList() {
    StartupActionModelUtil util = StartupActionModelUtil.getDefault();
    ResourceBundle rb = getActionModelResourceBundle();
    if (rb == null) {
        // don't bother trying if there is no ActionModelResourceBundle
        return;
    }
    log.debug("Adding actions from bundle {}", rb.getBaseBundleName());
    Enumeration<String> e = rb.getKeys();
    while (e.hasMoreElements()) {
        String key = e.nextElement();
        try {
            util.addAction(key, rb.getString(key));
        } catch (ClassNotFoundException ex) {
            log.error("Did not find class \"{}\"", key);
        }
    }
}
Also used : ResourceBundle(java.util.ResourceBundle) StartupActionModelUtil(apps.startup.StartupActionModelUtil)

Aggregations

StartupActionModelUtil (apps.startup.StartupActionModelUtil)4 ResourceBundle (java.util.ResourceBundle)4