/** * Handles the selection of a revision and informs listeners. * * @param revision the selected revision, <code>null</code> for none */ void handleRevisionSelected(Revision revision) { fSelectedRevision= revision; fRevisionSelectionProvider.revisionSelected(revision); if (isConnected()) updateOverviewAnnotations(); postRedraw(); }
/** * Moves the start offset to <code>start</code>, keeping {@link #end()} constant. * * @param start the new start, must be >= 0 and < {@link #end()} * @throws LineIndexOutOfBoundsException if <code>start</code> < 0 or >= {@link #end()} */ public void setStart(int start) throws LineIndexOutOfBoundsException { int end= end(); if (!(start >= 0 && start < end)) throw new LineIndexOutOfBoundsException("Cannot set a negative start: " + start); //$NON-NLS-1$ moveTo(start); setEnd(end); }
/** * Creates a new range equal to the passed line range. * * @param range the range to copy * @return a <code>Range</code> equal to <code>range</code> */ public static Range copy(Range range) { return createRelative(range.start(), range.length()); }
/** * Resizes the range by <code>delta</code> lines, keeping {@link #start()} constant. * * @param delta the number of lines to resize the range * @throws LineIndexOutOfBoundsException if <code>-delta</code> >= {@link #length()} */ public void resizeBy(int delta) throws LineIndexOutOfBoundsException { setLength(length() + delta); }
/** * Sets the length of this range, keeping {@link #end()} constant. * * @param length the new length, must be > 0 and <= {@link #end()} * @throws LineIndexOutOfBoundsException if <code>length</code> <= 0 */ public void setLengthAndMove(int length) throws LineIndexOutOfBoundsException { setStart(end() - length); }
/** * Disposes of the painter's resources. */ private void handleDispose() { updateFocusLine(-1); if (fLineDiffer != null) { ((IAnnotationModel) fLineDiffer).removeAnnotationModelListener(fAnnotationListener); fLineDiffer= null; } fRevisionSelectionProvider.uninstall(); }
/** * Creates a new range with the given start offset and length. * * @param start the first line of the new range, must be >= 0 * @param length the number of lines included in the new range, must be > 0 * @return a <code>Range</code> with the given start and length * @throws LineIndexOutOfBoundsException if the parameters violate the invariant of * {@link Range} */ public static Range createRelative(int start, int length) throws LineIndexOutOfBoundsException { return new Range(start, length); }
/** * Returns <code>true</code> if the receiver can provide a hover for a certain document line. * * @param activeLine the document line of interest * @return <code>true</code> if the receiver can provide a hover */ public boolean hasHover(int activeLine) { return fViewer instanceof ISourceViewer && fHover.getHoverLineRange((ISourceViewer) fViewer, activeLine) != null; }
/** * Returns <code>true</code> if the ruler is showing revision information, <code>false</code> * otherwise * * @return <code>true</code> if revision information is shown, <code>false</code> otherwise * @since 3.3 */ public boolean isShowingRevisionInformation() { return fRevisionPainter.hasInformation(); }
/** * Private protocol used by {@link RevisionPainter} to signal selection of a revision. * * @param revision the selected revision, or <code>null</code> for none */ void revisionSelected(Revision revision) { setSelectedRevision(revision); }
@Override public Object clone() { return Range.copy(this); } }
/** * Returns the revision selection provider. * * @return the revision selection provider * @since 3.2 */ public ISelectionProvider getRevisionSelectionProvider() { return fRevisionPainter.getRevisionSelectionProvider(); } }
/** * Sets the length of this range, keeping {@link #start()} constant. * * @param length the new length, must be > 0 * @throws LineIndexOutOfBoundsException if <code>length</code> <= 0 */ public void setLength(int length) throws LineIndexOutOfBoundsException { if (!(length > 0)) throw new LineIndexOutOfBoundsException("Cannot set length <= 0: " + length); //$NON-NLS-1$ fLength= length; }
/** * Updates the focus line with a new line. * * @param line the new focus line, -1 for no focus */ private void updateFocusLine(int line) { if (fFocusLine != line) onFocusLineChanged(fFocusLine, line); }
/** * Handles the selection of a revision and informs listeners. * * @param revision the selected revision, <code>null</code> for none */ void handleRevisionSelected(Revision revision) { fSelectedRevision= revision; fRevisionSelectionProvider.revisionSelected(revision); if (isConnected()) updateOverviewAnnotations(); postRedraw(); }
/** * Creates a new range equal to the passed line range. * * @param range the range to copy * @return a <code>Range</code> equal to <code>range</code> */ public static Range copy(Range range) { return createRelative(range.start(), range.length()); }
/** * Resizes the range by <code>delta</code> lines, keeping {@link #start()} constant. * * @param delta the number of lines to resize the range * @throws LineIndexOutOfBoundsException if <code>-delta</code> >= {@link #length()} */ public void resizeBy(int delta) throws LineIndexOutOfBoundsException { setLength(length() + delta); }
/** * Creates a new range with the given start and end offsets. * * @param start the first line of the new range, must be >= 0 * @param end the first line not in the range any more (exclusive), must be > <code>start</code> * @return a <code>Range</code> with the given start and end offsets * @throws LineIndexOutOfBoundsException if the parameters violate the invariant of * {@link Range} */ public static Range createAbsolute(int start, int end) { return new Range(start, end - start); }