private boolean shouldDelete(InspectionTreeNode node) {
    if (node instanceof RefElementNode refElementNode) {
      InspectionToolPresentation presentation = refElementNode.getPresentation();
      RefEntity element = refElementNode.getElement();
      if (element == null ||
          presentation.isProblemResolved(element) ||
          presentation.isExcluded(element) ||
          presentation.isSuppressed(element)) {
        return true;
      }
      List<? extends InspectionTreeNode> children = node.getChildren();
      return !children.isEmpty() && ContainerUtil.and(children, this::shouldDelete);
    }
    if (node instanceof ProblemDescriptionNode problemDescriptionNode) {
      CommonProblemDescriptor descriptor = problemDescriptionNode.getDescriptor();
      InspectionToolPresentation presentation = problemDescriptionNode.getPresentation();
      return descriptor == null || presentation.isExcluded(descriptor) || presentation.isProblemResolved(descriptor);
    }
    if (node instanceof InspectionGroupNode || node instanceof InspectionSeverityGroupNode || node instanceof InspectionModuleNode || node instanceof InspectionPackageNode) {
      return ContainerUtil.and(node.getChildren(), this::shouldDelete);
    }
    if (node instanceof InspectionNode) {
      InspectionToolResultExporter presentation = myView.getGlobalInspectionContext().getPresentation(((InspectionNode)node).getToolWrapper());
      SynchronizedBidiMultiMap<RefEntity, CommonProblemDescriptor> problemElements = presentation.getProblemElements();
      if (problemElements.isEmpty()) {
        return true;
      }
      return ContainerUtil.and(problemElements.keys(), entity -> presentation.isExcluded(entity));
    }
    return false;
  }
private boolean shouldDelete(InspectionTreeNode node)