/** * Formats one partition after the other using the formatter strategy registered for * the partition's content type. * * @param ranges the partitioning of the document region to be formatted * @since 3.0 */ private void format(TypedPosition[] ranges) { for (TypedPosition range : ranges) { IFormattingStrategy s= getFormattingStrategy(range.getType()); if (s != null) { format(s, range); } } }
/** * Formats one partition after the other using the formatter strategy registered for * the partition's content type. * * @param ranges the partitioning of the document region to be formatted * @since 3.0 */ private void format(TypedPosition[] ranges) { for (int i= 0; i < ranges.length; i++) { IFormattingStrategy s= getFormattingStrategy(ranges[i].getType()); if (s != null) { format(s, ranges[i]); } } }
/** * 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(); } }