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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations