@Override public void closeScope() { state.closeScope(); }
@Override public String declareSyntheticVariable(Object key, String proposedName) { return state.declareSyntheticVariable(key, proposedName); }
@Override public String declareUniqueNameVariable(Object key, String proposedName) { return state.declareUniqueNameVariable(key, proposedName); }
public ImportingStringConcatenation(final SharedAppendableState state, final ITypeReferenceOwner typeReferenceOwner) { super(state.getLineSeparator()); this.importManager = state.getImportManager(); this.typeReferenceOwner = typeReferenceOwner; }
@Override public ITreeAppendable append(Class<?> type) { closeLastChild(); state.appendType(type, this); return this; }
@Override public TreeAppendable newLine() { closeLastChild(); state.appendNewLineAndIndentation(this); return this; }
@Override public String declareVariable(Object key, String proposedName) { return state.declareVariable(key, proposedName); }
@Override public GeneratorConfig getGeneratorConfig() { return state.getGeneratorConfig(); }
ImportManager getImportManager() { return state.getImportManager(); }
@Override public TreeAppendable decreaseIndentation() { closeLastChild(); state.decreaseIndentation(); return this; }
public TreeAppendable(ImportManager importManager, ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject source, String indentation, String lineSeparator) { this( new SharedAppendableState(indentation, lineSeparator, importManager, source.eResource()), converter, locationProvider, jvmModelAssociations, source); }
@Override public TreeAppendable append(JvmType type) { closeLastChild(); state.appendType(type, this); return this; }
protected void appendIndented(String text) { int length = text.length(); int nextLineOffset = 0; int idx = 0; while (idx < length) { char currentChar = text.charAt(idx); // check for \r or \r\n if (currentChar == '\r') { int delimiterLength = 1; if (idx + 1 < length && text.charAt(idx + 1) == '\n') { delimiterLength++; idx++; } int lineLength = idx - delimiterLength - nextLineOffset + 1; children.add(text.substring(nextLineOffset, nextLineOffset + lineLength)); state.appendNewLineAndIndentation(this); nextLineOffset = idx + 1; } else if (currentChar == '\n') { int lineLength = idx - nextLineOffset; children.add(text.substring(nextLineOffset, nextLineOffset + lineLength)); state.appendNewLineAndIndentation(this); nextLineOffset = idx + 1; } idx++; } if (nextLineOffset != length) { int lineLength = length - nextLineOffset; children.add(text.substring(nextLineOffset, nextLineOffset + lineLength)); } }