protected <T> void buildTree(@NotNull GlobalInspectionContextImpl context,
                               @NotNull Map<String, Set<T>> packageContents,
                               @NotNull InspectionToolWrapper toolWrapper,
                               @NotNull Function<? super T, ? extends RefEntityContainer<?>> computeContainer,
                               boolean showStructure,
                               final InspectionTreeNode parent,
                               InspectionTreeModel model) {
    MultiMap<String, RefEntityContainer> evaluatedDescriptors = MultiMap.create();
    for (Map.Entry<String, Set<T>> entry : packageContents.entrySet()) {
      String packageName = entry.getKey();
      for (T problemDescriptor : entry.getValue()) {
        RefEntityContainer<?> container = computeContainer.apply(problemDescriptor);
        evaluatedDescriptors.putValue(packageName, container);
        showStructure &= container.supportStructure();
      }
    }

    for (Map.Entry<String, Collection<RefEntityContainer>> entry : evaluatedDescriptors.entrySet()) {
      for (RefEntityContainer container : entry.getValue()) {
        InspectionTreeNode currentParent = parent;
        if (showStructure) {
          String packageName = entry.getKey();
          Module module = container.getModule(context.getProject());
          InspectionTreeNode moduleNode = module != null ? model.createModuleNode(module, parent) : null;
          InspectionTreeNode actualParent = moduleNode == null ? parent : moduleNode;
          currentParent = packageName == null ? actualParent : model.createPackageNode(packageName, actualParent);
        }
        InspectionToolPresentation presentation = context.getPresentation(toolWrapper);
        RefElementNode node = container.createNode(presentation,
                                                   model,
                                                   currentParent,
                                                   showStructure
                                                   || HighlightInfoType.getUnusedSymbolDisplayName().equals(toolWrapper.getDisplayName())
                                                   || presentation.isDummy());
        appendDescriptor(context, toolWrapper, container, node);
      }
    }
  }
protected <T> void buildTree(@NotNull GlobalInspectionContextImpl context,
                               @NotNull Map<String, Set<T>> packageContents,
                               @NotNull InspectionToolWrapper toolWrapper,
                               @NotNull Function<? super T, ? extends RefEntityContainer<?>> computeContainer,
                               boolean showStructure,
                               final InspectionTreeNode parent,
                               InspectionTreeModel model)