Java Code Examples for org.eclipse.jface.text.presentation.PresentationReconciler#setRepairer()

The following examples show how to use org.eclipse.jface.text.presentation.PresentationReconciler#setRepairer() . 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: 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 2
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 3
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 4
Source File: DTDSourceConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void setupPresentationReconciler(PresentationReconciler reconciler, ISourceViewer sourceViewer) {
	NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(getToken("#text")); //$NON-NLS-1$
	reconciler.setDamager(ndr, IDocument.DEFAULT_CONTENT_TYPE);
	reconciler.setRepairer(ndr, IDocument.DEFAULT_CONTENT_TYPE);

	reconciler.setDamager(ndr, DEFAULT);
	reconciler.setRepairer(ndr, DEFAULT);

	DefaultDamagerRepairer dr = new ThemeingDamagerRepairer(getPIScanner());
	reconciler.setDamager(dr, PI);
	reconciler.setRepairer(dr, PI);

	reconciler.setDamager(dr, PROLOG);
	reconciler.setRepairer(dr, PROLOG);

	dr = new ThemeingDamagerRepairer(getDTDTagScanner());
	reconciler.setDamager(dr, TAG);
	reconciler.setRepairer(dr, TAG);

	reconciler.setDamager(dr, SECTION);
	reconciler.setRepairer(dr, SECTION);

	dr = new ThemeingDamagerRepairer(getCommentScanner());
	reconciler.setDamager(dr, COMMENT);
	reconciler.setRepairer(dr, COMMENT);
}
 
Example 5
Source File: CSSSourceConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void setupPresentationReconciler(PresentationReconciler reconciler, ISourceViewer sourceViewer)
{
	DefaultDamagerRepairer dr = new ThemeingDamagerRepairer(new CSSCodeScannerFlex());
	reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
	reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

	reconciler.setDamager(dr, DEFAULT);
	reconciler.setRepairer(dr, DEFAULT);

	dr = new ThemeingDamagerRepairer(getCommentScanner());
	reconciler.setDamager(dr, MULTILINE_COMMENT);
	reconciler.setRepairer(dr, MULTILINE_COMMENT);

	dr = new ThemeingDamagerRepairer(getStringScanner());
	reconciler.setDamager(dr, STRING_DOUBLE);
	reconciler.setRepairer(dr, STRING_DOUBLE);

	dr = new ThemeingDamagerRepairer(getStringScanner());
	reconciler.setDamager(dr, STRING_SINGLE);
	reconciler.setRepairer(dr, STRING_SINGLE);
}
 
Example 6
Source File: AbstractSimpleLangSourceViewerConfiguration.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void setupPresentationReconciler(PresentationReconciler reconciler, ISourceViewer sourceViewer) {
	// Must be called from UI thread
	assertTrue(Display.getCurrent() != null);
	
	// Create a token registry for given sourceViewer
	TokenRegistry tokenRegistry = new TokenRegistry(colorManager, stylingPrefs) {
		@Override
		protected void handleTokenModified(Token token) {
			sourceViewer.invalidateTextPresentation();
		}
	};
	addConfigurationScopedOwned(sourceViewer, tokenRegistry);
	
	ArrayList2<AbstractLangScanner> scanners = new ArrayList2<>();
	
	for(LangPartitionTypes partitionType : getPartitionTypes()) {
		
		String contentType = partitionType.getId();
		AbstractLangScanner scanner = createScannerFor(Display.getCurrent(), partitionType, tokenRegistry);
		scanners.add(scanner);
		
		DefaultDamagerRepairer dr = getDamagerRepairer(scanner, contentType);
		reconciler.setDamager(dr, contentType);
		reconciler.setRepairer(dr, contentType);
	}
	
}
 
