/** * Determines all embracing, overlapping, and follow up positions * for the given region of the document. * * @param offset the offset of the document region to be formatted * @param length the length of the document to be formatted * @since 3.0 */ private void determinePositionsToUpdate(int offset, int length) { String[] categories= fDocument.getPositionCategories(); if (categories != null) { for (String cat : categories) { if (ignoreCategory(cat)) continue; try { Position[] positions= fDocument.getPositions(cat); for (Position p : positions) { if (p.overlapsWith(offset, length)) { if (offset < p.getOffset()) fOverlappingPositionReferences.add(new PositionReference(p, true, cat)); if (p.getOffset() + p.getLength() < offset + length) fOverlappingPositionReferences.add(new PositionReference(p, false, cat)); } } } catch (BadPositionCategoryException x) { // can not happen } } } }
fOverlappingPositionReferences.add(new PositionReference(p, true, categories[i])); fOverlappingPositionReferences.add(new PositionReference(p, false, categories[i]));