Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2015-09-05 17:30:11 +0000
committerMatthias Sohn2015-09-10 19:22:21 +0000
commitd731994757fe6d4ffa076441124a22072de41898 (patch)
treee3dfe75cc9b08b4cac1fc4c7a48fac897ca3b081 /org.eclipse.egit.ui.test
parent02c3e6afc1e9e0b3a90e78e37ee04c14db2159fb (diff)
downloadegit-d731994757fe6d4ffa076441124a22072de41898.tar.gz
egit-d731994757fe6d4ffa076441124a22072de41898.tar.xz
egit-d731994757fe6d4ffa076441124a22072de41898.zip
Rewrite CommitMessageViewer to use JFace
The goal is to get the commit message viewer in the git history view to use the same (configurable) hyperlink colors and other hyperlink infrastructure as the SpellcheckableMessageArea. This is complicated by two things: * custom hyperlinks to commits with custom opening, and * no clear model-view separation; getting the data from git, formatting, and coloring were all lumped together. Therefore, improve the model-view separation: * Get rid of hand-crafted SWT text range coloring. CommitInfoBuilder is restricted to getting the data from the repo, formatting, and returning semantic information (hyperlinks, header and footer ranges). It doesn't do syntax-coloring anymore. * CommitMessageViewer uses a partitioning on its document to split it logically into header, body, and footer. It also gets a custom hyperlink detector to deal with the custom commit hyperlinks. * GitHistoryPage uses a presentation reconciler with damager/repairers that know how to syntax-color each partition (and hyperlinks). * Made the HyperlinkTokenScanner a bit more flexible to rebuild the italicizing of Signed-off-by footer lines. Fixed a bug along the way (if "fill paragraphs" was on, it would put footer lines onto one line). Visually, there are no changes except the colors of hyperlinks, which now follow SpellcheckableMessageArea and are configurable. Bug: 340623 Change-Id: Ie1b5907110ba716d262e4b5773fed7e3a5150d0d Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScannerTest.java16
1 files changed, 7 insertions, 9 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScannerTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScannerTest.java
index 4de8b1ad1c..51e49cf31b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScannerTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScannerTest.java
@@ -101,7 +101,7 @@ public class HyperlinkTokenScannerTest {
IDocument testDocument = new Document(text);
when(viewer.getDocument()).thenReturn(testDocument);
HyperlinkTokenScanner scanner = new HyperlinkTokenScanner(detectors,
- viewer);
+ viewer, null);
scanner.setRangeAndColor(testDocument, offset, length, null);
IToken token = null;
char[] found = new char[text.length()];
@@ -110,15 +110,13 @@ public class HyperlinkTokenScannerTest {
int tokenOffset = scanner.getTokenOffset();
int tokenLength = scanner.getTokenLength();
char ch = 'x';
- if (token == HyperlinkTokenScanner.DEFAULT) {
+ Object data = token.getData();
+ if (data == null) {
ch = 'D';
- } else {
- Object data = token.getData();
- if (data instanceof TextAttribute) {
- int style = ((TextAttribute) data).getStyle();
- if ((style & TextAttribute.UNDERLINE) != 0) {
- ch = 'H';
- }
+ } else if (data instanceof TextAttribute) {
+ int style = ((TextAttribute) data).getStyle();
+ if ((style & TextAttribute.UNDERLINE) != 0) {
+ ch = 'H';
}
}
Arrays.fill(found, tokenOffset, tokenOffset + tokenLength, ch);

Back to the top