Example 7
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 8
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 9
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 10
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 11
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 12
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 13
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 14
Source File: JSSourceConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void setupPresentationReconciler(PresentationReconciler reconciler, ISourceViewer sourceViewer)
{
	DefaultDamagerRepairer dr = new ThemeingDamagerRepairer(getCodeScanner());
	reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
	reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);

	reconciler.setDamager(dr, DEFAULT);
	reconciler.setRepairer(dr, DEFAULT);

	dr = new ThemeingDamagerRepairer(getJSDocScanner());
	reconciler.setDamager(dr, JS_DOC);
	reconciler.setRepairer(dr, JS_DOC);

	dr = new ThemeingDamagerRepairer(getMultiLineCommentScanner());
	reconciler.setDamager(dr, JS_MULTILINE_COMMENT);
	reconciler.setRepairer(dr, JS_MULTILINE_COMMENT);

	dr = new ThemeingDamagerRepairer(getSingleQuotedStringScanner());
	reconciler.setDamager(dr, STRING_SINGLE);
	reconciler.setRepairer(dr, STRING_SINGLE);

	dr = new ThemeingDamagerRepairer(getDoubleQuotedStringScanner());
	reconciler.setDamager(dr, STRING_DOUBLE);
	reconciler.setRepairer(dr, STRING_DOUBLE);

	dr = new ThemeingDamagerRepairer(getSingleLineCommentScanner());
	reconciler.setDamager(dr, JS_SINGLELINE_COMMENT);
	reconciler.setRepairer(dr, JS_SINGLELINE_COMMENT);

	dr = new ThemeingDamagerRepairer(getRegexpScanner());
	reconciler.setDamager(dr, JS_REGEXP);
	reconciler.setRepairer(dr, JS_REGEXP);
}
 
Example 15
Source File: XMLSourceConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void setupPresentationReconciler(PresentationReconciler reconciler, ISourceViewer sourceViewer)
{
	DTDSourceConfiguration.getDefault().setupPresentationReconciler(reconciler, sourceViewer);

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

	reconciler.setDamager(dr, DEFAULT);
	reconciler.setRepairer(dr, DEFAULT);

	dr = new ThemeingDamagerRepairer(getPreProcessorScanner());
	reconciler.setDamager(dr, PRE_PROCESSOR);
	reconciler.setRepairer(dr, PRE_PROCESSOR);

	dr = new ThemeingDamagerRepairer(getCDATAScanner());
	reconciler.setDamager(dr, CDATA);
	reconciler.setRepairer(dr, CDATA);

	dr = new ThemeingDamagerRepairer(getXMLTagScanner());
	reconciler.setDamager(dr, TAG);
	reconciler.setRepairer(dr, TAG);

	dr = new ThemeingDamagerRepairer(getCommentScanner());
	reconciler.setDamager(dr, COMMENT);
	reconciler.setRepairer(dr, COMMENT);
}
 
Example 16
Source File: SVGSourceConfiguration.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void setupPresentationReconciler(PresentationReconciler reconciler, ISourceViewer sourceViewer)
{
	JSSourceConfiguration.getDefault().setupPresentationReconciler(reconciler, sourceViewer);
	CSSSourceConfiguration.getDefault().setupPresentationReconciler(reconciler, sourceViewer);

	DefaultDamagerRepairer dr = new ThemeingDamagerRepairer(getXMLScanner());
	reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
	reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
	reconciler.setDamager(dr, DEFAULT);
	reconciler.setRepairer(dr, DEFAULT);

	DefaultDamagerRepairer preprocessorScanner = new ThemeingDamagerRepairer(getPreProcessorScanner());
	reconciler.setDamager(preprocessorScanner, PRE_PROCESSOR);
	reconciler.setRepairer(preprocessorScanner, PRE_PROCESSOR);

	DefaultDamagerRepairer cdataScanner = new ThemeingDamagerRepairer(getCDATAScanner());
	reconciler.setDamager(cdataScanner, CDATA);
	reconciler.setRepairer(cdataScanner, CDATA);

	DefaultDamagerRepairer tagScanner = new ThemeingDamagerRepairer(getXMLTagScanner());
	reconciler.setDamager(tagScanner, SCRIPT);
	reconciler.setRepairer(tagScanner, SCRIPT);
	reconciler.setDamager(tagScanner, STYLE);
	reconciler.setRepairer(tagScanner, STYLE);
	reconciler.setDamager(tagScanner, TAG);
	reconciler.setRepairer(tagScanner, TAG);

	DefaultDamagerRepairer commentScanner = new ThemeingDamagerRepairer(getCommentScanner());
	reconciler.setDamager(commentScanner, XMLSourceConfiguration.COMMENT);
	reconciler.setRepairer(commentScanner, XMLSourceConfiguration.COMMENT);
}
 
Example 17
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 18
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 19
Source File: LogFileViewer.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
private void createAndInstallPresentationReconciler() {
    presentationReconciler = new PresentationReconciler();
    DamageRepairer dr = new DamageRepairer(new DynamicRuleBasedScanner(store.getString(ILogViewerConstants.PREF_COLORING_ITEMS)));
    presentationReconciler.setDamager(dr,IDocument.DEFAULT_CONTENT_TYPE);
    presentationReconciler.setRepairer(dr,IDocument.DEFAULT_CONTENT_TYPE);
    presentationReconciler.install(txtViewer);
}
 
Example 20
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;
}