org.eclipse.xtend.ide.contentassist
Class ReplacingAppendable

java.lang.Object
  extended by org.eclipse.xtext.xbase.compiler.StringBuilderBasedAppendable
      extended by org.eclipse.xtend.ide.contentassist.ReplacingAppendable
All Implemented Interfaces:
IAppendable

public class ReplacingAppendable
extends StringBuilderBasedAppendable

An IAppendable to insert text into an Xtend document. Takes imports and existing variable names into account.

Author:
Jan Koehnlein - Initial contribution and API

Nested Class Summary
static class ReplacingAppendable.Factory
           
 
Constructor Summary
ReplacingAppendable(ImportManager importManager, java.lang.String indentString, IXtextDocument document, XtendFile xtendFile, WhitespaceHelper whitespaceHelper)
           
 
Method Summary
 void commitChanges()
           
 int commitChanges(int offset, int length)
           
 java.lang.String getCode()
           
protected  java.util.List<java.lang.String> getNewImports()
           
 int getTotalOffset()
           
 int insertNewImports()
           
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.xtext.xbase.compiler.StringBuilderBasedAppendable
append, append, appendType, charAt, closeScope, declareSyntheticVariable, declareVariable, decreaseIndentation, getContent, getImportManager, getImports, getIndentationString, getLineSeparator, getName, getObject, hasName, hasObject, increaseIndentation, length, newLine, openPseudoScope, openScope, setScopeStack, subSequence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReplacingAppendable

public ReplacingAppendable(ImportManager importManager,
                           java.lang.String indentString,
                           IXtextDocument document,
                           XtendFile xtendFile,
                           WhitespaceHelper whitespaceHelper)
Method Detail

toString

@NonNull
public java.lang.String toString()
Specified by:
toString in interface IAppendable
Overrides:
toString in class StringBuilderBasedAppendable

getTotalOffset

public int getTotalOffset()

getCode

@NonNull
public java.lang.String getCode()

commitChanges

public void commitChanges()
                   throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

commitChanges

public int commitChanges(int offset,
                         int length)
                  throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

insertNewImports

public int insertNewImports()
                     throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

getNewImports

protected java.util.List<java.lang.String> getNewImports()