List<Location> locations = new SmartList<Location>();
Collection<ErlangFile> erlangFiles = getErlangFiles(project, module);
if (function != null) {
for (ErlangFile file : erlangFiles) {
Location testLocation = getTestLocation(project, file, function, line);
ContainerUtil.addIfNotNull(testLocation, locations);
}
}
if (locations.isEmpty()) {
for (ErlangFile file : erlangFiles) {
Location moduleLocation = getModuleLocation(project, file);
ContainerUtil.addIfNotNull(moduleLocation, locations);
}
}
return locations;
}