@Override protected void onExit() { final XmlNode root = configurer.getRoot(); root.removeChildren(ConfigAnimations.ANIMATION); for (final TreeItem item : animationList.getTree().getItems()) { final Animation animation = (Animation) item.getData(); final XmlNode nodeAnim = ConfigAnimations.createNode(animation); root.add(nodeAnim); } configurer.save(); }
@Override public void notifyObjectDeleted(TileGroup group) { final MapTile map = WorldViewModel.INSTANCE.getMap(); final Media config = map.getGroupsConfig(); final XmlNode node = Stream.loadXml(config); final Collection<XmlNode> toRemove = new ArrayList<>(); for (final XmlNode nodeGroup : node.getChildren(ConfigTileGroup.GROUP)) { if (WorldViewRenderer.groupEquals( nodeGroup.readString(ConfigTileGroup.NAME), group.getName())) { toRemove.add(nodeGroup); } } for (final XmlNode remove : toRemove) { node.removeChild(remove); } toRemove.clear(); Stream.saveXml(node, config); map.loadGroups(config); }