use of com.intellij.formatting.FormatProcessor.FormatOptions in project intellij-community by JetBrains.
the class FormatterImpl method buildProcessorAndWrapBlocks.
private static FormatProcessor buildProcessorAndWrapBlocks(final FormattingDocumentModel docModel, Block rootBlock, CodeStyleSettings settings, CommonCodeStyleSettings.IndentOptions indentOptions, @Nullable FormatTextRanges affectedRanges, int interestingOffset) {
FormatOptions options = new FormatOptions(settings, indentOptions, affectedRanges, false, interestingOffset);
FormatProcessor processor = new FormatProcessor(docModel, rootBlock, options, FormattingProgressCallback.EMPTY);
while (!processor.iteration()) ;
return processor;
}
use of com.intellij.formatting.FormatProcessor.FormatOptions in project intellij-community by JetBrains.
the class FormatterImpl method format.
public void format(final FormattingModel model, final CodeStyleSettings settings, final CommonCodeStyleSettings.IndentOptions indentOptions, final FormatTextRanges affectedRanges, final boolean formatContextAroundRanges) throws IncorrectOperationException {
try {
validateModel(model);
SequentialTask task = new MyFormattingTask() {
@NotNull
@Override
protected FormatProcessor buildProcessor() {
FormatOptions options = new FormatOptions(settings, indentOptions, affectedRanges, formatContextAroundRanges);
FormatProcessor processor = new FormatProcessor(model.getDocumentModel(), model.getRootBlock(), options, getProgressCallback());
processor.format(model, true);
return processor;
}
};
execute(task);
} catch (FormattingModelInconsistencyException e) {
LOG.error(e);
}
}
Aggregations