Search in sources :

Example 71 with TextAttribute

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;
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) Token(org.eclipse.jface.text.rules.Token)

Example 72 with TextAttribute

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;
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) NonRuleBasedDamagerRepairer(com.cubrid.tool.editor.NonRuleBasedDamagerRepairer)

Example 73 with TextAttribute

use of org.eclipse.jface.text.TextAttribute in project cubrid-manager by CUBRID.

the class XMLConfiguration method getXMLTagScanner.

/**
	 * Retrieves the XML Tag Scanner.
	 * 
	 * @return tagScanner
	 */
protected RuleBasedScanner getXMLTagScanner() {
    if (tagScanner == null) {
        tagScanner = new XMLTagDamageRepairScanner(colorManager);
        tagScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager.getColor(IXMLColorConstants.ATTR))));
    }
    return tagScanner;
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) Token(org.eclipse.jface.text.rules.Token) XMLTagDamageRepairScanner(com.cubrid.tool.editor.xml.scanner.XMLTagDamageRepairScanner)

Example 74 with TextAttribute

use of org.eclipse.jface.text.TextAttribute in project cubrid-manager by CUBRID.

the class XMLConfiguration method getPresentationReconciler.

/**
	 * Retrieves the Presentation Reconciler
	 * 
	 * @param sourceViewer ISourceViewer
	 * @return object of IPresentationReconciler
	 */
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) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler) NonRuleBasedDamagerRepairer(com.cubrid.tool.editor.NonRuleBasedDamagerRepairer)

Example 75 with TextAttribute

use of org.eclipse.jface.text.TextAttribute in project KaiZen-OpenAPI-Editor by RepreZen.

the class JsonScanner method tokenAttribute.

private TextAttribute tokenAttribute(String colorPrefs, String boldPrefs, String italicPrefs, String underlinePrefs) {
    int style = SWT.NORMAL;
    boolean isBold = store.getBoolean(boldPrefs);
    if (isBold) {
        style = style | SWT.BOLD;
    }
    boolean isItalic = store.getBoolean(italicPrefs);
    if (isItalic) {
        style = style | SWT.ITALIC;
    }
    boolean isUnderline = store.getBoolean(underlinePrefs);
    if (isUnderline) {
        style = style | TextAttribute.UNDERLINE;
    }
    RGB color = PreferenceConverter.getColor(store, colorPrefs);
    TextAttribute attr = new TextAttribute(colorManager.getColor(color), null, style);
    return attr;
}
Also used : TextAttribute(org.eclipse.jface.text.TextAttribute) RGB(org.eclipse.swt.graphics.RGB)

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