use of org.eclipse.jface.text.TextAttribute in project eclipse.platform.text by eclipse.
the class WordRuleTest method testBug175712_1.
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=175712
@Test
public void testBug175712_1() throws Exception {
IRule[] rules = new IRule[2];
IToken stepToken = new Token(new TextAttribute(null, null, SWT.BOLD));
PatternRule stepRule = new PatternRule("(((", ")", stepToken, (char) 0, false);
stepRule.setColumnConstraint(-1);
rules[1] = stepRule;
IToken titleToken = new Token(new TextAttribute(null, null, SWT.BOLD));
WordRule wordRule = new WordRule(new SimpleWordDetector());
wordRule.addWord("((", titleToken);
rules[0] = wordRule;
IDocument document = new Document("((( \n((\n- Cheese\n- Wine");
RuleBasedScanner scanner = new RuleBasedScanner();
scanner.setRules(rules);
scanner.setRange(document, 0, document.getLength());
IToken defaultToken = new Token(this);
scanner.setDefaultReturnToken(defaultToken);
IToken token = scanner.nextToken();
assertSame(defaultToken, token);
token = scanner.nextToken();
assertSame(defaultToken, token);
token = scanner.nextToken();
assertSame(defaultToken, token);
token = scanner.nextToken();
assertSame(titleToken, token);
}
use of org.eclipse.jface.text.TextAttribute in project dbeaver by serge-rider.
the class XMLConfiguration method getPresentationReconciler.
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
PresentationReconciler reconciler = new PresentationReconciler();
reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getXMLTagScanner());
reconciler.setDamager(dr, XMLPartitionScanner.XML_TAG);
reconciler.setRepairer(dr, XMLPartitionScanner.XML_TAG);
dr = new DefaultDamagerRepairer(getXMLScanner());
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(COLOR_XML_COMMENT)));
reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);
return reconciler;
}
use of org.eclipse.jface.text.TextAttribute in project dbeaver by serge-rider.
the class XMLConfiguration method getXMLTagScanner.
XMLTagScanner getXMLTagScanner() {
XMLTagScanner tagScanner = new XMLTagScanner(colorManager);
tagScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(COLOR_TAG))));
return tagScanner;
}
use of org.eclipse.jface.text.TextAttribute in project cubrid-manager by CUBRID.
the class PropConfiguration method getPropertiesCommentScanner.
/**
* Retrieves the XML Tag Scanner.
*
* @return tagScanner
*/
protected PropPartitionScanner getPropertiesCommentScanner() {
if (commentScanner == null) {
commentScanner = new PropPartitionScanner();
commentScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IPropColorConstants.PROP_COMMENT))));
}
return commentScanner;
}
use of org.eclipse.jface.text.TextAttribute in project cubrid-manager by CUBRID.
the class PropConfiguration method getPresentationReconciler.
/**
* Retrieves the Presentation Reconciler
*
* @param sourceViewer ISourceViewer
* @return object of IPresentationReconciler
*/
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
PresentationReconciler reconciler = new PresentationReconciler();
NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(IPropColorConstants.PROP_COMMENT)));
reconciler.setDamager(ndr, PropPartitionScanner.PROPERTIES_COMMENT);
reconciler.setRepairer(ndr, PropPartitionScanner.PROPERTIES_COMMENT);
ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(IPropColorConstants.DEFAULT)));
reconciler.setDamager(ndr, PropPartitionScanner.PROPERTIES_CONTENT);
reconciler.setRepairer(ndr, PropPartitionScanner.PROPERTIES_CONTENT);
ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(IPropColorConstants.TAG)));
reconciler.setDamager(ndr, IDocument.DEFAULT_CONTENT_TYPE);
reconciler.setRepairer(ndr, IDocument.DEFAULT_CONTENT_TYPE);
return reconciler;
}
Aggregations