@Override public boolean isThreeWay() { return TextMergeViewer.this.isThreeWay(); } @Override
private RGB getTextFillColor() { if (isThreeWay() && !isIgnoreAncestor()) { switch (fDirection) { case RangeDifference.RIGHT: if (fLeftIsLocal) return INCOMING_TEXT_FILL; return OUTGOING_TEXT_FILL; case RangeDifference.ANCESTOR: return CONFLICT_TEXT_FILL; case RangeDifference.LEFT: if (fLeftIsLocal) return OUTGOING_TEXT_FILL; return INCOMING_TEXT_FILL; case RangeDifference.CONFLICT: return CONFLICT_TEXT_FILL; } return null; } return OUTGOING_TEXT_FILL; }
private RGB getStrokeColor(Diff diff) { boolean selected= fCurrentDiff != null && fCurrentDiff.fParent == diff; if (isThreeWay() && !isIgnoreAncestor()) { switch (diff.fDirection) { case RangeDifference.RIGHT: if (fLeftIsLocal) return selected ? SELECTED_INCOMING : INCOMING; return selected ? SELECTED_OUTGOING : OUTGOING; case RangeDifference.ANCESTOR: return selected ? SELECTED_CONFLICT : CONFLICT; case RangeDifference.LEFT: if (fLeftIsLocal) return selected ? SELECTED_OUTGOING : OUTGOING; return selected ? SELECTED_INCOMING : INCOMING; case RangeDifference.CONFLICT: return selected ? SELECTED_CONFLICT : CONFLICT; } return null; } return selected ? SELECTED_OUTGOING : OUTGOING; }
int getMaxDiffHeight() { Point region= new Point(0, 0); int h= fLeft.getLineRange(fLeftPos, region).y; if (isThreeWay()) h= Math.max(h, fAncestor.getLineRange(fAncestorPos, region).y); return Math.max(h, fRight.getLineRange(fRightPos, region).y); }
private boolean showResolveUI() { if (!isThreeWay() || isIgnoreAncestor()) return false; return isAnySideEditable(); }
private RGB getFillColor(Diff diff) { boolean selected= fCurrentDiff != null && fCurrentDiff.fParent == diff; RGB selected_fill= getBackground(null); if (isThreeWay() && !isIgnoreAncestor()) { switch (diff.fDirection) { case RangeDifference.RIGHT: if (fLeftIsLocal) return selected ? selected_fill : INCOMING_FILL; return selected ? selected_fill : OUTGOING_FILL; case RangeDifference.ANCESTOR: return selected ? selected_fill : CONFLICT_FILL; case RangeDifference.LEFT: if (fLeftIsLocal) return selected ? selected_fill : OUTGOING_FILL; return selected ? selected_fill : INCOMING_FILL; case RangeDifference.CONFLICT: return selected ? selected_fill : CONFLICT_FILL; } return null; } return selected ? selected_fill : OUTGOING_FILL; }
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 boolean showResolveUI() { if (!fUseResolveUI || !isThreeWay() || isIgnoreAncestor()) return false; CompareConfiguration cc= getCompareConfiguration(); // we only enable the new resolve UI if exactly one side is editable boolean l= cc.isLeftEditable(); boolean r= cc.isRightEditable(); //return (l && !r) || (r && !l); return l || r; }
void copyAllUnresolved(boolean leftToRight) { if (fChangeDiffs != null && isThreeWay() && !isIgnoreAncestor()) { IRewriteTarget target= leftToRight ? fRight.getRewriteTarget() : fLeft.getRewriteTarget(); boolean compoundChangeStarted= false;
private RGB getTextFillColor(Diff diff) { if (isThreeWay() && !isIgnoreAncestor()) { switch (diff.getKind()) { case RangeDifference.RIGHT: return getCompareConfiguration().isMirrored() ? OUTGOING_TEXT_FILL : INCOMING_TEXT_FILL; case RangeDifference.ANCESTOR: case RangeDifference.CONFLICT: return CONFLICT_TEXT_FILL; case RangeDifference.LEFT: return getCompareConfiguration().isMirrored() ? INCOMING_TEXT_FILL : OUTGOING_TEXT_FILL; default: return null; } } return OUTGOING_TEXT_FILL; } }
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); }
private RGB getStrokeColor(Diff diff) { boolean selected= fCurrentDiff != null && fCurrentDiff.getParent() == diff; if (isThreeWay() && !isIgnoreAncestor()) { switch (diff.getKind()) { case RangeDifference.RIGHT: if (!getCompareConfiguration().isMirrored()) return selected ? SELECTED_INCOMING : INCOMING; return selected ? SELECTED_OUTGOING : OUTGOING; case RangeDifference.ANCESTOR: case RangeDifference.CONFLICT: return selected ? SELECTED_CONFLICT : CONFLICT; case RangeDifference.LEFT: if (!getCompareConfiguration().isMirrored()) return selected ? SELECTED_OUTGOING : OUTGOING; return selected ? SELECTED_INCOMING : INCOMING; default: return null; } } return selected ? SELECTED_OUTGOING : OUTGOING; }
private RGB getFillColor(Diff diff) { boolean selected= fCurrentDiff != null && fCurrentDiff.getParent() == diff; RGB selected_fill= getBackground(null); if (isThreeWay() && !isIgnoreAncestor()) { switch (diff.getKind()) { case RangeDifference.RIGHT: if (!getCompareConfiguration().isMirrored()) return selected ? selected_fill : INCOMING_FILL; return selected ? selected_fill : OUTGOING_FILL; case RangeDifference.ANCESTOR: case RangeDifference.CONFLICT: return selected ? selected_fill : CONFLICT_FILL; case RangeDifference.LEFT: if (!getCompareConfiguration().isMirrored()) return selected ? selected_fill : OUTGOING_FILL; return selected ? selected_fill : INCOMING_FILL; default: return null; } } return selected ? selected_fill : OUTGOING_FILL; }
if (isThreeWay() && allBut != fAncestor) { if (fSynchronizedScrolling || allBut == null) { int y= virtualToRealPosition(fAncestor, avpos+s)-s; if (isThreeWay() && fAncestorCanvas != null) fAncestorCanvas.repaint();
protected void updateToolItems() { //only update toolbar items if diffs need to be calculated (which //dictates whether a toolbar gets added at all) if (!isPatchHunk()){ if (fIgnoreAncestorItem != null) fIgnoreAncestorItem.setVisible(isThreeWay()); if (fCopyDiffLeftToRightItem != null) { IAction a= fCopyDiffLeftToRightItem.getAction(); if (a != null) a.setEnabled(a.isEnabled() && !fHasErrors); } if (fCopyDiffRightToLeftItem != null) { IAction a= fCopyDiffRightToLeftItem.getAction(); if (a != null) a.setEnabled(a.isEnabled() && !fHasErrors); } super.updateToolItems(); } }
@Override protected void updateToolItems() { if (fCopyDiffLeftToRightItem != null) { fCopyDiffLeftToRightItem.setVisible(isRightEditable()); } if (fCopyDiffRightToLeftItem != null) { fCopyDiffRightToLeftItem.setVisible(isLeftEditable()); } //only update toolbar items if diffs need to be calculated (which //dictates whether a toolbar gets added at all) if (!isPatchHunk()){ if (fIgnoreAncestorItem != null) fIgnoreAncestorItem.setVisible(isThreeWay()); if (fCopyDiffLeftToRightItem != null) { IAction a= fCopyDiffLeftToRightItem.getAction(); if (a != null) a.setEnabled(a.isEnabled() && !fHasErrors); } if (fCopyDiffRightToLeftItem != null) { IAction a= fCopyDiffRightToLeftItem.getAction(); if (a != null) a.setEnabled(a.isEnabled() && !fHasErrors); } } super.updateToolItems(); }
private void invalidateLines() { if (isThreeWay()) { if (Utilities.okToUse(fAncestorCanvas)) fAncestorCanvas.redraw(); if (fAncestor != null && fAncestor.isControlOkToUse()) fAncestor.getTextWidget().redraw(); } if (Utilities.okToUse(fLeftCanvas)) fLeftCanvas.redraw(); if (fLeft != null && fLeft.isControlOkToUse()) fLeft.getTextWidget().redraw(); if (Utilities.okToUse(getCenterControl())) getCenterControl().redraw(); if (fRight != null && fRight.isControlOkToUse()) fRight.getTextWidget().redraw(); if (Utilities.okToUse(fRightCanvas)) fRightCanvas.redraw(); }
if (isThreeWay() && !isIgnoreAncestor()) fAncestor.setSelection(d.getPosition(ANCESTOR_CONTRIBUTOR)); fLeft.setSelection(d.getPosition(LEFT_CONTRIBUTOR)); fRight.setSelection(d.getPosition(RIGHT_CONTRIBUTOR)); } else { if (isThreeWay() && !isIgnoreAncestor()) fAncestor.setSelection(new Position(d.getPosition(ANCESTOR_CONTRIBUTOR).offset, 0)); fLeft.setSelection(new Position(d.getPosition(LEFT_CONTRIBUTOR).offset, 0));
private void invalidateLines() { if (isThreeWay() && isAncestorVisible()) { if (Utilities.okToUse(fAncestorCanvas)) fAncestorCanvas.redraw(); if (fAncestor != null && fAncestor.isControlOkToUse()) fAncestor.getSourceViewer().getTextWidget().redraw(); } if (Utilities.okToUse(fLeftCanvas)) fLeftCanvas.redraw(); if (fLeft != null && fLeft.isControlOkToUse()) fLeft.getSourceViewer().getTextWidget().redraw(); if (Utilities.okToUse(getCenterControl())) getCenterControl().redraw(); if (fRight != null && fRight.isControlOkToUse()) fRight.getSourceViewer().getTextWidget().redraw(); if (Utilities.okToUse(fRightCanvas)) fRightCanvas.redraw(); }
if (fHighlightRanges && fCurrentDiff != null && isThreeWay() && !isIgnoreAncestor()) { fDirectionLabel.setImage(fCurrentDiff.getImage()); } else {