Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-compare-dev] At a glance diffs

I've coded the ability to highlight token diffs by changing the foreground colour.
Attached is the diff and an example of how it changes the ui.
 
Any use / any thoughts?
 
cheers,
Graham


For more information about the Viatel Group, please visit www.viatel.com.

THIS MESSAGE IS INTENDED ONLY FOR THE USE OF THE INTENDED RECIPIENT TO WHICH IT IS ADDRESSED AND MAY CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM DISCLOSURE. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, you are notified that any dissemination, distribution or copying of this e-mail is prohibited, and you should delete this e-mail from your system.

This message has been scanned for viruses and spam by Viatel MailControl.

Index: compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
===================================================================
RCS file: /home/eclipse/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java,v
retrieving revision 1.144
diff -u -r1.144 TextMergeViewer.java
--- compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java	14 Apr 2005 13:53:03 -0000	1.144
+++ compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java	21 Apr 2005 10:32:46 -0000
@@ -1746,6 +1746,17 @@
 		return encoding;
 	}
 	
+	private void updateDiffForeground(Diff diff) {
+		if (diff.fIsToken) {
+			Color c = getColor(null, getStrokeColor(diff));
+			if (c == null)
+				return;
+
+			fLeft.setTextColor(c, diff.fLeftPos.getOffset(), diff.fLeftPos.getLength(), false);
+			fRight.setTextColor(c, diff.fRightPos.getOffset(), diff.fRightPos.getLength(), false);
+		}
+	}
+	
 	private void updateDiffBackground(Diff diff) {
 		
 		if (! fHighlightRanges)
@@ -2647,6 +2658,7 @@
 				if (leftS != leftStart2 || leftE != leftEnd2 ||
 							rightS != rightStart2 || rightE != rightEnd2) {
 					diff.fIsToken= true;
+					updateDiffForeground(diff);
 					// add to base Diff
 					baseDiff.add(diff);
 				}
@@ -2741,6 +2753,7 @@
 							leftDoc, null, leftStart2, leftEnd2+1,
 							rightDoc, null, rightStart2, rightEnd2+1);	
 				diff.fIsToken= true;
+				updateDiffForeground(diff);
 				baseDiff.add(diff);
 			}
 		}

Attachment: tokenForeground-eg.gif
Description: GIF image


Back to the top