private void createNodesGroupedByDirectory(
      CheckedTreeNode root, final List<? extends DetectedFrameworkDescription> frameworks) {
    Map<VirtualFile, FrameworkDirectoryNode> nodes = new HashMap<>();
    List<DetectedFrameworkNode> externalNodes = new ArrayList<>();
    for (DetectedFrameworkDescription framework : frameworks) {
      VirtualFile parent = VfsUtil.getCommonAncestor(framework.getRelatedFiles());
      if (parent != null && !parent.isDirectory()) {
        parent = parent.getParent();
      }

      final DetectedFrameworkNode frameworkNode = new DetectedFrameworkNode(framework, myContext);
      if (parent != null) {
        createDirectoryNodes(parent, nodes).add(frameworkNode);
      } else {
        externalNodes.add(frameworkNode);
      }
    }
    List<FrameworkDirectoryNode> rootDirs = new ArrayList<>();
    for (FrameworkDirectoryNode directoryNode : nodes.values()) {
      if (directoryNode.getParent() == null) {
        rootDirs.add(directoryNode);
      }
    }
    for (FrameworkDirectoryNode dir : rootDirs) {
      root.add(collapseDirectoryNode(dir));
    }
    for (DetectedFrameworkNode node : externalNodes) {
      root.add(node);
    }
  }
 private void createNodesGroupedByType(
     CheckedTreeNode root, final List<? extends DetectedFrameworkDescription> frameworks) {
   Map<FrameworkType, FrameworkTypeNode> groupNodes = new HashMap<>();
   for (DetectedFrameworkDescription framework : frameworks) {
     final FrameworkType type = framework.getDetector().getFrameworkType();
     FrameworkTypeNode group = groupNodes.get(type);
     if (group == null) {
       group = new FrameworkTypeNode(type);
       groupNodes.put(type, group);
       root.add(group);
     }
     group.add(new DetectedFrameworkNode(framework, myContext));
   }
 }