public abstract class FormattableDocument extends java.lang.Object implements IFormattableDocument
Modifier | Constructor and Description |
---|---|
protected |
FormattableDocument() |
Modifier and Type | Method and Description |
---|---|
void |
addReplacer(ITextReplacer replacer)
Add a new replacer to the document.
|
ISemanticRegion |
append(ISemanticRegion token,
Procedures.Procedure1<? super IHiddenRegionFormatter> after)
Create a new
IHiddenRegionFormatting , initialize it, and add it behind the given semanticRegion. |
<T extends org.eclipse.emf.ecore.EObject> |
append(T owner,
Procedures.Procedure1<? super IHiddenRegionFormatter> after)
Create a new
IHiddenRegionFormatting , initialize it, and add it behind the given semantic object. |
protected java.lang.String |
applyTextReplacements(java.lang.Iterable<ITextReplacement> replacements) |
protected ITextReplacerContext |
createReplacements(ITextReplacerContext previous) |
protected TextSegmentSet<ITextReplacer> |
createTextReplacerSet() |
<T> T |
format(T obj) |
void |
formatConditionally(org.eclipse.emf.ecore.EObject owner,
ISubFormatter... formatters)
Apply the formatting of the first sub formatter that can successfully format the given owner's region.
|
void |
formatConditionally(int offset,
int length,
ISubFormatter... formatters)
Apply the formatting of the first sub formatter that can successfully format the given region.
|
ITypedPreferenceValues |
getPreferences() |
ITextRegionAccess |
getTextRegionAccess() |
<T1 extends ISemanticRegion,T2 extends ISemanticRegion> |
interior(Pair<T1,T2> pair,
Procedures.Procedure1<? super IHiddenRegionFormatter> init) |
<T1 extends ISemanticRegion,T2 extends ISemanticRegion> |
interior(T1 first,
T2 second,
Procedures.Procedure1<? super IHiddenRegionFormatter> init) |
<T extends org.eclipse.emf.ecore.EObject> |
interior(T object,
Procedures.Procedure1<? super IHiddenRegionFormatter> init) |
protected boolean |
needsAutowrap(ITextReplacerContext wrappable,
ITextReplacerContext context,
int maxLineWidth) |
ISemanticRegion |
prepend(ISemanticRegion token,
Procedures.Procedure1<? super IHiddenRegionFormatter> before)
Create a new
IHiddenRegionFormatting , initialize it, and add it before the given semanticRegion. |
<T extends org.eclipse.emf.ecore.EObject> |
prepend(T owner,
Procedures.Procedure1<? super IHiddenRegionFormatter> before)
Create a new
IHiddenRegionFormatting , initialize it, and add it before the given semantic object. |
java.util.List<ITextReplacement> |
renderToTextReplacements()
Render the document.
|
Pair<IHiddenRegion,IHiddenRegion> |
set(IHiddenRegion first,
IHiddenRegion second,
Procedures.Procedure1<? super IHiddenRegionFormatter> init) |
IHiddenRegion |
set(IHiddenRegion hiddenRegion,
Procedures.Procedure1<? super IHiddenRegionFormatter> init)
Create a new
IHiddenRegionFormatting , initialize it, and add it for the given hidden region. |
ISemanticRegion |
surround(ISemanticRegion token,
Procedures.Procedure1<? super IHiddenRegionFormatter> beforeAndAfter)
Create a new
IHiddenRegionFormatting , initialize it, and add it before and after the given semantic
region. |
<T extends org.eclipse.emf.ecore.EObject> |
surround(T owner,
Procedures.Procedure1<? super IHiddenRegionFormatter> beforeAndAfter)
Create a new
IHiddenRegionFormatting , initialize it, and add it before and after the given semantic
object. |
java.lang.String |
toString() |
IFormattableSubDocument |
withReplacerFilter(com.google.common.base.Predicate<? super ITextReplacer> filter)
Creates a new formattable document to which only replacers can be added for which the provided predicate yields
true . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFormatter, getRegion, getRequest
public void addReplacer(ITextReplacer replacer)
IFormattableDocument
addReplacer
in interface IFormattableDocument
public ISemanticRegion append(ISemanticRegion token, Procedures.Procedure1<? super IHiddenRegionFormatter> after)
IFormattableDocument
IHiddenRegionFormatting
, initialize it, and add it behind the given semanticRegion.
Returns the given semantic region.append
in interface IFormattableDocument
public <T extends org.eclipse.emf.ecore.EObject> T append(T owner, Procedures.Procedure1<? super IHiddenRegionFormatter> after)
IFormattableDocument
IHiddenRegionFormatting
, initialize it, and add it behind the given semantic object.
Returns the given semantic object.append
in interface IFormattableDocument
protected java.lang.String applyTextReplacements(java.lang.Iterable<ITextReplacement> replacements)
protected ITextReplacerContext createReplacements(ITextReplacerContext previous)
protected TextSegmentSet<ITextReplacer> createTextReplacerSet()
public <T> T format(T obj)
format
in interface IFormattableDocument
public void formatConditionally(org.eclipse.emf.ecore.EObject owner, ISubFormatter... formatters)
IFormattableDocument
FormattingNotApplicableException
.formatConditionally
in interface IFormattableDocument
public void formatConditionally(int offset, int length, ISubFormatter... formatters) throws FormattingNotApplicableException
IFormattableDocument
FormattingNotApplicableException
.formatConditionally
in interface IFormattableDocument
FormattingNotApplicableException
public ITypedPreferenceValues getPreferences()
public ITextRegionAccess getTextRegionAccess()
public <T1 extends ISemanticRegion,T2 extends ISemanticRegion> Pair<T1,T2> interior(Pair<T1,T2> pair, Procedures.Procedure1<? super IHiddenRegionFormatter> init)
interior
in interface IFormattableDocument
public <T extends org.eclipse.emf.ecore.EObject> T interior(T object, Procedures.Procedure1<? super IHiddenRegionFormatter> init)
interior
in interface IFormattableDocument
public <T1 extends ISemanticRegion,T2 extends ISemanticRegion> Pair<T1,T2> interior(T1 first, T2 second, Procedures.Procedure1<? super IHiddenRegionFormatter> init)
interior
in interface IFormattableDocument
protected boolean needsAutowrap(ITextReplacerContext wrappable, ITextReplacerContext context, int maxLineWidth)
public ISemanticRegion prepend(ISemanticRegion token, Procedures.Procedure1<? super IHiddenRegionFormatter> before)
IFormattableDocument
IHiddenRegionFormatting
, initialize it, and add it before the given semanticRegion.
Returns the given semantic region.prepend
in interface IFormattableDocument
public <T extends org.eclipse.emf.ecore.EObject> T prepend(T owner, Procedures.Procedure1<? super IHiddenRegionFormatter> before)
IFormattableDocument
IHiddenRegionFormatting
, initialize it, and add it before the given semantic object.
Returns the given semantic object.prepend
in interface IFormattableDocument
public java.util.List<ITextReplacement> renderToTextReplacements()
IFormattableDocument
renderToTextReplacements
in interface IFormattableDocument
public Pair<IHiddenRegion,IHiddenRegion> set(IHiddenRegion first, IHiddenRegion second, Procedures.Procedure1<? super IHiddenRegionFormatter> init)
set
in interface IFormattableDocument
public IHiddenRegion set(IHiddenRegion hiddenRegion, Procedures.Procedure1<? super IHiddenRegionFormatter> init)
IFormattableDocument
IHiddenRegionFormatting
, initialize it, and add it for the given hidden region.
Returns the given hidden region.set
in interface IFormattableDocument
public ISemanticRegion surround(ISemanticRegion token, Procedures.Procedure1<? super IHiddenRegionFormatter> beforeAndAfter)
IFormattableDocument
IHiddenRegionFormatting
, initialize it, and add it before and after the given semantic
region.
Returns the given semantic region.surround
in interface IFormattableDocument
public <T extends org.eclipse.emf.ecore.EObject> T surround(T owner, Procedures.Procedure1<? super IHiddenRegionFormatter> beforeAndAfter)
IFormattableDocument
IHiddenRegionFormatting
, initialize it, and add it before and after the given semantic
object.
Returns the given semantic object.surround
in interface IFormattableDocument
public java.lang.String toString()
toString
in class java.lang.Object
public IFormattableSubDocument withReplacerFilter(com.google.common.base.Predicate<? super ITextReplacer> filter)
IFormattableDocument
true
.withReplacerFilter
in interface IFormattableDocument