Search in sources :

Example 1 with FormatProcessorJSON

use of org.eclipse.wst.json.core.format.FormatProcessorJSON 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)1 MultiPassContentFormatter (org.eclipse.jface.text.formatter.MultiPassContentFormatter)1 FormatProcessorJSON (org.eclipse.wst.json.core.format.FormatProcessorJSON)1 StructuredFormattingStrategy (org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy)1