Add function to remove categories from a configuration, indavidual properties can be removed using ConfigCategory.remove() Closes #462

This commit is contained in:
LexManos 2013-04-04 18:09:01 -07:00
parent 814123a973
commit a44bd6dadf
2 changed files with 28 additions and 0 deletions

View File

@ -256,4 +256,14 @@ public class ConfigCategory implements Map<String, Property>
return ImmutableSet.copyOf(properties.entrySet());
}
public Set<ConfigCategory> getChildren(){ return ImmutableSet.copyOf(children); }
public void removeChild(ConfigCategory child)
{
if (children.contains(child))
{
children.remove(child);
changed = true;
}
}
}

View File

@ -771,6 +771,24 @@ public class Configuration
return ret;
}
public void removeCategory(ConfigCategory category)
{
for (ConfigCategory child : category.getChildren())
{
removeCategory(child);
}
if (categories.containsKey(category.getQualifiedName()))
{
categories.remove(category.getQualifiedName());
if (category.parent != null)
{
category.parent.removeChild(category);
}
changed = true;
}
}
public void addCustomCategoryComment(String category, String comment)
{
if (!caseSensitiveCustomCategories)