public class FormatterRequest
extends java.lang.Object
A request tells the formatter what and how to format.
When invoking the formatter, the request is passed into IFormatter2.format(FormatterRequest)
.
A request carries information about:
textRegionAccess
which allows to obtain the to-be-formatted semantic model with text regions.Preferences
with keys from e.g. FormatterPreferenceKeys
.regions
that describe how to restrict the text regions for which replacements
are produced.allowIdentityEdits()
which will disable automated suppression of text replacements that do
not cause changes.formatUndefinedHiddenRegionsOnly
): only format regions that have
no whitespace information yet.Constructor and Description |
---|
FormatterRequest() |
Modifier and Type | Method and Description |
---|---|
FormatterRequest |
addRegion(ITextRegion region) |
boolean |
allowIdentityEdits() |
IAcceptor<java.lang.Exception> |
getExceptionHandler() |
ITypedPreferenceValues |
getPreferences() |
java.util.Collection<ITextRegion> |
getRegions() |
ITextRegionAccess |
getTextRegionAccess() |
boolean |
isFormatUndefinedHiddenRegionsOnly() |
FormatterRequest |
setAllowIdentityEdits(boolean allowIdentityEdits) |
FormatterRequest |
setExceptionHandler(IAcceptor<java.lang.Exception> problemHandler) |
FormatterRequest |
setFormatUndefinedHiddenRegionsOnly(boolean formatUndefinedHiddenRegionsOnly) |
FormatterRequest |
setPreferences(ITypedPreferenceValues preferenceValues) |
FormatterRequest |
setRegions(java.util.Collection<ITextRegion> regions) |
FormatterRequest |
setTextRegionAccess(ITextRegionAccess tokens)
Sets the
textRegionAccess . |
public FormatterRequest addRegion(ITextRegion region)
regions
public FormatterRequest setRegions(java.util.Collection<ITextRegion> regions)
regions
public java.util.Collection<ITextRegion> getRegions()
regions
public ITextRegionAccess getTextRegionAccess()
textRegionAccess
public FormatterRequest setTextRegionAccess(ITextRegionAccess tokens)
textRegionAccess
. If the region has syntax errors and no explicit ExceptionAcceptor
is
configured yet, the ignoring acceptor
will be configured.public FormatterRequest setAllowIdentityEdits(boolean allowIdentityEdits)
allowIdentityEdits
public boolean allowIdentityEdits()
allowIdentityEdits
public FormatterRequest setPreferences(ITypedPreferenceValues preferenceValues)
preferences
public ITypedPreferenceValues getPreferences()
preferences
public boolean isFormatUndefinedHiddenRegionsOnly()
formatUndefinedHiddenRegionsOnly
public FormatterRequest setFormatUndefinedHiddenRegionsOnly(boolean formatUndefinedHiddenRegionsOnly)
formatUndefinedHiddenRegionsOnly
public IAcceptor<java.lang.Exception> getExceptionHandler()
exceptionHandler
public FormatterRequest setExceptionHandler(IAcceptor<java.lang.Exception> problemHandler)
exceptionHandler