use of org.eclipse.xtext.formatting2.IHiddenRegionFormatter in project xtext-eclipse by eclipse.
the class DomainmodelFormatter method _format.
protected void _format(final Entity entity, @Extension final IFormattableDocument document) {
final ISemanticRegion open = this.textRegionExtensions.regionFor(entity).keyword("{");
final ISemanticRegion close = this.textRegionExtensions.regionFor(entity).keyword("}");
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
document.surround(this.textRegionExtensions.regionFor(entity).feature(DomainmodelPackage.Literals.ABSTRACT_ELEMENT__NAME), _function);
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
document.<JvmParameterizedTypeReference>surround(entity.getSuperType(), _function_1);
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it) -> {
it.newLine();
};
document.append(open, _function_2);
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it) -> {
it.indent();
};
document.<ISemanticRegion, ISemanticRegion>interior(open, close, _function_3);
this.format(entity.getSuperType(), document);
EList<Feature> _features = entity.getFeatures();
for (final Feature feature : _features) {
{
document.<Feature>format(feature);
final Procedure1<IHiddenRegionFormatter> _function_4 = (IHiddenRegionFormatter it) -> {
it.setNewLines(1, 1, 2);
};
document.<Feature>append(feature, _function_4);
}
}
}
use of org.eclipse.xtext.formatting2.IHiddenRegionFormatter in project xtext-eclipse by eclipse.
the class RuleEngineFormatter method _format.
protected void _format(final Device device, @Extension final IFormattableDocument document) {
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
document.surround(this.textRegionExtensions.regionFor(device).feature(RuleEnginePackage.Literals.DEVICE__NAME), _function);
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
document.surround(this.textRegionExtensions.regionFor(device).keyword("be"), _function_1);
EList<State> _states = device.getStates();
for (final State state : _states) {
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it) -> {
it.noSpace();
};
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it) -> {
it.oneSpace();
};
document.append(document.prepend(this.textRegionExtensions.immediatelyPreceding(document.<State>format(state)).keyword(","), _function_2), _function_3);
}
}
use of org.eclipse.xtext.formatting2.IHiddenRegionFormatter in project xtext-eclipse by eclipse.
the class RuleEngineFormatter method _format.
protected void _format(final Model model, @Extension final IFormattableDocument document) {
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
it.setNewLines(0, 0, 1);
it.noSpace();
};
document.<Model>prepend(model, _function);
EList<Declaration> _declarations = model.getDeclarations();
for (final Declaration declaration : _declarations) {
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.setNewLines(1, 1, 2);
};
document.<Declaration>append(document.<Declaration>format(declaration), _function_1);
}
}
use of org.eclipse.xtext.formatting2.IHiddenRegionFormatter in project xtext-eclipse by eclipse.
the class RuleEngineFormatter method _format.
@Override
protected void _format(final XBlockExpression expr, @Extension final IFormattableDocument document) {
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> {
it.indent();
};
document.<XBlockExpression>surround(expr, _function);
EList<XExpression> _expressions = expr.getExpressions();
for (final XExpression child : _expressions) {
{
final ISemanticRegion sem = this.textRegionExtensions.immediatelyFollowing(child).keyword(";");
if ((sem != null)) {
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it) -> {
it.noSpace();
};
document.prepend(sem, _function_1);
XExpression _last = IterableExtensions.<XExpression>last(expr.getExpressions());
boolean _notEquals = (!Objects.equal(child, _last));
if (_notEquals) {
final Procedure1<IHiddenRegionFormatter> _function_2 = (IHiddenRegionFormatter it) -> {
it.newLine();
};
document.append(sem, _function_2);
}
} else {
XExpression _last_1 = IterableExtensions.<XExpression>last(expr.getExpressions());
boolean _notEquals_1 = (!Objects.equal(child, _last_1));
if (_notEquals_1) {
final Procedure1<IHiddenRegionFormatter> _function_3 = (IHiddenRegionFormatter it) -> {
it.newLine();
};
document.<XExpression>append(child, _function_3);
}
}
document.<XExpression>format(child);
}
}
}
Aggregations