Search in sources :

Example 1 with IContentFormatter

use of org.eclipse.jface.text.formatter.IContentFormatter 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 IContentFormatter

use of org.eclipse.jface.text.formatter.IContentFormatter 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 IContentFormatter

use of org.eclipse.jface.text.formatter.IContentFormatter 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 IContentFormatter

use of org.eclipse.jface.text.formatter.IContentFormatter in project webtools.sourceediting by eclipse.

the class StructuredTextViewerConfigurationHTML method getContentFormatter.

public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
    IContentFormatter formatter = super.getContentFormatter(sourceViewer);
    // generic one
    if (!(formatter instanceof MultiPassContentFormatter))
        formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), IHTMLPartitions.HTML_DEFAULT);
    ((MultiPassContentFormatter) formatter).setMasterStrategy(new StructuredFormattingStrategy(new HTMLFormatProcessorImpl()));
    return formatter;
}
Also used : IContentFormatter(org.eclipse.jface.text.formatter.IContentFormatter) HTMLFormatProcessorImpl(org.eclipse.wst.html.core.internal.format.HTMLFormatProcessorImpl) MultiPassContentFormatter(org.eclipse.jface.text.formatter.MultiPassContentFormatter) StructuredFormattingStrategy(org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy)

Example 5 with IContentFormatter

use of org.eclipse.jface.text.formatter.IContentFormatter in project webtools.sourceediting by eclipse.

the class StructuredTextViewerConfigurationJSP method getContentFormatter.

public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
    IContentFormatter formatter = super.getContentFormatter(sourceViewer);
    // generic one
    if (!(formatter instanceof MultiPassContentFormatter))
        formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), IXMLPartitions.XML_DEFAULT);
    MultiPassContentFormatter multiFormatter = (MultiPassContentFormatter) formatter;
    multiFormatter.setMasterStrategy(new StructuredFormattingStrategyJSP());
    multiFormatter.setSlaveStrategy(new FormattingStrategyJSPJava(), IJSPPartitions.JSP_CONTENT_JAVA);
    return formatter;
}
Also used : FormattingStrategyJSPJava(org.eclipse.jst.jsp.ui.internal.format.FormattingStrategyJSPJava) IContentFormatter(org.eclipse.jface.text.formatter.IContentFormatter) StructuredFormattingStrategyJSP(org.eclipse.jst.jsp.ui.internal.format.StructuredFormattingStrategyJSP) MultiPassContentFormatter(org.eclipse.jface.text.formatter.MultiPassContentFormatter)

Aggregations

IContentFormatter (org.eclipse.jface.text.formatter.IContentFormatter)20 ContentFormatter (org.eclipse.jface.text.formatter.ContentFormatter)9 IFormattingStrategy (org.eclipse.jface.text.formatter.IFormattingStrategy)5 MultiPassContentFormatter (org.eclipse.jface.text.formatter.MultiPassContentFormatter)5 StructuredFormattingStrategy (org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy)3 XMLFormattingStrategy (com.amalto.workbench.widgets.xmlviewer.format.XMLFormattingStrategy)1 SqlFormattingStrategy (com.cubrid.common.ui.query.format.SqlFormattingStrategy)1 IDocument (org.eclipse.jface.text.IDocument)1 IDocumentExtension3 (org.eclipse.jface.text.IDocumentExtension3)1 IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)1 FormattingStrategyJSPJava (org.eclipse.jst.jsp.ui.internal.format.FormattingStrategyJSPJava)1 StructuredFormattingStrategyJSP (org.eclipse.jst.jsp.ui.internal.format.StructuredFormattingStrategyJSP)1 FormatProcessorCSS (org.eclipse.wst.css.core.internal.format.FormatProcessorCSS)1 HTMLFormatProcessorImpl (org.eclipse.wst.html.core.internal.format.HTMLFormatProcessorImpl)1 FormatProcessorJSON (org.eclipse.wst.json.core.format.FormatProcessorJSON)1 StructuredTextPartitioner (org.eclipse.wst.sse.core.internal.text.rules.StructuredTextPartitioner)1 XMLFormattingStrategy (org.eclipse.wst.xml.ui.internal.XMLFormattingStrategy)1