Search in sources :

Example 81 with TextAttribute

use of org.eclipse.jface.text.TextAttribute in project tmdm-studio-se by Talend.

the class XMLConfiguration method getXMLTagScanner.

protected XMLTagScanner getXMLTagScanner() {
    if (tagScanner == null) {
        tagScanner = new XMLTagScanner(colorManager);
        tagScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.TAG))));
    }
    return tagScanner;
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) Token(org.eclipse.jface.text.rules.Token)

Example 82 with TextAttribute

use of org.eclipse.jface.text.TextAttribute in project tmdm-studio-se by Talend.

the class XMLConfiguration method getPresentationReconciler.

public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    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(IXMLColorConstants.XML_COMMENT)));
    reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
    reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);
    return reconciler;
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) DefaultDamagerRepairer(org.eclipse.jface.text.rules.DefaultDamagerRepairer) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler)

Example 83 with TextAttribute

use of org.eclipse.jface.text.TextAttribute in project tmdm-studio-se by Talend.

the class ElementFKInfoColorProvider method getToken.

public IToken getToken(String prefKey) {
    Token token = (Token) tokenTable.get(prefKey);
    if (token == null) {
        String colorName = store.getString(prefKey);
        if (colorName == null || colorName.isEmpty()) {
            if (prefKey.equals(ElementFKInfoConfiguration.PREF_COLOR_DEFAULT)) {
                // $NON-NLS-1$
                colorName = "0,128,0";
            } else if (prefKey.equals(ElementFKInfoConfiguration.PREF_COLOR_STRING)) {
                // $NON-NLS-1$
                colorName = "0,0,255";
            } else if (prefKey.equals(ElementFKInfoConfiguration.PREF_COLOR_KEYWORD)) {
                // $NON-NLS-1$
                colorName = "0,0,128";
            }
        }
        RGB rgb = StringConverter.asRGB(colorName);
        token = new Token(new TextAttribute(getColor(rgb)));
        tokenTable.put(prefKey, token);
    }
    return token;
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token) RGB(org.eclipse.swt.graphics.RGB)

Example 84 with TextAttribute

use of org.eclipse.jface.text.TextAttribute in project abstools by abstools.

the class Preferences method getToken.

public static IToken getToken(IPreferenceStore store, String postfix) {
    Color color = new Color(Display.getCurrent(), PreferenceConverter.getColor(store, SYNTAXCOLOR_COLOR + postfix));
    IToken token = new Token(new TextAttribute(color, null, computeAttributes(store, postfix)));
    return token;
}
Also used : IToken(org.eclipse.jface.text.rules.IToken) TextAttribute(org.eclipse.jface.text.TextAttribute) Color(org.eclipse.swt.graphics.Color) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token)

Example 85 with TextAttribute

use of org.eclipse.jface.text.TextAttribute in project ch.hsr.ifs.cdttesting by IFS-HSR.

the class Configuration method getPresentationReconciler.

@Override
public IPresentationReconciler getPresentationReconciler(final ISourceViewer sourceViewer) {
    final PresentationReconciler reconciler = new PresentationReconciler();
    DamagerRepairer ndr = new DamagerRepairer(new TextAttribute(this.colorManager.getColor(Colors.CDT_TEST_COMMENT), null, SWT.BOLD));
    reconciler.setDamager(ndr, TestFile.PARTITION_TEST_COMMENT);
    reconciler.setRepairer(ndr, TestFile.PARTITION_TEST_COMMENT);
    ndr = new DamagerRepairer(new TextAttribute(this.colorManager.getColor(Colors.TEST_NAME), null, SWT.BOLD));
    reconciler.setDamager(ndr, TestFile.PARTITION_TEST_NAME);
    reconciler.setRepairer(ndr, TestFile.PARTITION_TEST_NAME);
    ndr = new DamagerRepairer(new TextAttribute(this.colorManager.getColor(Colors.LANG_DEF), null, SWT.BOLD));
    reconciler.setDamager(ndr, TestFile.PARTITION_TEST_LANGUAGE);
    reconciler.setRepairer(ndr, TestFile.PARTITION_TEST_LANGUAGE);
    ndr = new DamagerRepairer(new TextAttribute(this.colorManager.getColor(Colors.EXPECTED), null, SWT.BOLD));
    reconciler.setDamager(ndr, TestFile.PARTITION_TEST_EXPECTED);
    reconciler.setRepairer(ndr, TestFile.PARTITION_TEST_EXPECTED);
    ndr = new DamagerRepairer(new TextAttribute(this.colorManager.getColor(Colors.CLASS_NAME), null, SWT.BOLD));
    reconciler.setDamager(ndr, TestFile.PARTITION_TEST_CLASS);
    reconciler.setRepairer(ndr, TestFile.PARTITION_TEST_CLASS);
    ndr = new DamagerRepairer(new TextAttribute(this.colorManager.getColor(Colors.FILE_NAME), null, SWT.BOLD));
    reconciler.setDamager(ndr, TestFile.PARTITION_TEST_FILE);
    reconciler.setRepairer(ndr, TestFile.PARTITION_TEST_FILE);
    ndr = new DamagerRepairer(new TextAttribute(this.colorManager.getColor(Colors.SELECTION), null, SWT.BOLD));
    reconciler.setDamager(ndr, TestFile.PARTITION_TEST_SELECTION);
    reconciler.setRepairer(ndr, TestFile.PARTITION_TEST_SELECTION);
    return reconciler;
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler)

Aggregations

TextAttribute (org.eclipse.jface.text.TextAttribute)142 Token (org.eclipse.jface.text.rules.Token)45 RGB (org.eclipse.swt.graphics.RGB)37 Color (org.eclipse.swt.graphics.Color)36 IToken (org.eclipse.jface.text.rules.IToken)23 StyleRange (org.eclipse.swt.custom.StyleRange)20 IPresentationReconciler (org.eclipse.jface.text.presentation.IPresentationReconciler)16 PresentationReconciler (org.eclipse.jface.text.presentation.PresentationReconciler)16 DefaultDamagerRepairer (org.eclipse.jface.text.rules.DefaultDamagerRepairer)14 ITextRegion (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)12 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)12 IRule (org.eclipse.jface.text.rules.IRule)10 RuleBasedScanner (org.eclipse.jface.text.rules.RuleBasedScanner)9 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)8 ArrayList (java.util.ArrayList)7 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)6 ColorRegistry (org.eclipse.jface.resource.ColorRegistry)5 Document (org.eclipse.jface.text.Document)4 IDocument (org.eclipse.jface.text.IDocument)4 MultiLineRule (org.eclipse.jface.text.rules.MultiLineRule)4