private void updateAllDiffBackgrounds(Display display) { if (fChangeDiffs != null) { boolean threeWay= isThreeWay(); Iterator iter= fChangeDiffs.iterator(); while (iter.hasNext()) { Diff diff= (Diff) iter.next(); Color c= getColor(display, getFillColor(diff)); if (threeWay) fAncestor.setLineBackground(diff.fAncestorPos, c); fLeft.setLineBackground(diff.fLeftPos, c); fRight.setLineBackground(diff.fRightPos, c); } } }
private void updateDiffBackground(Diff diff) { if (! fHighlightRanges) return; if (diff == null || diff.fIsToken) return; if (fShowCurrentOnly && !isCurrentDiff(diff)) return; Color c= getColor(null, getFillColor(diff)); if (c == null) return; if (isThreeWay()) fAncestor.setLineBackground(diff.fAncestorPos, c); fLeft.setLineBackground(diff.fLeftPos, c); fRight.setLineBackground(diff.fRightPos, c); }
break; g.setBackground(getColor(display, getStrokeColor(diff))); g.fillRectangle(0, y-1, w, LW); g.fillRectangle(0, y+h-1, w, LW);
private void contributeDiffBackgroundListener(final MergeSourceViewer viewer) { viewer.getSourceViewer().getTextWidget().addLineBackgroundListener( event -> { StyledText textWidget = viewer.getSourceViewer().getTextWidget(); if (textWidget != null) { int caret = textWidget.getCaretOffset(); int length = event.lineText.length(); if (event.lineOffset <= caret && caret <= event.lineOffset + length) { // current line, do nothing // decorated by CursorLinePainter } else { // find diff for the event line Diff diff = findDiff(viewer, event.lineOffset, event.lineOffset + length); if (diff != null && updateDiffBackground(diff)) { // highlights only the event line, not the // whole diff event.lineBackground = getColor(fComposite .getDisplay(), getFillColor(diff)); } } } }); }
break; g.setBackground(getColor(display, getStrokeColor(diff))); g.fillRectangle(0, y-1, w, LW); g.fillRectangle(0, y+h-1, w, LW);
te.setBackground(getColor(parent.getDisplay(), fBackground));
color= getColor(display, fBackground);
te.setBackground(getColor(parent.getDisplay(), fBackground));