Search in sources :

Example 21 with DefaultDamagerRepairer

use of org.eclipse.jface.text.rules.DefaultDamagerRepairer in project eclipse-integration-commons by spring-projects.

the class StsTextViewerConfiguration method getPresentationReconciler.

@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    if (showHyperlinks) {
        return super.getPresentationReconciler(sourceViewer);
    }
    PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new RuleBasedScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    return reconciler;
}
Also used : DefaultDamagerRepairer(org.eclipse.jface.text.rules.DefaultDamagerRepairer) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) RuleBasedScanner(org.eclipse.jface.text.rules.RuleBasedScanner)

Example 22 with DefaultDamagerRepairer

use of org.eclipse.jface.text.rules.DefaultDamagerRepairer in project liferay-ide by liferay.

the class Configuration method getPresentationReconciler.

public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    IToken defaultToken = null;
    DefaultDamagerRepairer dr = null;
    NonRuleBasedDamagerRepairer ndr = null;
    defaultToken = new Token(new TextAttribute(colorManager.getColor(Constants.COLOR_DIRECTIVE)));
    ContentScanner contentScanner = new ContentScanner(defaultToken, colorManager);
    for (int i = 0; i < PartitionScanner.DIRECTIVES.length; i++) {
        dr = new DefaultDamagerRepairer(contentScanner);
        reconciler.setDamager(dr, PartitionScanner.DIRECTIVES[i]);
        reconciler.setRepairer(dr, PartitionScanner.DIRECTIVES[i]);
    }
    dr = new DefaultDamagerRepairer(contentScanner);
    reconciler.setDamager(dr, PartitionScanner.FTL_DIRECTIVE);
    reconciler.setRepairer(dr, PartitionScanner.FTL_DIRECTIVE);
    dr = new DefaultDamagerRepairer(contentScanner);
    reconciler.setDamager(dr, PartitionScanner.FTL_DIRECTIVE_END);
    reconciler.setRepairer(dr, PartitionScanner.FTL_DIRECTIVE_END);
    ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(Constants.COLOR_XML_COMMENT)));
    reconciler.setDamager(ndr, PartitionScanner.XML_COMMENT);
    reconciler.setRepairer(ndr, PartitionScanner.XML_COMMENT);
    ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(Constants.COLOR_STRING)));
    reconciler.setDamager(ndr, PartitionScanner.STRING);
    reconciler.setRepairer(ndr, PartitionScanner.STRING);
    ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(colorManager.getColor(Constants.COLOR_COMMENT)));
    reconciler.setDamager(ndr, PartitionScanner.FTL_COMMENT);
    reconciler.setRepairer(ndr, PartitionScanner.FTL_COMMENT);
    defaultToken = new Token(new TextAttribute(colorManager.getColor(Constants.COLOR_INTERPOLATION)));
    dr = new DefaultDamagerRepairer(new ContentScanner(defaultToken, colorManager));
    reconciler.setDamager(dr, PartitionScanner.FTL_INTERPOLATION);
    reconciler.setRepairer(dr, PartitionScanner.FTL_INTERPOLATION);
    defaultToken = new Token(new TextAttribute(colorManager.getColor(Constants.COLOR_XML_TAG)));
    dr = new DefaultDamagerRepairer(new ContentScanner(defaultToken, colorManager));
    reconciler.setDamager(dr, PartitionScanner.XML_TAG);
    reconciler.setRepairer(dr, PartitionScanner.XML_TAG);
    return reconciler;
}
Also used : IToken(org.eclipse.jface.text.rules.IToken) TextAttribute(org.eclipse.jface.text.TextAttribute) DefaultDamagerRepairer(org.eclipse.jface.text.rules.DefaultDamagerRepairer) IToken(org.eclipse.jface.text.rules.IToken) Token(org.eclipse.jface.text.rules.Token) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler)

Example 23 with DefaultDamagerRepairer

use of org.eclipse.jface.text.rules.DefaultDamagerRepairer in project tdq-studio-se by Talend.

the class SQLSourceViewerConfiguration method getPresentationReconciler.

public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getCodeScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    dr = new DefaultDamagerRepairer(getMultilineCommentScanner());
    reconciler.setDamager(dr, IConstants.SQL_MULTILINE_COMMENT);
    reconciler.setRepairer(dr, IConstants.SQL_MULTILINE_COMMENT);
    dr = new DefaultDamagerRepairer(getSinglelineCommentScanner());
    reconciler.setDamager(dr, IConstants.SQL_SINGLE_LINE_COMMENT);
    reconciler.setRepairer(dr, IConstants.SQL_SINGLE_LINE_COMMENT);
    dr = new DefaultDamagerRepairer(getStringScanner());
    reconciler.setDamager(dr, IConstants.SQL_STRING);
    reconciler.setRepairer(dr, IConstants.SQL_STRING);
    return reconciler;
}
Also used : DefaultDamagerRepairer(org.eclipse.jface.text.rules.DefaultDamagerRepairer) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler)

