private static void addContextNode(MultiMap<TemplateContextType, TemplateContextType> hierarchy,
                                     CheckedTreeNode parent,
                                     TemplateContextType type, TemplateContext context) {
    Collection<TemplateContextType> children = hierarchy.get(type);
    String name = presentableName(type);
    CheckedTreeNode node = new CheckedTreeNode(Pair.create(children.isEmpty() ? type : null, name));
    parent.add(node);

    if (!children.isEmpty()) {
      for (TemplateContextType child : sortContexts(children)) {
        addContextNode(hierarchy, node, child, context);
      }
      final CheckedTreeNode other = new CheckedTreeNode(Pair.create(type, "Other"));
      other.setChecked(context.isEnabled(type));
      node.add(other);
    }
    node.setChecked(context.isEnabled(type));
  }
private static void addContextNode(MultiMap<TemplateContextType, TemplateContextType> hierarchy,
                                     CheckedTreeNode parent,
                                     TemplateContextType type, TemplateContext context)