Search in sources :

Example 1 with ContentFormatter

use of org.eclipse.jface.text.formatter.ContentFormatter in project dbeaver by dbeaver.

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)

Example 2 with ContentFormatter

use of org.eclipse.jface.text.formatter.ContentFormatter in project tmdm-studio-se by Talend.

the class XMLConfiguration method getContentFormatter.

@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
    ContentFormatter formatter = new ContentFormatter();
    formatter.enablePartitionAwareFormatting(false);
    formatter.setFormattingStrategy(new XMLFormattingStrategy(sourceViewer), IDocument.DEFAULT_CONTENT_TYPE);
    return formatter;
}
Also used : XMLFormattingStrategy(com.amalto.workbench.widgets.xmlviewer.format.XMLFormattingStrategy) IContentFormatter(org.eclipse.jface.text.formatter.IContentFormatter) ContentFormatter(org.eclipse.jface.text.formatter.ContentFormatter)

Example 3 with ContentFormatter

use of org.eclipse.jface.text.formatter.ContentFormatter in project jbosstools-hibernate by jbosstools.

the class HQLSourceViewerConfiguration method getContentFormatter.

public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
    ContentFormatter formatter = new ContentFormatter();
    formatter.setDocumentPartitioning(HQL_PARTITIONING);
    IFormattingStrategy formattingStrategy = new HQLFormattingStrategy();
    formatter.setFormattingStrategy(formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE);
    return formatter;
}
Also used : IFormattingStrategy(org.eclipse.jface.text.formatter.IFormattingStrategy) IContentFormatter(org.eclipse.jface.text.formatter.IContentFormatter) ContentFormatter(org.eclipse.jface.text.formatter.ContentFormatter)

Example 4 with ContentFormatter

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

the class PlainTextViewerConfiguration method getContentFormatter.

@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
    ContentFormatter formatter = new ContentFormatter();
    formatter.setDocumentPartitioning(IDocument.DEFAULT_CONTENT_TYPE);
    formatter.enablePartitionAwareFormatting(false);
    return formatter;
}
Also used : IContentFormatter(org.eclipse.jface.text.formatter.IContentFormatter) ContentFormatter(org.eclipse.jface.text.formatter.ContentFormatter)

Example 5 with ContentFormatter

use of org.eclipse.jface.text.formatter.ContentFormatter in project cubrid-manager by CUBRID.

the class SQLViewerConfiguration method getContentFormatter.

/**
	 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentFormatter(org.eclipse.jface.text.source.ISourceViewer)
	 * @param sourceViewer the source viewer to be configured by this
	 *        configuration
	 * @return a content formatter or <code>null</code> if formatting should not
	 *         be supported
	 */
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
    ContentFormatter formatter = new ContentFormatter();
    formatter.setFormattingStrategy(new SqlFormattingStrategy(databaseProvider), IDocument.DEFAULT_CONTENT_TYPE);
    return formatter;
}
Also used : IContentFormatter(org.eclipse.jface.text.formatter.IContentFormatter) ContentFormatter(org.eclipse.jface.text.formatter.ContentFormatter) SqlFormattingStrategy(com.cubrid.common.ui.query.format.SqlFormattingStrategy)

Aggregations

ContentFormatter (org.eclipse.jface.text.formatter.ContentFormatter)9 IContentFormatter (org.eclipse.jface.text.formatter.IContentFormatter)9 IFormattingStrategy (org.eclipse.jface.text.formatter.IFormattingStrategy)5 XMLFormattingStrategy (com.amalto.workbench.widgets.xmlviewer.format.XMLFormattingStrategy)1 SqlFormattingStrategy (com.cubrid.common.ui.query.format.SqlFormattingStrategy)1