/** * Determines the partitioning of the given region of the document. * Informs the formatting strategies of each partition about the start, * the process, and the termination of the formatting session. * * @param region the document region to be formatted * @since 3.0 */ private void formatPartitions(IRegion region) { addPartitioningUpdater(); try { TypedPosition[] ranges= getPartitioning(region); if (ranges != null) { start(ranges, getIndentation(region.getOffset())); format(ranges); stop(ranges); } } catch (BadLocationException x) { } removePartitioningUpdater(); }
/** * Determines the partitioning of the given region of the document. * Informs the formatting strategies of each partition about the start, * the process, and the termination of the formatting session. * * @param region the document region to be formatted * @since 3.0 */ private void formatPartitions(IRegion region) { addPartitioningUpdater(); try { TypedPosition[] ranges= getPartitioning(region); if (ranges != null) { start(ranges, getIndentation(region.getOffset())); format(ranges); stop(ranges); } } catch (BadLocationException x) { } removePartitioningUpdater(); }
/** * Formats the given region with the strategy registered for the default * content type. The strategy is informed about the start, the process, and * the termination of the formatting session. * * @param region the region to be formatted * @since 3.0 */ private void formatRegion(IRegion region) { IFormattingStrategy strategy= getFormattingStrategy(IDocument.DEFAULT_CONTENT_TYPE); if (strategy != null) { strategy.formatterStarts(getIndentation(region.getOffset())); format(strategy, new TypedPosition(region.getOffset(), region.getLength(), IDocument.DEFAULT_CONTENT_TYPE)); strategy.formatterStops(); } }
/** * Formats the given region with the strategy registered for the default * content type. The strategy is informed about the start, the process, and * the termination of the formatting session. * * @param region the region to be formatted * @since 3.0 */ private void formatRegion(IRegion region) { IFormattingStrategy strategy= getFormattingStrategy(IDocument.DEFAULT_CONTENT_TYPE); if (strategy != null) { strategy.formatterStarts(getIndentation(region.getOffset())); format(strategy, new TypedPosition(region.getOffset(), region.getLength(), IDocument.DEFAULT_CONTENT_TYPE)); strategy.formatterStops(); } }
String formatted= strategy.format(content, isLineStart(offset), getIndentation(offset), positions);
String formatted= strategy.format(content, isLineStart(offset), getIndentation(offset), positions);