Collection<PropertiesFile> (@Nullable AntDomProject antDomProject, @NotNull XmlElement stopElement) { if (antDomProject == null) { return Collections.emptyList(); } final Set<PropertiesFile> files = new HashSet<>(); final int stopOffset = stopElement.getTextOffset(); for (Iterator<AntDomElement> iterator = antDomProject.getAntChildrenIterator(); iterator.hasNext(); ) { AntDomElement child = iterator.next(); final XmlElement xmlElement = child.getXmlElement(); if (xmlElement != null && xmlElement.getTextOffset() >= stopOffset) { break; // no need to offer to add properties to files that are imported after the property reference } if (child instanceof AntDomProperty property) { final PropertiesFile file = property.getPropertiesFile(); if (file != null) { files.add(file); } } } return files; }