// if next import is on a different line, modify the end position to the next line begin offset
if (currEndLine < nextOffsetLine) {
currEndLine++;
nextOffset= root.getPosition(currEndLine, 0);
}
currPackage.add(new ImportDeclEntry(name, isStatic, new Region(currOffset, nextOffset - currOffset)));
currOffset= nextOffset;
curr= next;
// add a comment entry for spacing between imports
if (currEndLine < nextOffsetLine) {
nextOffset= root.getPosition(nextOffsetLine, 0);
currPackage= new PackageEntry(); // create a comment package entry for this
this.packageEntries.add(currPackage);
currPackage.add(new ImportDeclEntry(null, false, new Region(currOffset, nextOffset - currOffset)));
currOffset= nextOffset;
}
currEndLine= root.getLineNumber(nextOffset + nextLength);
}
boolean isStatic= curr.isStatic();
String name= getFullName(curr);
String packName= getQualifier(curr);
if (currPackage == null || currPackage.compareTo(packName, isStatic) != 0) {
currPackage= new PackageEntry(packName, null, isStatic);
this.packageEntries.add(currPackage);
}
int length= this.replaceRange.getOffset() + this.replaceRange.getLength() - curr.getStartPosition();
currPackage.add(new ImportDeclEntry(name, isStatic, new Region(curr.getStartPosition(), length)));
}