From a62b7f123f71aa3aff36833fbce8e276ccda9c83 Mon Sep 17 00:00:00 2001 From: axelcl Date: Fri, 24 Dec 2004 11:07:51 +0000 Subject: [PATCH 1/1] improved templates --- .../wiki/editor/WikiCompletionProcessor.java | 2 +- .../wiki/editor/WikiSourceViewerConfiguration.java | 47 ++++++++++++++----- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiCompletionProcessor.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiCompletionProcessor.java index 28661b9..0b6c8cc 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiCompletionProcessor.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiCompletionProcessor.java @@ -172,7 +172,7 @@ public class WikiCompletionProcessor implements IContentAssistProcessor { String temp; for (int i = 0; i < arr.length; i++) { temp = (String) list.get(i); - arr[i] = new CompletionProposal(temp, region.getOffset(), region.getLength(), region.getOffset() + temp.length(), null, temp, + arr[i] = new CompletionProposal(temp, region.getOffset(), region.getLength(), temp.length(), null, temp, null, null); } return arr; diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiSourceViewerConfiguration.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiSourceViewerConfiguration.java index 3bc9c4e..a900d96 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiSourceViewerConfiguration.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiSourceViewerConfiguration.java @@ -108,7 +108,7 @@ public class WikiSourceViewerConfiguration extends SourceViewerConfiguration { private ITokenScanner getRecipeScanner() { RuleBasedScanner scanner = new RuleBasedScanner(); - IRule[] rules = new IRule[11]; + IRule[] rules = new IRule[14]; rules[0] = createHeader6Rule(); rules[1] = createHeader5Rule(); rules[2] = createHeader4Rule(); @@ -120,6 +120,9 @@ public class WikiSourceViewerConfiguration extends SourceViewerConfiguration { rules[8] = createExternalHTTPRule(); rules[9] = createListRule(); rules[10] = createNumberedListRule(); + rules[11] = createBoldItalicRule(); + rules[12] = createBoldRule(); + rules[13] = createItalicRule(); scanner.setRules(rules); return scanner; @@ -133,50 +136,68 @@ public class WikiSourceViewerConfiguration extends SourceViewerConfiguration { // return wordRule; // } + private IRule createBoldRule() { + IToken boldToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 0)), null, SWT.BOLD)); + SingleLineRule singleLineRule = new SingleLineRule("'''", "'''", boldToken); + return singleLineRule; + } + + private IRule createItalicRule() { + IToken italicToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 0)), null, SWT.ITALIC)); + SingleLineRule singleLineRule = new SingleLineRule("''", "''", italicToken); + return singleLineRule; + } + + private IRule createBoldItalicRule() { + IToken boldToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 0)), null, SWT.BOLD | SWT.ITALIC)); + SingleLineRule singleLineRule = new SingleLineRule("'''''", "'''''", boldToken); + return singleLineRule; + } + private IRule createHRRule() { - IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.ITALIC)); + IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.NONE)); SingleLineRule singleLineRule = new SingleLineRule("----", "\n", quantityToken); singleLineRule.setColumnConstraint(0); return singleLineRule; } private IRule createHeader1Rule() { - IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.ITALIC)); + IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.NONE)); SingleLineRule singleLineRule = new SingleLineRule("=", "=", quantityToken); singleLineRule.setColumnConstraint(0); return singleLineRule; } private IRule createHeader2Rule() { - IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.ITALIC)); + IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.NONE)); SingleLineRule singleLineRule = new SingleLineRule("==", "==", quantityToken); singleLineRule.setColumnConstraint(0); return singleLineRule; } private IRule createHeader3Rule() { - IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.ITALIC)); + IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.NONE)); SingleLineRule singleLineRule = new SingleLineRule("===", "===", quantityToken); singleLineRule.setColumnConstraint(0); return singleLineRule; } private IRule createHeader4Rule() { - IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.ITALIC)); + IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.NONE)); SingleLineRule singleLineRule = new SingleLineRule("====", "====", quantityToken); singleLineRule.setColumnConstraint(0); return singleLineRule; } private IRule createHeader5Rule() { - IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.ITALIC)); + IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.NONE)); SingleLineRule singleLineRule = new SingleLineRule("=====", "=====", quantityToken); singleLineRule.setColumnConstraint(0); return singleLineRule; } private IRule createHeader6Rule() { - IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.ITALIC)); + IToken quantityToken = new Token(new TextAttribute(fColors.getColor(new RGB(0, 0, 140)), null, SWT.NONE)); SingleLineRule singleLineRule = new SingleLineRule("======", "======", quantityToken); singleLineRule.setColumnConstraint(0); return singleLineRule; @@ -191,7 +212,7 @@ public class WikiSourceViewerConfiguration extends SourceViewerConfiguration { // } private IRule createListRule() { - IToken dashToken = new Token(new TextAttribute(fColors.getColor(new RGB(63, 127, 95)), null, SWT.BOLD)); + IToken dashToken = new Token(new TextAttribute(fColors.getColor(new RGB(63, 127, 95)), null, SWT.NONE)); // WordRule wordRule= new WordRule(new SimpleListDetector()); // wordRule.addWord("*", dashToken); SingleLineRule singleLineRule = new SingleLineRule("*", "\n", dashToken); @@ -200,7 +221,7 @@ public class WikiSourceViewerConfiguration extends SourceViewerConfiguration { } private IRule createNumberedListRule() { - IToken dashToken = new Token(new TextAttribute(fColors.getColor(new RGB(63, 127, 95)), null, SWT.BOLD)); + IToken dashToken = new Token(new TextAttribute(fColors.getColor(new RGB(63, 127, 95)), null, SWT.NONE)); // WordRule wordRule= new WordRule(new SimpleListDetector()); // wordRule.addWord("#", dashToken); SingleLineRule singleLineRule = new SingleLineRule("#", "\n", dashToken); @@ -209,19 +230,19 @@ public class WikiSourceViewerConfiguration extends SourceViewerConfiguration { } private IRule createLinkRule() { - IToken stepToken = new Token(new TextAttribute(fColors.getColor(new RGB(200, 100, 100)), null, SWT.BOLD)); + IToken stepToken = new Token(new TextAttribute(fColors.getColor(new RGB(200, 100, 100)), null, SWT.NONE)); SingleLineRule stepRule = new SingleLineRule("[[", "]]", stepToken); // stepRule.setColumnConstraint(0); return stepRule; } private IRule createExternalHTTPRule() { - IToken stepToken = new Token(new TextAttribute(fColors.getColor(new RGB(200, 100, 100)), null, SWT.BOLD)); + IToken stepToken = new Token(new TextAttribute(fColors.getColor(new RGB(200, 100, 100)), null, SWT.NONE)); SingleLineRule stepRule = new SingleLineRule("[http", "]", stepToken); // stepRule.setColumnConstraint(0); return stepRule; } - + /* * @see SourceViewerConfiguration#getReconciler(ISourceViewer) */ -- 1.7.1