Add function to remove categories from a configuration, indavidual properties can be removed using ConfigCategory.remove() Closes #462
This commit is contained in:
parent
814123a973
commit
a44bd6dadf
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue