org.eclipse.jface.text.presentation.IPresentationReconciler Java Examples

The following examples show how to use org.eclipse.jface.text.presentation.IPresentationReconciler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DSLSourceViewerConfiguration.java    From dsl-compiler-client with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	
	DSLPresentationReconciler reconciler = new DSLPresentationReconciler(sourceViewer);
	ITokenScanner scanner = new TokenScanner();
	String contentType = IDocument.DEFAULT_CONTENT_TYPE;
	// TODO preference store
	long delay = 300;
	DefaultDamagerRepairer dr = new DelayedDamagerRepairer(scanner, reconciler, delay);
	reconciler.setDamager(dr, contentType);
	reconciler.setRepairer(dr, contentType);
	
	// IResource file = this.extractResource(this.editor);
	
	return reconciler;
}
 
Example #2
Source File: JSSourceViewerConfiguration.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see SourceViewerConfiguration#getPresentationReconciler(ISourceViewer)
 */
public IPresentationReconciler getPresentationReconciler(
		ISourceViewer sourceViewer )
{
	PresentationReconciler reconciler = new PresentationReconciler( );

	DefaultDamagerRepairer dr = new DefaultDamagerRepairer( getDefaultScanner( ) );
	reconciler.setDamager( dr, IDocument.DEFAULT_CONTENT_TYPE );
	reconciler.setRepairer( dr, IDocument.DEFAULT_CONTENT_TYPE );

	NonRuleBasedDamagerRepairer commentRepairer = new NonRuleBasedDamagerRepairer( UIUtil.getAttributeFor( ReportPlugin.EXPRESSION_COMMENT_COLOR_PREFERENCE ) );
	reconciler.setDamager( commentRepairer, JSPartitionScanner.JS_COMMENT );
	reconciler.setRepairer( commentRepairer, JSPartitionScanner.JS_COMMENT );

	NonRuleBasedDamagerRepairer stringRepairer = new NonRuleBasedDamagerRepairer( UIUtil.getAttributeFor( ReportPlugin.EXPRESSION_STRING_COLOR_PREFERENCE ) );
	reconciler.setDamager( stringRepairer, JSPartitionScanner.JS_STRING );
	reconciler.setRepairer( stringRepairer, JSPartitionScanner.JS_STRING );

	NonRuleBasedDamagerRepairer keywordRepairer = new NonRuleBasedDamagerRepairer( UIUtil.getAttributeFor( ReportPlugin.EXPRESSION_KEYWORD_COLOR_PREFERENCE ) );
	reconciler.setDamager( keywordRepairer, JSPartitionScanner.JS_KEYWORD );
	reconciler.setRepairer( keywordRepairer, JSPartitionScanner.JS_KEYWORD );

	return reconciler;
}
 
Example #3
Source File: SQLSourceViewerConfiguration.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public IPresentationReconciler getPresentationReconciler(
		ISourceViewer sourceViewer )
{
	PresentationReconciler reconciler = new PresentationReconciler( );
	
	NonRuleBasedDamagerRepairer dr = new NonRuleBasedDamagerRepairer( quoteString );
	reconciler.setDamager( dr, SQLPartitionScanner.QUOTE_STRING );
	reconciler.setRepairer( dr, SQLPartitionScanner.QUOTE_STRING );
	
	
	dr = new NonRuleBasedDamagerRepairer( comment );
	reconciler.setDamager( dr, SQLPartitionScanner.COMMENT );
	reconciler.setRepairer( dr, SQLPartitionScanner.COMMENT );
	
	
	DefaultDamagerRepairer  ddr = new DefaultDamagerRepairer( new SQLKeywordScanner( ) );
	reconciler.setDamager( ddr, IDocument.DEFAULT_CONTENT_TYPE );
	reconciler.setRepairer( ddr, IDocument.DEFAULT_CONTENT_TYPE );

	return reconciler;
}
 
Example #4
Source File: TextUMLSourceViewerConfiguration.java    From textuml with Eclipse Public License 1.0 6 votes vote down vote up
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
    final PresentationReconciler reconciler = new PresentationReconciler();
    reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    final SyntaxHighlighter scanner = new SyntaxHighlighter(
            com.abstratt.mdd.frontend.textuml.core.TextUMLConstants.KEYWORDS);
    final DefaultDamagerRepairer dr = new DefaultDamagerRepairer(scanner);
    reconciler.setDamager(dr, ContentTypes.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, ContentTypes.DEFAULT_CONTENT_TYPE);

    // fix bug 2127735 --multiline comment is broken
    final ITokenScanner commentScanner = scanner.getCommentScanner();
    final DefaultDamagerRepairer commentDamagerRepairer = new DefaultDamagerRepairer(commentScanner);
    reconciler.setDamager(commentDamagerRepairer, ContentTypes.COMMENT_CONTENT_TYPE);
    reconciler.setRepairer(commentDamagerRepairer, ContentTypes.COMMENT_CONTENT_TYPE);

    return reconciler;
}
 
Example #5
Source File: TMPresentationReconciler.java    From tm4e with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns the {@link TMPresentationReconciler} of the given text viewer and
 * null otherwise.
 *
 * @param textViewer
 * @return the {@link TMPresentationReconciler} of the given text viewer and
 *         null otherwise.
 */
public static TMPresentationReconciler getTMPresentationReconciler(ITextViewer textViewer) {
	try {
		Field field = SourceViewer.class.getDeclaredField("fPresentationReconciler");
		if (field != null) {
			field.setAccessible(true);
			IPresentationReconciler presentationReconciler = (IPresentationReconciler) field.get(textViewer);
			return presentationReconciler instanceof TMPresentationReconciler
					? (TMPresentationReconciler) presentationReconciler
					: null;
		}
	} catch (Exception e) {
		TMUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, TMUIPlugin.PLUGIN_ID, e.getMessage(), e));
	}
	return null;
}
 
Example #6
Source File: CSVTextSourceViewerConfiguration.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(
        ISourceViewer sourceViewer) {
    PresentationReconciler reconciler = new PresentationReconciler();
    /*
     * Reconciler configuration
     */
    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(new CSVTokenScanner(m_delimiter));
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
    return reconciler;
}
 
Example #7
Source File: AbstractLangBasicSourceViewerConfiguration.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	PresentationReconciler reconciler = createPresentationReconciler();
	reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
	setupPresentationReconciler(reconciler, sourceViewer);
	return reconciler;
}
 
Example #8
Source File: AbstractSimpleLangSourceViewerConfiguration.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	PresentationReconciler reconciler = createPresentationReconciler();
	reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
	setupPresentationReconciler(reconciler, sourceViewer);
	return reconciler;
}
 
Example #9
Source File: TagStyleConfigurator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #10
Source File: TagStyleConfigurator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #11
Source File: TagStyleConfigurator.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private static IPresentationReconciler getPresentationReconciler(CellEditorTextViewer 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;
}
 
Example #12
Source File: TagStyleConfigurator.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #13
Source File: TagStyleConfigurator.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: CompositeSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	PresentationReconciler reconciler = (PresentationReconciler) super.getPresentationReconciler(sourceViewer);

	DefaultDamagerRepairer dr = new ThemeingDamagerRepairer(getStartEndTokenScanner());
	reconciler.setDamager(dr, CompositePartitionScanner.START_SWITCH_TAG);
	reconciler.setRepairer(dr, CompositePartitionScanner.START_SWITCH_TAG);
	reconciler.setDamager(dr, CompositePartitionScanner.END_SWITCH_TAG);
	reconciler.setRepairer(dr, CompositePartitionScanner.END_SWITCH_TAG);

	defaultSourceViewerConfiguration.setupPresentationReconciler(reconciler, sourceViewer);
	primarySourceViewerConfiguration.setupPresentationReconciler(reconciler, sourceViewer);

	return reconciler;
}
 
Example #15
Source File: CommonSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
{
	if (disableBackgroundReconciler)
	{
		return super.getPresentationReconciler(sourceViewer);
	}
	else
	{
		PresentationReconciler reconciler = new CommonPresentationReconciler();
		reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
		return reconciler;
	}
}
 
Example #16
Source File: SimpleSourceViewerConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	PresentationReconciler reconciler = (PresentationReconciler) super.getPresentationReconciler(sourceViewer);
	ISourceViewerConfiguration configuration = this.getSourceViewerConfiguration();

	configuration.setupPresentationReconciler(reconciler, sourceViewer);

	return reconciler;
}
 
Example #17
Source File: GWTSourceViewerConfiguration.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(
    ISourceViewer sourceViewer) {
  PresentationReconciler reconciler = (PresentationReconciler) super.getPresentationReconciler(sourceViewer);

  DefaultDamagerRepairer dr = new DefaultDamagerRepairer(jsniScanner);
  reconciler.setDamager(dr, GWTPartitions.JSNI_METHOD);
  reconciler.setRepairer(dr, GWTPartitions.JSNI_METHOD);

  return reconciler;
}
 
Example #18
Source File: TypeScriptSourceViewerConfiguration.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	if (preferenceStore.getBoolean(TypeScriptUIPreferenceConstants.USE_TEXMATE_FOR_SYNTAX_COLORING)) {
		// Advanced Syntax coloration with TextMate
		return new TMPresentationReconciler();
	}
	// Use classic Eclipse ITokenScaner.
	PresentationReconciler reconciler = (PresentationReconciler) super.getPresentationReconciler(sourceViewer);
	DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getJSXScanner());
	reconciler.setDamager(dr, IJSXPartitions.JSX);
	reconciler.setRepairer(dr, IJSXPartitions.JSX);

	return reconciler;
}
 
Example #19
Source File: HTMLTypeScriptPrinter.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Returns the {@link TMPresentationReconciler} of the given text viewer and
 * null otherwise.
 * 
 * @param textViewer
 * @return the {@link TMPresentationReconciler} of the given text viewer and
 *         null otherwise.
 */
private static TMPresentationReconciler getTMPresentationReconciler(ITextViewer textViewer) {
	try {
		Field field = SourceViewer.class.getDeclaredField("fPresentationReconciler");
		if (field != null) {
			field.setAccessible(true);
			IPresentationReconciler presentationReconciler = (IPresentationReconciler) field.get(textViewer);
			return presentationReconciler instanceof TMPresentationReconciler
					? (TMPresentationReconciler) presentationReconciler : null;
		}
	} catch (Exception e) {

	}
	return null;
}
 
Example #20
Source File: ObligationSourceViewerConfiguration.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * This registers one damager repairer for all content in the source viewer.
 * The damager-repairer scans the content for TLA keywords and sets them to the
 * same color used in the tla editor.
 */
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
{
    PresentationReconciler reconciler = new PresentationReconciler();

    DefaultDamagerRepairer dr = new DefaultDamagerRepairer(TLAEditorActivator.getDefault().getTLACodeScanner());
    reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
    reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

    return reconciler;
}
 
Example #21
Source File: XtendSourceViewerConfiguration.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	XtextPresentationReconciler reconciler = (XtextPresentationReconciler) super
			.getPresentationReconciler(sourceViewer);
	IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
	IColorManager colorManager = JavaPlugin.getDefault().getJavaTextTools().getColorManager();
	JavaDocScanner javaDocScanner = new JavaDocScanner(colorManager, store, null);
	DefaultDamagerRepairer dr = new DefaultDamagerRepairer(javaDocScanner);
	reconciler.setRepairer(dr, TokenTypeToPartitionMapper.JAVA_DOC_PARTITION);
	reconciler.setDamager(dr, TokenTypeToPartitionMapper.JAVA_DOC_PARTITION);
	return reconciler;
}
 
Example #22
Source File: XtextSourceViewerConfiguration.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
	XtextPresentationReconciler reconciler = getPresentationReconcilerProvider().get();
	reconciler.setDocumentPartitioning(getDocumentPartitioning(sourceViewer));
	IPresentationRepairer repairer = repairerProvider.get();
	IPresentationDamager damager = damagerProvider.get();
	String[] types = partitionTypesMapper.getSupportedPartitionTypes();
	for (String partitionType : types) {
		reconciler.setRepairer(repairer, partitionType);
		reconciler.setDamager(damager, partitionType);
	}
	return reconciler;
}
 
Example #23
Source File: TypeScriptViewerConfiguration.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) {
	// Defines a TextMate Presentation reconcilier
	TMPresentationReconciler reconciler = new TMPresentationReconciler();
	// Set the TypeScript grammar
	reconciler.setGrammar(getGrammar());
	//reconciler.setThemeId(ThemeIdConstants.Monokai);
	return reconciler;
}
 
Example #24
Source File: JSXViewerConfiguration.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) {
	// Defines a TextMate Presentation reconcilier
	TMPresentationReconciler reconciler = new TMPresentationReconciler();
	// Set the TypeScript grammar
	reconciler.setGrammar(getGrammar());
	return reconciler;
}
 
Example #25
Source File: Angular2ViewerConfiguration.java    From tm4e with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) {
	// Defines a TextMate Presentation reconcilier
	TMPresentationReconciler reconciler = new TMPresentationReconciler();
	// Set the Angular2 grammar
	reconciler.setGrammar(getGrammar());
	return reconciler;
}
 
Example #26
Source File: HTMLViewerConfiguration.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) {
	// Defines a TextMate Presentation reconcilier
	return new TMPresentationReconciler();
}
 
Example #27
Source File: PHPViewerConfiguration.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) {
	// Defines a TextMate Presentation reconcilier
	return new TMPresentationReconciler();
}
 
