/** * Computes the content of the hover for the document contained in <code>viewer</code> on * line <code>line</code>. * * @param viewer the connected viewer * @param first the first line in <code>viewer</code>'s document to consider * @param last the last line in <code>viewer</code>'s document to consider * @param maxLines the max number of lines * @return The hover content corresponding to the parameters * @see #getHoverInfo(ISourceViewer, int) * @see #getHoverInfo(ISourceViewer, ILineRange, int) */ private String computeContent(ISourceViewer viewer, int first, int last, int maxLines) { ILineDiffer differ= getDiffer(viewer); if (differ == null) return null; final List<ILineDiffInfo> lines= new LinkedList<>(); for (int l= first; l <= last; l++) { ILineDiffInfo info= differ.getLineInfo(l); if (info != null) lines.add(info); } return decorateText(lines, maxLines); }
/** * Adapts the last line to the implementation of <code>ILineDiffInfo</code>. * * @param viewer the source viewer * @param lastLine the line to adapt * @return <code>lastLine - 1</code> if that line exists and is an * unchanged line followed by deletions, <code>startLine</code> * otherwise */ private int adaptLastLine(ISourceViewer viewer, int lastLine) { ILineDiffer differ= getDiffer(viewer); if (differ != null && lastLine > 0) { ILineDiffInfo info= differ.getLineInfo(lastLine); if (info != null && info.getChangeType() == ILineDiffInfo.UNCHANGED) return lastLine - 1; } return lastLine; }
/** * Computes the content of the hover for the document contained in <code>viewer</code> on * line <code>line</code>. * * @param viewer the connected viewer * @param first the first line in <code>viewer</code>'s document to consider * @param last the last line in <code>viewer</code>'s document to consider * @param maxLines the max number of lines * @return The hover content corresponding to the parameters * @see #getHoverInfo(ISourceViewer, int) * @see #getHoverInfo(ISourceViewer, ILineRange, int) */ private String computeContent(ISourceViewer viewer, int first, int last, int maxLines) { ILineDiffer differ= getDiffer(viewer); if (differ == null) return null; final List<ILineDiffInfo> lines= new LinkedList<>(); for (int l= first; l <= last; l++) { ILineDiffInfo info= differ.getLineInfo(l); if (info != null) lines.add(info); } return decorateText(lines, maxLines); }
/** * Adapts the last line to the implementation of <code>ILineDiffInfo</code>. * * @param viewer the source viewer * @param lastLine the line to adapt * @return <code>lastLine - 1</code> if that line exists and is an * unchanged line followed by deletions, <code>startLine</code> * otherwise */ private int adaptLastLine(ISourceViewer viewer, int lastLine) { ILineDiffer differ= getDiffer(viewer); if (differ != null && lastLine > 0) { ILineDiffInfo info= differ.getLineInfo(lastLine); if (info != null && info.getChangeType() == ILineDiffInfo.UNCHANGED) return lastLine - 1; } return lastLine; }
/** * Adapts the start line to the implementation of <code>ILineDiffInfo</code>. * * @param viewer the source viewer * @param startLine the line to adapt * @return <code>startLine - 1</code> if that line exists and is an * unchanged line followed by deletions, <code>startLine</code> * otherwise */ private int adaptFirstLine(ISourceViewer viewer, int startLine) { ILineDiffer differ= getDiffer(viewer); if (differ != null && startLine > 0) { int l= startLine - 1; ILineDiffInfo info= differ.getLineInfo(l); if (info != null && info.getChangeType() == ILineDiffInfo.UNCHANGED && info.getRemovedLinesBelow() > 0) return l; } return startLine; }
/** * Adapts the start line to the implementation of <code>ILineDiffInfo</code>. * * @param viewer the source viewer * @param startLine the line to adapt * @return <code>startLine - 1</code> if that line exists and is an * unchanged line followed by deletions, <code>startLine</code> * otherwise */ private int adaptFirstLine(ISourceViewer viewer, int startLine) { ILineDiffer differ= getDiffer(viewer); if (differ != null && startLine > 0) { int l= startLine - 1; ILineDiffInfo info= differ.getLineInfo(l); if (info != null && info.getChangeType() == ILineDiffInfo.UNCHANGED && info.getRemovedLinesBelow() > 0) return l; } return startLine; }
ILineDiffer differ= getDiffer(viewer); if (differ == null) return new Point(-1, -1);
ILineDiffer differ= getDiffer(viewer); if (differ == null) return new Point(-1, -1);