public abstract class ContextBasedFormattingStrategy extends Object implements IFormattingStrategy, IFormattingStrategyExtension
FormattingContextProperties.CONTEXT_PREFERENCES
property and makes them available to subclasses.
Constructor and Description |
---|
ContextBasedFormattingStrategy() |
Modifier and Type | Method and Description |
---|---|
void |
format()
Formats the region with the properties indicated in the formatting
context previously supplied by
formatterStarts(IFormattingContext) . |
String |
format(String content,
boolean start,
String indentation,
int[] positions)
Formats the given string.
|
void |
formatterStarts(IFormattingContext context)
Informs the strategy about the start of a formatting process in which it will participate.
|
void |
formatterStarts(String indentation)
Informs the strategy about the start of a formatting process in which it will
participate.
|
void |
formatterStops()
Informs the strategy that the formatting process in which it has participated
has been finished.
|
Map |
getPreferences()
Returns the preferences used for the current formatting step.
|
public void format()
IFormattingStrategyExtension
formatterStarts(IFormattingContext)
.format
in interface IFormattingStrategyExtension
public String format(String content, boolean start, String indentation, int[] positions)
IFormattingStrategy
format
in interface IFormattingStrategy
content
- the initial string to be formattedstart
- indicates whether the beginning of content is a line start in its documentindentation
- the indentation string to be usedpositions
- the character positions to be updatedpublic void formatterStarts(IFormattingContext context)
IFormattingStrategyExtension
formatterStarts
in interface IFormattingStrategyExtension
context
- the formatting context used in the corresponding formatting process.public void formatterStarts(String indentation)
IFormattingStrategy
formatterStarts
in interface IFormattingStrategy
indentation
- the indent string of the first line at which the
overall formatting process starts.public void formatterStops()
IFormattingStrategy
formatterStops
in interface IFormattingStrategy
formatterStops
in interface IFormattingStrategyExtension
public final Map getPreferences()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.