From d1d596d64b5e4dc070964bb14638eb0c00f14653 Mon Sep 17 00:00:00 2001
From: Christian Dietrich
- * def dispatch void format(Entity entity, extension IFormattableDocument document) { - * entity.regionForFeature(ABSTRACT_ELEMENT__NAME).surround[oneSpace] - * entity.regionForKeyword("{").append[newLine; increaseIndentation] - * for (Feature feature : entity.features) { - * format(feature, document); - * feature.append[newLine] - * } - * entity.regionForKeyword("}").prepend[decreaseIndentation] - * } + def dispatch void format(Entity entity, extension IFormattableDocument document) { + val open = entity.regionFor.keyword("{") + val close = entity.regionFor.keyword("}") + entity.regionFor.feature(ABSTRACT_ELEMENT__NAME).surround[oneSpace] + entity.superType.surround[oneSpace] + open.append[newLine] + interior(open, close)[indent] + format(entity.getSuperType(), document); + for (Feature feature : entity.features) { + feature.format + feature.append[setNewLines(1, 1, 2)] + } + } ** *
@@ -131,9 +136,9 @@ import com.google.common.collect.Lists; *
* *- * The methods {@code regionForFeature()} and {@code regionForKeyword} are extension methods: {link - * ITextRegionAccess#regionForFeature(EObject, EStructuralFeature)} and {link - * ITextRegionAccess#regionForKeyword(EObject, String)}. They return an {@link ISemanticRegion}. + * The method calls {@code regionFor.feature()} and {@code regionFor.keyword()} are using extension methods: {@link + * ITextRegionExtensions#regionFor(EObject)} and {@link + * ISemanticRegionFinder#keyword(String)} respectively {@link ISemanticRegionFinder#feature(EStructuralFeature)}. They return an {@link ISemanticRegion}. *
* *