@Override
      protected void onNodeStateChanged(CheckedTreeNode node) {
        final TemplateContextType type = (TemplateContextType)((Pair<?, ?>)node.getUserObject()).first;
        if (type != null) {
          boolean enabled = node.isChecked();
          context.setEnabled(type, enabled);
          for (TemplateContextType inheritor : hierarchy.get(type)) {
            if (context.getOwnValue(inheritor) == null) {
              context.setEnabled(inheritor, !enabled);
            }
          }
        }
        onChange.run();
      }
@Override
      protected void onNodeStateChanged(CheckedTreeNode node)