Search in sources :

Example 1 with PresentationReconciler

use of org.eclipse.jface.text.presentation.PresentationReconciler in project translationstudio8 by heartsome.

the class TagStyleConfigurator method getPresentationReconciler.

private static IPresentationReconciler getPresentationReconciler(ISegmentViewer viewer) {
    // 构造函数中,已经默认设置 IDocumentExtension3.DEFAULT_PARTITIONING
    PresentationReconciler reconciler = new PresentationReconciler();
    PresentationRepairer repairer = new PresentationRepairer(getRecipeScanner(viewer.getDocument()), viewer);
    reconciler.setRepairer(repairer, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.install(viewer);
    return reconciler;
}
Also used : PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler) IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler)

Example 2 with PresentationReconciler

use of org.eclipse.jface.text.presentation.PresentationReconciler in project tdi-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 3 with PresentationReconciler

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

the class SQLViewerConfiguration method getPresentationReconciler.

/**
	 * Gets the presentation reconciler. This will color the code.
	 *
	 * @param sourceViewer ISourceViewer
	 * @return reconciler IPresentationReconciler
	 */
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    // Create the presentation reconciler
    PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    // Create the damager/repairer for comment partitions
    String[] types = SQLPartitionScanner.getAllTypes();
    for (String type : types) {
        if (IDocument.DEFAULT_CONTENT_TYPE.equals(type)) {
            DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new SQLKeyWordScanner());
            reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
            reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
        } else {
            DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new StringCommentScanner());
            reconciler.setDamager(dr, type);
            reconciler.setRepairer(dr, type);
        }
    }
    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 4 with PresentationReconciler

use of org.eclipse.jface.text.presentation.PresentationReconciler in project translationstudio8 by heartsome.

the class TagStyleConfigurator method getPresentationReconciler.

private static IPresentationReconciler getPresentationReconciler(ITextViewer viewer) {
    // 构造函数中,已经默认设置 IDocumentExtension3.DEFAULT_PARTITIONING
    PresentationReconciler reconciler = new PresentationReconciler();
    PresentationRepairer repairer = new PresentationRepairer(getRecipeScanner(viewer.getDocument()));
    reconciler.setRepairer(repairer, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.install(viewer);
    return reconciler;
}
Also used : IPresentationReconciler(org.eclipse.jface.text.presentation.IPresentationReconciler) PresentationReconciler(org.eclipse.jface.text.presentation.PresentationReconciler)

Example 5 with PresentationReconciler

use of org.eclipse.jface.text.presentation.PresentationReconciler 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, SQLPartitionScanner.CONTENT_TYPE_SQL_MULTILINE_COMMENT, SQLConstants.CONFIG_COLOR_COMMENT);
    // Add a "damager-repairer" for changes within one-line SQL comments.
    addContentTypeDamageRepairer(reconciler, SQLPartitionScanner.CONTENT_TYPE_SQL_COMMENT, SQLConstants.CONFIG_COLOR_COMMENT);
    // Add a "damager-repairer" for changes within quoted literals.
    addContentTypeDamageRepairer(reconciler, SQLPartitionScanner.CONTENT_TYPE_SQL_STRING, SQLConstants.CONFIG_COLOR_STRING);
    // Add a "damager-repairer" for changes within quoted literals.
    addContentTypeDamageRepairer(reconciler, SQLPartitionScanner.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

IPresentationReconciler (org.eclipse.jface.text.presentation.IPresentationReconciler)8 PresentationReconciler (org.eclipse.jface.text.presentation.PresentationReconciler)8 DefaultDamagerRepairer (org.eclipse.jface.text.rules.DefaultDamagerRepairer)5 TextAttribute (org.eclipse.jface.text.TextAttribute)3 NonRuleBasedDamagerRepairer (com.cubrid.tool.editor.NonRuleBasedDamagerRepairer)2