Example #28
Source File: PyEditConfigurationWithoutEditor.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {

    synchronized (lock) {
        if (reconciler == null) {
            reconciler = new PyPresentationReconciler();
            reconciler.setDocumentPartitioning(IPythonPartitions.PYTHON_PARTITION_TYPE);

            PyDefaultDamagerRepairer dr;

            // PyDefaultDamagerRepairer implements both IPresentationDamager, IPresentationRepairer
            // IPresentationDamager::getDamageRegion does not scan, just
            // returns the intersection of document event, and partition region
            // IPresentationRepairer::createPresentation scans
            // gets each token, and sets text attributes according to token

            // We need to cover all the content types from PyPartitionScanner

            // Comments have uniform color
            commentScanner = new PyColoredScanner(colorCache, PyDevEditorPreferences.COMMENT_COLOR);
            dr = new PyDefaultDamagerRepairer(commentScanner);
            reconciler.setDamager(dr, IPythonPartitions.PY_COMMENT);
            reconciler.setRepairer(dr, IPythonPartitions.PY_COMMENT);

            // Backquotes have uniform color
            backquotesScanner = new PyColoredScanner(colorCache, PyDevEditorPreferences.BACKQUOTES_COLOR);
            dr = new PyDefaultDamagerRepairer(backquotesScanner);
            reconciler.setDamager(dr, IPythonPartitions.PY_BACKQUOTES);
            reconciler.setRepairer(dr, IPythonPartitions.PY_BACKQUOTES);

            // Strings have uniform color
            stringScanner = new PyStringScanner(colorCache);
            dr = new PyDefaultDamagerRepairer(stringScanner);
            reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_BYTES1);
            reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_BYTES1);
            reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_BYTES2);
            reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_BYTES2);

            reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_BYTES1);
            reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_BYTES1);
            reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_BYTES2);
            reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_BYTES2);

            fStringScanner = new PyFStringScanner(colorCache);
            // We have to damage the whole partition because internal tokens may span
            // multiple lines (i.e.: an expression inside an f-string may have
            // multiple lines).
            dr = new FullPartitionDamagerRepairer(fStringScanner);
            reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_FSTRING1);
            reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_FSTRING1);
            reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_FSTRING2);
            reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_FSTRING2);

            reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_FSTRING1);
            reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_FSTRING1);
            reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_FSTRING2);
            reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_FSTRING2);

            unicodeScanner = new PyUnicodeScanner(colorCache);
            dr = new PyDefaultDamagerRepairer(unicodeScanner);
            reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_UNICODE1);
            reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_UNICODE1);
            reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_UNICODE2);
            reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_UNICODE2);

            reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_UNICODE1);
            reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_UNICODE1);
            reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_UNICODE2);
            reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_UNICODE2);

            bytesOrUnicodeScanner = new PyBytesOrUnicodeScanner(colorCache, grammarVersionProvider, reconciler);
            dr = new PyDefaultDamagerRepairer(bytesOrUnicodeScanner);
            reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_BYTES_OR_UNICODE1);
            reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_BYTES_OR_UNICODE1);
            reconciler.setDamager(dr, IPythonPartitions.PY_SINGLELINE_BYTES_OR_UNICODE2);
            reconciler.setRepairer(dr, IPythonPartitions.PY_SINGLELINE_BYTES_OR_UNICODE2);

            reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_BYTES_OR_UNICODE1);
            reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_BYTES_OR_UNICODE1);
            reconciler.setDamager(dr, IPythonPartitions.PY_MULTILINE_BYTES_OR_UNICODE2);
            reconciler.setRepairer(dr, IPythonPartitions.PY_MULTILINE_BYTES_OR_UNICODE2);

            // Default content is code, we need syntax highlighting
            ICodeScannerKeywords codeScannerKeywords = null;
            if (sourceViewer instanceof IAdaptable) {
                IAdaptable iAdaptable = (IAdaptable) sourceViewer;
                codeScannerKeywords = iAdaptable.getAdapter(ICodeScannerKeywords.class);
                codeScanner = new PyCodeScanner(colorCache, codeScannerKeywords);
            } else {
                codeScanner = new PyCodeScanner(colorCache);
            }
            dr = new PyDefaultDamagerRepairer(codeScanner);
            reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
            reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
        }
    }

    return reconciler;
}
 
Example #29
Source File: FreemarkerViewerConfiguration.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) {
	// Defines a TextMate Presentation reconcilier
	return new TMPresentationReconciler();
}
 
Example #30
Source File: YAMLViewerConfiguration.java    From tm4e with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) {
	// Defines a TextMate Presentation reconcilier
	return new TMPresentationReconciler();
}