private void updateTreeNode() {
mRootNode.removeAllChildren();
mRootNode.removeAllActions();
for (Object o : mConfig.getDevices()) {
final DeviceIf device = (DeviceIf) o;
PluginTreeNode node;
if (mConfig.getDevices().size() > 1) {
node = new PluginTreeNode(device.getName());
mRootNode.add(node);
}
else {
node = mRootNode;
}
if(device.isAbleToAddAndRemovePrograms()) {
node.getMutableTreeNode().setProgramReceiveTarget(new ProgramReceiveTarget(this, device.getName() + " - " + mLocalizer.msg("record", "record"), device.getId() + RECORD));
}
Program[] programs = device.getProgramList();
if (programs != null) {
for (Program program : programs) {
node.addProgram(program);
}
}
node.addAction(new AbstractAction(mLocalizer.msg("configure", "Configure '{0}'", device.getName())) {
@Override
public void actionPerformed(ActionEvent e) {
device.configDevice(UiUtilities.getBestDialogParent(getParentFrame()));
updateTreeNode();
}
});
}