org.eclipse.xtext.xtend2.richstring
Class DefaultIndentationHandler

java.lang.Object
  extended by org.eclipse.xtext.xtend2.richstring.DefaultIndentationHandler
All Implemented Interfaces:
IRichStringIndentationHandler

public class DefaultIndentationHandler
extends java.lang.Object
implements IRichStringIndentationHandler

Default indentation handler for rich strings. Tries to be graceful with inconsistent indentation.

Author:
Sebastian Zarnekow - Initial contribution and API

Nested Class Summary
protected static class DefaultIndentationHandler.IndentationData
           
protected static class DefaultIndentationHandler.SemanticIndentationData
           
protected static class DefaultIndentationHandler.TemplateIndentationData
           
 
Constructor Summary
DefaultIndentationHandler()
           
 
Method Summary
 void accept(IRichStringPartAcceptor acceptor)
          Announce the current indentation to the acceptor.
 java.lang.String getTotalIndentation()
          Return the current indentation.
 java.lang.CharSequence getTotalSemanticIndentation()
          Return the current semantic indentation.
 void popIndentation()
          Drop the recently announced indentation and use the previous state.
 void pushSemanticIndentation(java.lang.CharSequence indentation)
          Announce semantic indentation.
 void pushTemplateIndentation(java.lang.CharSequence indentation)
          Announce template indentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIndentationHandler

public DefaultIndentationHandler()
Method Detail

popIndentation

public void popIndentation()
Description copied from interface: IRichStringIndentationHandler
Drop the recently announced indentation and use the previous state.

Specified by:
popIndentation in interface IRichStringIndentationHandler

pushTemplateIndentation

public void pushTemplateIndentation(java.lang.CharSequence indentation)
Description copied from interface: IRichStringIndentationHandler
Announce template indentation. The passed indentation is expected to contain the complete whitespace prefix of a line. Implementors will extract the new parts from it automatically.

Specified by:
pushTemplateIndentation in interface IRichStringIndentationHandler
Parameters:
indentation - the leading whitespace of a line. May not be null.

pushSemanticIndentation

public void pushSemanticIndentation(java.lang.CharSequence indentation)
Description copied from interface: IRichStringIndentationHandler
Announce semantic indentation. The passed indentation is expected to contain the complete whitespace prefix of a line. Implementors will extract the new parts from it automatically.

Specified by:
pushSemanticIndentation in interface IRichStringIndentationHandler
Parameters:
indentation - the leading whitespace of a line. May not be null.

getTotalSemanticIndentation

public java.lang.CharSequence getTotalSemanticIndentation()
Description copied from interface: IRichStringIndentationHandler
Return the current semantic indentation.

Specified by:
getTotalSemanticIndentation in interface IRichStringIndentationHandler
Returns:
the complete semantic indentation. Never null.

getTotalIndentation

public java.lang.String getTotalIndentation()
Description copied from interface: IRichStringIndentationHandler
Return the current indentation.

Specified by:
getTotalIndentation in interface IRichStringIndentationHandler
Returns:
the complete indentation. Never null.

accept

public void accept(IRichStringPartAcceptor acceptor)
Description copied from interface: IRichStringIndentationHandler
Announce the current indentation to the acceptor.

Specified by:
accept in interface IRichStringIndentationHandler