Eclipse Platform
Luna (4.4)

Package org.eclipse.jface.text.formatter

Provides a content formatter add-on for an ITextViewer.

See: Description

Package org.eclipse.jface.text.formatter Description

Provides a content formatter add-on for an ITextViewer. A content formatter changes the formatting of a document region while preserving and correctly updating the positions of the document.

Package Specification

IContentFormatter defines the concept of a text formatter. It collaborates with content type specific formatting stratgies (IFormattingStrategy) which for a given document region format the subregion with the matching content type. The package contains a default implementation of IContentFormatter (ContentFormatter).
Additionally, an implementation of IContentFormatterExtension is provided for text edit based formatting strategies. This implementation only accepts formatting strategies implementing the extension interface IFormattingStrategyExtension. These formatting strategies are required to handle the position updating of the document. To facilitate the work with these text edit based formatting strategies, a default implementation called ContextBasedFormattingStrategy is provided. Formatting strategies inheriting from this class are text edit based and behave context dependent. Depending on the formatting context that is passed to the content formatter, different preferences and modes can be used to format different parts of a document.

To set up a proper working text edit based content formatter, the following steps are needed:

Eclipse Platform
Luna (4.4)

Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.