@NotNull
  @Override
  public List<UsageGroup> getParentGroupsFor(@NotNull Usage usage, UsageTarget @NotNull [] targets) {
    if (usage instanceof UsageInModule usageInModule) {
      Module module = usageInModule.getModule();
      if (module != null) {
        if (myFlattenModules) {
          return Collections.singletonList(new ModuleUsageGroup(module, null));
        }
        else {
          List<String> groupPath = myGrouper.getGroupPath(module);
          List<UsageGroup> parentGroups = new ArrayList<>(groupPath.size() + 1);
          for (int i = 1; i <= groupPath.size(); i++) {
            parentGroups.add(new ModuleGroupUsageGroup(groupPath.subList(0, i)));
          }
          parentGroups.add(new ModuleUsageGroup(module, myGrouper));
          return parentGroups;
        }
      }
    }

    if (usage instanceof UsageInLibrary usageInLibrary) {
      OrderEntry entry = usageInLibrary.getLibraryEntry();
      if (entry != null) return Collections.singletonList(new LibraryUsageGroup(entry));

      for (SyntheticLibrary syntheticLibrary : usageInLibrary.getSyntheticLibraries()) {
        if (syntheticLibrary instanceof ItemPresentation) {
          return Collections.singletonList(new SyntheticLibraryUsageGroup((ItemPresentation)syntheticLibrary));
        }
      }
    }

    return Collections.emptyList();
  }
@NotNull
  @Override
  public List<UsageGroup> getParentGroupsFor(@NotNull Usage usage, UsageTarget @NotNull [] targets)