Collection<JavaSourceGroup> sourceGroups = sourceSet.getSourceGroups();
int nonResourceCount = countNonResource(sourceGroups);
for (JavaSourceGroup sourceGroup: sourceSet.getSourceGroups()) {
JavaSourceGroupName groupName = sourceGroup.getGroupName();
JavaSourceGroupID groupID = new JavaSourceGroupID(sourceSetName, groupName);
Set<File> sourceRoots = sourceGroup.getSourceRoots();
String groupNamePrefix;
if (groupName == JavaSourceGroupName.RESOURCES) {
groupNamePrefix = NbStrings.getResourcesPackageCaption() + " [" + displaySourceSetName + "]";
}
else if (nonResourceCount == 1) {
groupNamePrefix = mainName != null
? mainName
: NbStrings.getOtherPackageCaption(displaySourceSetName);
}
else {
String groupDisplayName = StringUtils.capitalizeFirstCharacter(
groupName.toString().toLowerCase(Locale.ROOT));
groupNamePrefix = mainName != null
? mainName + " [" + groupDisplayName + "]"
: NbStrings.getOtherPackageCaption(displaySourceSetName + "/" + groupDisplayName);
}