use of org.eclipse.jface.text.rules.FastPartitioner in project dbeaver by serge-rider.
the class XMLEditor method setupDocument.
private void setupDocument() {
IDocument document = getDocument();
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT });
partitioner.connect(document);
((IDocumentExtension3) document).setDocumentPartitioner(XMLPartitionScanner.XML_PARTITIONING, partitioner);
}
}
use of org.eclipse.jface.text.rules.FastPartitioner in project dbeaver by serge-rider.
the class JSONTextEditor method setupDocument.
private void setupDocument() {
IDocument document = getDocument();
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new JSONPartitionScanner(), new String[] { JSONPartitionScanner.JSON_STRING });
partitioner.connect(document);
((IDocumentExtension3) document).setDocumentPartitioner(JSONPartitionScanner.JSON_PARTITIONING, partitioner);
}
}
use of org.eclipse.jface.text.rules.FastPartitioner in project dbeaver by serge-rider.
the class SQLEditorBase method reloadSyntaxRules.
public void reloadSyntaxRules() {
// Refresh syntax
SQLDialect dialect = getSQLDialect();
IDocument document = getDocument();
syntaxManager.init(dialect, getActivePreferenceStore());
SQLRuleManager ruleManager = new SQLRuleManager(syntaxManager);
ruleManager.loadRules(getDataSource(), SQLEditorBase.isBigScript(getEditorInput()));
ruleScanner.refreshRules(getDataSource(), ruleManager);
parserContext = new SQLParserContext(SQLEditorBase.this, syntaxManager, ruleManager, document != null ? document : new Document());
if (document instanceof IDocumentExtension3) {
IDocumentPartitioner partitioner = new FastPartitioner(new SQLPartitionScanner(getDataSource(), dialect), SQLParserPartitions.SQL_CONTENT_TYPES);
partitioner.connect(document);
try {
((IDocumentExtension3) document).setDocumentPartitioner(SQLParserPartitions.SQL_PARTITIONING, partitioner);
} catch (Throwable e) {
// $NON-NLS-1$
log.warn("Error setting SQL partitioner", e);
}
ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
if (projectionViewer != null && projectionViewer.getAnnotationModel() != null && document.getLength() > 0) {
// projectionViewer.getTextWidget().redraw();
try {
projectionViewer.reinitializeProjection();
} catch (Throwable ex) {
// We can catch OutOfMemory here for too big/complex documents
// $NON-NLS-1$
log.warn("Can't initialize SQL syntax projection", ex);
}
}
}
final IVerticalRuler verticalRuler = getVerticalRuler();
// Update configuration
if (getSourceViewerConfiguration() instanceof SQLEditorSourceViewerConfiguration) {
((SQLEditorSourceViewerConfiguration) getSourceViewerConfiguration()).onDataSourceChange();
}
if (verticalRuler != null) {
verticalRuler.update();
}
}
use of org.eclipse.jface.text.rules.FastPartitioner in project dbeaver by dbeaver.
the class JSONTextEditor method setupDocument.
private void setupDocument() {
IDocument document = getDocument();
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new JSONPartitionScanner(), new String[] { JSONPartitionScanner.JSON_STRING });
partitioner.connect(document);
((IDocumentExtension3) document).setDocumentPartitioner(JSONPartitionScanner.JSON_PARTITIONING, partitioner);
}
}
use of org.eclipse.jface.text.rules.FastPartitioner in project dbeaver by dbeaver.
the class XMLEditor method setupDocument.
private void setupDocument() {
IDocument document = getDocument();
if (document != null) {
IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT });
partitioner.connect(document);
((IDocumentExtension3) document).setDocumentPartitioner(XMLPartitionScanner.XML_PARTITIONING, partitioner);
}
}
Aggregations