private static List<String> collectNames(PsiFile file, String type) {
    if (file instanceof XmlFile) {
      final CollectNamesVisitor collectNamesVisitor = getVisitorByType(type);
      file.accept(collectNamesVisitor);
      return collectNamesVisitor.getValues();
    }
    return Collections.emptyList();
  }
private static List<String> collectNames(PsiFile file, String type)