Search in sources :

Example 1 with IFormattingStrategy

use of org.eclipse.jface.text.formatter.IFormattingStrategy in project dbeaver by serge-rider.

the class SQLEditorSourceViewerConfiguration method getContentFormatter.

/**
     * Creates, configures, and returns the ContentFormatter to use.
     *
     * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentFormatter(ISourceViewer)
     */
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
    ContentFormatter formatter = new ContentFormatter();
    formatter.setDocumentPartitioning(SQLPartitionScanner.SQL_PARTITIONING);
    IFormattingStrategy formattingStrategy = new SQLFormattingStrategy(sourceViewer, this, editor.getSyntaxManager());
    for (String ct : SQLPartitionScanner.SQL_CONTENT_TYPES) {
        formatter.setFormattingStrategy(formattingStrategy, ct);
    }
    formatter.enablePartitionAwareFormatting(false);
    return formatter;
}
Also used : IFormattingStrategy(org.eclipse.jface.text.formatter.IFormattingStrategy) ContentFormatter(org.eclipse.jface.text.formatter.ContentFormatter) IContentFormatter(org.eclipse.jface.text.formatter.IContentFormatter)

Aggregations

ContentFormatter (org.eclipse.jface.text.formatter.ContentFormatter)1 IContentFormatter (org.eclipse.jface.text.formatter.IContentFormatter)1 IFormattingStrategy (org.eclipse.jface.text.formatter.IFormattingStrategy)1