Search in sources :

Example 1 with StructuredFormattingStrategy

use of org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy 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 2 with StructuredFormattingStrategy

use of org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy in project webtools.sourceediting by eclipse.

the class StructuredTextViewerConfigurationCSS method getContentFormatter.

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

Example 3 with StructuredFormattingStrategy

use of org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy in project webtools.sourceediting by eclipse.

the class StructuredTextViewerConfigurationJSON method getContentFormatter.

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

Aggregations

IContentFormatter (org.eclipse.jface.text.formatter.IContentFormatter)3 MultiPassContentFormatter (org.eclipse.jface.text.formatter.MultiPassContentFormatter)3 StructuredFormattingStrategy (org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy)3 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