Bug 512856 - Improve highlighting in patch editor
Adds bold for visual chunk and diff separation.
Change-Id: Ia7d0ef5e1c6e6d33e4508e7e7673402395b7a2df
Signed-off-by: Sopot Cela <scela@redhat.com>
diff --git a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java
index 9c27d1c..f6e74dc 100644
--- a/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java
+++ b/bundles/org.eclipse.team.genericeditor.diff.extension/src/org/eclipse/team/internal/genericeditor/diff/extension/presentation/DiffPresentationReconciler.java
@@ -27,12 +27,16 @@
Display.getCurrent().getSystemColor(SWT.COLOR_RED));
private final TextAttribute bodyAttributePlus = new TextAttribute(
Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN));
+ private final TextAttribute bodyAttributeMinusBold = new TextAttribute(
+ Display.getCurrent().getSystemColor(SWT.COLOR_RED), null, SWT.BOLD);
+ private final TextAttribute bodyAttributePlusBold = new TextAttribute(
+ Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN), null, SWT.BOLD);
private final TextAttribute hunkAttribute = new TextAttribute(
- Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE));
+ Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE), null, SWT.BOLD);
private final TextAttribute headerAttribute = new TextAttribute(
Display.getCurrent().getSystemColor(SWT.COLOR_DARK_MAGENTA));
private final TextAttribute indexDiffAttribute = new TextAttribute(
- Display.getCurrent().getSystemColor(SWT.COLOR_DARK_CYAN));
+ Display.getCurrent().getSystemColor(SWT.COLOR_DARK_CYAN), null, SWT.BOLD);
public DiffPresentationReconciler() {
@@ -47,13 +51,13 @@
this.setRepairer(hdr, IDiffPartitioning.PARTITION_HEADER);
IRule[] bodyRules=new IRule[7];
- bodyRules[0] = new StartOfLineRule("+", null, new Token(bodyAttributePlus));//$NON-NLS-1$
- bodyRules[1] = new StartOfLineRule("-", null, new Token(bodyAttributeMinus));//$NON-NLS-1$
+ bodyRules[0]=new StartOfLineRule("---", null, new Token(bodyAttributeMinusBold));//$NON-NLS-1$
+ bodyRules[1]=new StartOfLineRule("+++", null, new Token(bodyAttributePlusBold));//$NON-NLS-1$
bodyRules[2] = new StartOfLineRule("@@", null, new Token(hunkAttribute));//$NON-NLS-1$
bodyRules[3]=new StartOfLineRule("diff --git", null, new Token(indexDiffAttribute));//$NON-NLS-1$
bodyRules[4]=new StartOfLineRule("index", null, new Token(indexDiffAttribute));//$NON-NLS-1$
- bodyRules[5]=new StartOfLineRule("---", null, new Token(bodyAttributeMinus));//$NON-NLS-1$
- bodyRules[6]=new StartOfLineRule("+++", null, new Token(bodyAttributePlus));//$NON-NLS-1$
+ bodyRules[5] = new StartOfLineRule("+", null, new Token(bodyAttributePlus));//$NON-NLS-1$
+ bodyRules[6] = new StartOfLineRule("-", null, new Token(bodyAttributeMinus));//$NON-NLS-1$
RuleBasedScanner scanner = new RuleBasedScanner();
scanner.setRules(bodyRules);
DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);