use of org.eclipse.n4js.jsdoc2spec.SpecElementRef in project n4js by eclipse.
the class JSDoc2ADocSpecProcessor method createNewEntries.
/**
* This method iterates through the entries of {@code typesByName} and creates {@link SpecFile}s from them. The
* entries of {@code typeByName} contain e.g. requirements, or N4JS types like classes.
*/
private Collection<SpecFile> createNewEntries(Collection<SpecInfo> specInfos, SubMonitorMsg monitor) throws InterruptedException {
TreeMap<String, SpecFile> specChangeSet = new TreeMap<>();
Map<String, SpecSection> specsByKey = new HashMap<>();
SubMonitorMsg sub = monitor.convert(specInfos.size());
for (SpecInfo specInfo : specInfos) {
SpecElementRef specElementRef = specInfo.specElementRef;
String specKey = KeyUtils.getSpecKey(repoPathHolder, specInfo);
if (specsByKey.containsKey(specKey))
throw new RuntimeException("Unexpected!");
// create spec regions for every requirement and source element
SpecSection specSection = null;
if (specElementRef.requirementID != null) {
specSection = new SpecRequirementSection(specInfo, rootDir, repoPathHolder);
specSection.generateADocText(adocFactory, specsByKey);
specsByKey.put(specSection.getSpecKey(), specSection);
SpecRequirementFile srf = new SpecRequirementFile((SpecRequirementSection) specSection);
specChangeSet.put(specSection.getSpecModuleKey(), srf);
}
if (specElementRef.identifiableElement != null) {
specSection = new SpecIdentifiableElementSection(specInfo, rootDir, repoPathHolder);
SpecIdentifiableElementSection sies = (SpecIdentifiableElementSection) specSection;
insertIntoSpecModuleFile(specChangeSet, specsByKey, sies);
addMembers(sies.specInfo, specsByKey, specChangeSet);
}
sub.worked(1);
checkUserCanceled(sub);
}
Set<SpecFile> changeEntries = new HashSet<>();
changeEntries.addAll(specChangeSet.values());
return changeEntries;
}
Aggregations