private boolean isCaptionLine(Position position, IDocument document, int line) { if (position.getOffset() > -1 && position.getLength() > -1) { try { int captionOffset; if (position instanceof IProjectionPosition) captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document); else captionOffset= 0; int startLine= document.getLineOfOffset(position.getOffset() + captionOffset); return line == startLine; } catch (BadLocationException x) { } } return false; }
private boolean isCaptionLine(Position position, IDocument document, int line) { if (position.getOffset() > -1 && position.getLength() > -1) { try { int captionOffset; if (position instanceof IProjectionPosition) captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document); else captionOffset= 0; int startLine= document.getLineOfOffset(position.getOffset() + captionOffset); return line == startLine; } catch (BadLocationException x) { } } return false; }
/** * Computes the collapsed region anchor for the given position. Assuming * that the position is the position of an expanded projection annotation, * the anchor is the region that is still visible after the projection * annotation has been collapsed. * * @param position the position * @return the collapsed region anchor */ public Position computeCollapsedRegionAnchor(Position position) { try { IDocument document= getDocument(); if (document == null) return null; int captionOffset= position.getOffset(); if (position instanceof IProjectionPosition) captionOffset+= ((IProjectionPosition) position).computeCaptionOffset(document); IRegion lineInfo= document.getLineInformationOfOffset(captionOffset); return new Position(lineInfo.getOffset() + lineInfo.getLength(), 0); } catch (BadLocationException x) { } return null; }
/** * Computes the collapsed region anchor for the given position. Assuming * that the position is the position of an expanded projection annotation, * the anchor is the region that is still visible after the projection * annotation has been collapsed. * * @param position the position * @return the collapsed region anchor */ public Position computeCollapsedRegionAnchor(Position position) { try { IDocument document= getDocument(); if (document == null) return null; int captionOffset= position.getOffset(); if (position instanceof IProjectionPosition) captionOffset+= ((IProjectionPosition) position).computeCaptionOffset(document); IRegion lineInfo= document.getLineInformationOfOffset(captionOffset); return new Position(lineInfo.getOffset() + lineInfo.getLength(), 0); } catch (BadLocationException x) { } return null; }
int captionOffset; if (position instanceof IProjectionPosition) captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document); else captionOffset= 0;
int captionOffset; if (position instanceof IProjectionPosition) captionOffset= ((IProjectionPosition) position).computeCaptionOffset(document); else captionOffset= 0;