Example 24 with DefaultDamagerRepairer

use of org.eclipse.jface.text.rules.DefaultDamagerRepairer in project soot by Sable.

the class JimpleConfiguration method getPresentationReconciler.

/**
 * This is what causes Jimple keywords to be highlighted
 */
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getJimpleScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    dr = new DefaultDamagerRepairer(getJimpleScanner());
    reconciler.setDamager(dr, JimplePartitionScanner.JIMPLE_STRING);
    reconciler.setRepairer(dr, JimplePartitionScanner.JIMPLE_STRING);
    return reconciler;
}
Also used : DefaultDamagerRepairer(org.eclipse.jface.text.rules.DefaultDamagerRepairer) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler)

Example 25 with DefaultDamagerRepairer

use of org.eclipse.jface.text.rules.DefaultDamagerRepairer in project dbeaver by serge-rider.

the class SQLEditorSourceViewerConfiguration method getPresentationReconciler.

/**
 * Creates, configures, and returns a presentation reconciler to help with
 * document changes.
 *
 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
 */
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    // Create a presentation reconciler to handle handle document changes.
    PresentationReconciler reconciler = new PresentationReconciler();
    String docPartitioning = getConfiguredDocumentPartitioning(sourceViewer);
    reconciler.setDocumentPartitioning(docPartitioning);
    // Add a "damager-repairer" for changes in default text (SQL code).
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(ruleManager);
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    // rule for multiline comments
    // We just need a scanner that does nothing but returns a token with
    // the corresponding text attributes
    addContentTypeDamageRepairer(reconciler, SQLParserPartitions.CONTENT_TYPE_SQL_MULTILINE_COMMENT, SQLConstants.CONFIG_COLOR_COMMENT);
    // Add a "damager-repairer" for changes within one-line SQL comments.
    addContentTypeDamageRepairer(reconciler, SQLParserPartitions.CONTENT_TYPE_SQL_COMMENT, SQLConstants.CONFIG_COLOR_COMMENT);
    // Add a "damager-repairer" for changes within quoted literals.
    addContentTypeDamageRepairer(reconciler, SQLParserPartitions.CONTENT_TYPE_SQL_STRING, SQLConstants.CONFIG_COLOR_STRING);
    // Add a "damager-repairer" for changes within quoted literals.
    addContentTypeDamageRepairer(reconciler, SQLParserPartitions.CONTENT_TYPE_SQL_QUOTED, SQLConstants.CONFIG_COLOR_DATATYPE);
    return reconciler;
}
Also used : DefaultDamagerRepairer(org.eclipse.jface.text.rules.DefaultDamagerRepairer) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler)

Aggregations

DefaultDamagerRepairer (org.eclipse.jface.text.rules.DefaultDamagerRepairer)34 IPresentationReconciler (org.eclipse.jface.text.presentation.IPresentationReconciler)30 PresentationReconciler (org.eclipse.jface.text.presentation.PresentationReconciler)30 TextAttribute (org.eclipse.jface.text.TextAttribute)14 RuleBasedScanner (org.eclipse.jface.text.rules.RuleBasedScanner)3 ErlDamagerRepairer (org.erlide.ui.editors.erl.scanner.ErlDamagerRepairer)3 NonRuleBasedDamagerRepairer (org.jkiss.dbeaver.ui.editors.text.NonRuleBasedDamagerRepairer)3 ColorRegistry (org.eclipse.jface.resource.ColorRegistry)2 PatternRule (org.eclipse.jface.text.rules.PatternRule)2 NonRuleBasedDamagerRepairer (com.cubrid.tool.editor.NonRuleBasedDamagerRepairer)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 HTMLTagDamagerRepairer (org.apache.syncope.ide.eclipse.plugin.editors.htmlhelpers.HTMLTagDamagerRepairer)1 JavaScriptDamagerRepairer (org.apache.syncope.ide.eclipse.plugin.editors.htmlhelpers.JavaScriptDamagerRepairer)1 DiffViewer (org.eclipse.egit.ui.internal.commit.DiffViewer)1 FocusTracker (org.eclipse.egit.ui.internal.commit.FocusTracker)1 HyperlinkSourceViewer (org.eclipse.egit.ui.internal.dialogs.HyperlinkSourceViewer)1 HyperlinkTokenScanner (org.eclipse.egit.ui.internal.dialogs.HyperlinkTokenScanner)1 RepositorySelectionProvider (org.eclipse.egit.ui.internal.selection.RepositorySelectionProvider)1 JavaDocScanner (org.eclipse.jdt.internal.ui.text.javadoc.JavaDocScanner)1