public void format(final Object restaurante, final IFormattableDocument document) { if (restaurante instanceof XtextResource) { _format((XtextResource)restaurante, document); return; } else if (restaurante instanceof Restaurante) { _format((Restaurante)restaurante, document); return; } else if (restaurante instanceof EObject) { _format((EObject)restaurante, document); return; } else if (restaurante == null) { _format((Void)null, document); return; } else if (restaurante != null) { _format(restaurante, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(restaurante, document).toString()); } }
protected void _format(final XCollectionLiteral literal, @Extension final IFormattableDocument document) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.noSpace(); }; document.append(this.textRegionExtensions.regionFor(literal).keyword("#"), _function); ISemanticRegion _elvis = null; ISemanticRegion _keyword = this.textRegionExtensions.regionFor(literal).keyword("["); if (_keyword != null) { _elvis = _keyword; } else { ISemanticRegion _keyword_1 = this.textRegionExtensions.regionFor(literal).keyword("{"); _elvis = _keyword_1; } final ISemanticRegion open = _elvis; ISemanticRegion _elvis_1 = null; ISemanticRegion _keyword_2 = this.textRegionExtensions.regionFor(literal).keyword("]"); if (_keyword_2 != null) { _elvis_1 = _keyword_2; } else { ISemanticRegion _keyword_3 = this.textRegionExtensions.regionFor(literal).keyword("}"); _elvis_1 = _keyword_3; } final ISemanticRegion close = _elvis_1; this.formatCommaSeparatedList(literal.getElements(), open, close, document); }
protected void _format(final XFeatureCall expr, @Extension final IFormattableDocument format) { this.formatFeatureCallTypeParameters(expr, format); boolean _isExplicitOperationCall = expr.isExplicitOperationCall(); if (_isExplicitOperationCall) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.noSpace(); }; final ISemanticRegion open = format.prepend(this.textRegionExtensions.regionFor(expr).keyword(this.grammar.getXFeatureCallAccess().getExplicitOperationCallLeftParenthesisKeyword_3_0_0()), _function); final ISemanticRegion close = this.textRegionExtensions.regionFor(expr).keyword(this.grammar.getXFeatureCallAccess().getRightParenthesisKeyword_3_2()); this.formatFeatureCallParams(expr.getFeatureCallArguments(), open, close, format); } else { EList<XExpression> _featureCallArguments = expr.getFeatureCallArguments(); for (final XExpression arg : _featureCallArguments) { this.format(arg, format); } } }
@Override public void format(final ITextSegment region, final IHiddenRegionFormatting wrapped, @Extension final IFormattableDocument document) { if ((!this.hasWrapped)) { IHiddenRegion _switchResult = null; boolean _matched = false; if (region instanceof IHiddenRegion) { _matched=true; _switchResult = ((IHiddenRegion)region); } if (!_matched) { if (region instanceof IHiddenRegionPart) { _matched=true; _switchResult = ((IHiddenRegionPart)region).getHiddenRegion(); } } final IHiddenRegion hiddenRegion = _switchResult; final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.indent(); }; document.set(hiddenRegion, this.last, _function); this.hasWrapped = true; } }
public void format(final Object obj, final IFormattableDocument document) { if (obj instanceof XtextResource) { _format((XtextResource)obj, document); return; } else if (obj instanceof Node) { _format((Node)obj, document); return; } else if (obj instanceof EObject) { _format((EObject)obj, document); return; } else if (obj == null) { _format((Void)null, document); return; } else if (obj != null) { _format(obj, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(obj, document).toString()); } }
public void format(final Object element, final IFormattableDocument document) { if (element instanceof XtextResource) { _format((XtextResource)element, document); return; } else if (element instanceof Element) { _format((Element)element, document); return; } else if (element instanceof PackageDeclaration) { _format((PackageDeclaration)element, document); return; } else if (element instanceof EObject) { _format((EObject)element, document); return; } else if (element == null) { _format((Void)null, document); return; } else if (element != null) { _format(element, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(element, document).toString()); } }
protected void _format(final Unit unit, @Extension final IFormattableDocument document) { EList<SimpleTypeRef> _implements = unit.getImplements(); for (final SimpleTypeRef simpleTypeRef : _implements) { document.<SimpleTypeRef>format(simpleTypeRef); } EList<ProvidedCapability> _providedCapabilities = unit.getProvidedCapabilities(); for (final ProvidedCapability providedCapability : _providedCapabilities) { document.<ProvidedCapability>format(providedCapability); } EList<AliasedRequiredCapability> _requiredCapabilities = unit.getRequiredCapabilities(); for (final AliasedRequiredCapability aliasedRequiredCapability : _requiredCapabilities) { document.<AliasedRequiredCapability>format(aliasedRequiredCapability); } EList<RequiredCapability> _metaRequiredCapabilities = unit.getMetaRequiredCapabilities(); for (final RequiredCapability requiredCapability : _metaRequiredCapabilities) { document.<RequiredCapability>format(requiredCapability); } EList<Function> _functions = unit.getFunctions(); for (final Function function : _functions) { document.<Function>format(function); } }
public void format(final Object model, final IFormattableDocument document) { if (model instanceof XtextResource) { _format((XtextResource)model, document); return; } else if (model instanceof Model) { _format((Model)model, document); return; } else if (model instanceof Unit) { _format((Unit)model, document); return; } else if (model instanceof EObject) { _format((EObject)model, document); return; } else if (model == null) { _format((Void)null, document); return; } else if (model != null) { _format(model, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(model, document).toString()); } }
public void format(final Object model, final IFormattableDocument document) { if (model instanceof XtextResource) { _format((XtextResource)model, document); return; } else if (model instanceof Model) { _format((Model)model, document); return; } else if (model instanceof EObject) { _format((EObject)model, document); return; } else if (model == null) { _format((Void)null, document); return; } else if (model != null) { _format(model, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(model, document).toString()); } }
public void format(final Object model, final IFormattableDocument document) { if (model instanceof XtextResource) { _format((XtextResource)model, document); return; } else if (model instanceof IDList) { _format((IDList)model, document); return; } else if (model instanceof EObject) { _format((EObject)model, document); return; } else if (model == null) { _format((Void)null, document); return; } else if (model != null) { _format(model, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(model, document).toString()); } }
public void format(final Object obj, final IFormattableDocument document) { if (obj instanceof XtextResource) { _format((XtextResource)obj, document); return; } else if (obj instanceof EObject) { _format((EObject)obj, document); return; } else if (obj == null) { _format((Void)null, document); return; } else if (obj != null) { _format(obj, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(obj, document).toString()); } }
protected void _format(final AttributeState attributeState, @Extension final IFormattableDocument document) { final ISemanticRegion kvalue = this.textRegionExtensions.regionFor(attributeState).feature(OCCIPackage.Literals.ATTRIBUTE_STATE__VALUE); final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.setNewLines(1); }; document.append(kvalue, _function); }
public void format(final Object link, final IFormattableDocument document) { if (link instanceof XtextResource) { _format((XtextResource)link, document); return; } else if (link instanceof Link) { _format((Link)link, document); return; } else if (link instanceof Resource) { _format((Resource)link, document); return; } else if (link instanceof AttributeState) { _format((AttributeState)link, document); return; } else if (link instanceof Configuration) { _format((Configuration)link, document); return; } else if (link instanceof EObject) { _format((EObject)link, document); return; } else if (link == null) { _format((Void)null, document); return; } else if (link != null) { _format(link, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(link, document).toString()); } }
@Override protected void _format(final XBlockExpression xBlockExpression, @Extension final IFormattableDocument document) { final Consumer<ISemanticRegion> _function = (ISemanticRegion it) -> { final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> { it_1.newLine(); }; document.append(it, _function_1); }; this.textRegionExtensions.regionFor(xBlockExpression).keywords(this._pureXbaseGrammarAccess.getSpecialBlockExpressionAccess().getSemicolonKeyword_1_1()).forEach(_function); EList<XExpression> _expressions = xBlockExpression.getExpressions(); for (final XExpression xExpression : _expressions) { document.<XExpression>format(xExpression); } }
protected void _format(final XThrowExpression expr, @Extension final IFormattableDocument format) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; format.<XExpression>prepend(expr.getExpression(), _function); format.<XExpression>format(expr.getExpression()); }
protected void _format(final XReturnExpression expr, @Extension final IFormattableDocument format) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; format.<XExpression>prepend(expr.getExpression(), _function); format.<XExpression>format(expr.getExpression()); }
protected void _format(final JvmFormalParameter expr, @Extension final IFormattableDocument format) { JvmTypeReference _parameterType = expr.getParameterType(); if (_parameterType!=null) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; format.<JvmTypeReference>append(_parameterType, _function); } format.<JvmTypeReference>format(expr.getParameterType()); }
protected void _format(final XExpression expr, @Extension final IFormattableDocument format) { EList<EObject> _eContents = expr.eContents(); for (final EObject obj : _eContents) { boolean _matched = false; if (obj instanceof XExpression) { _matched=true; format.<XExpression>format(((XExpression)obj)); } } }
protected void _format(final XInstanceOfExpression expr, @Extension final IFormattableDocument doc) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; doc.surround(this.textRegionExtensions.regionFor(expr).keyword("instanceof"), _function); doc.<XExpression>format(expr.getExpression()); doc.<JvmTypeReference>format(expr.getType()); }
protected void _format(final XCastedExpression expr, @Extension final IFormattableDocument doc) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; doc.surround(this.textRegionExtensions.regionFor(expr).keyword("as"), _function); doc.<XExpression>format(expr.getTarget()); doc.<JvmTypeReference>format(expr.getType()); }
protected void _format(final XPostfixOperation expr, @Extension final IFormattableDocument doc) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.noSpace(); }; doc.prepend(this.textRegionExtensions.regionFor(expr).feature(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE), _function); doc.<XExpression>format(expr.getOperand()); }
protected void _format(final JvmWildcardTypeReference ref, @Extension final IFormattableDocument document) { boolean _isEmpty = ref.getConstraints().isEmpty(); boolean _not = (!_isEmpty); if (_not) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; document.append(this.textRegionExtensions.regionFor(ref).keyword("?"), _function); } EList<JvmTypeConstraint> _constraints = ref.getConstraints(); for (final JvmTypeConstraint c : _constraints) { document.<JvmTypeConstraint>format(c); } }
protected void _format(final JvmTypeParameter ref, @Extension final IFormattableDocument document) { EList<JvmTypeConstraint> _constraints = ref.getConstraints(); for (final JvmTypeConstraint c : _constraints) { { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; document.<JvmTypeConstraint>prepend(c, _function); document.<JvmTypeConstraint>format(c); } } }
protected void _format(final XImportSection section, @Extension final IFormattableDocument format) { EList<XImportDeclaration> _importDeclarations = section.getImportDeclarations(); for (final XImportDeclaration imp : _importDeclarations) { { format.<XImportDeclaration>format(imp); XImportDeclaration _last = IterableExtensions.<XImportDeclaration>last(section.getImportDeclarations()); boolean _notEquals = (!Objects.equal(imp, _last)); if (_notEquals) { format.<XImportDeclaration>append(imp, XbaseFormatterPreferenceKeys.blankLinesBetweenImports); } else { format.<XImportDeclaration>append(imp, XbaseFormatterPreferenceKeys.blankLinesAfterImports); } } } }
public void format(final Object ref, final IFormattableDocument document) { if (ref instanceof JvmTypeParameter) { _format((JvmTypeParameter)ref, document); return; } else if (ref instanceof XtextResource) { _format((XtextResource)ref, document); return; } else if (ref instanceof XFunctionTypeRef) { _format((XFunctionTypeRef)ref, document); return; } else if (ref instanceof JvmParameterizedTypeReference) { _format((JvmParameterizedTypeReference)ref, document); return; } else if (ref instanceof JvmWildcardTypeReference) { _format((JvmWildcardTypeReference)ref, document); return; } else if (ref instanceof XImportDeclaration) { _format((XImportDeclaration)ref, document); return; } else if (ref instanceof XImportSection) { _format((XImportSection)ref, document); return; } else if (ref instanceof EObject) { _format((EObject)ref, document); return; } else if (ref == null) { _format((Void)null, document); return; } else if (ref != null) { _format(ref, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(ref, document).toString()); } }
protected TextReplacerContext(IFormattableDocument document, ITextReplacerContext previous, int indentation, ITextReplacer replacer) { super(); this.document = document; this.indentation = indentation; this.previous = previous; this.replacer = replacer; this.replacements = createTextReplacementsSet(); }
@Override public ITextReplacerContext withDocument(IFormattableDocument document) { TextReplacerContext context = new TextReplacerContext(document, this, indentation, null); if (this.nextReplacerIsChild) context.setNextReplacerIsChild(); return context; }
public void format(final Object property, final IFormattableDocument document) { if (property instanceof XtextResource) { _format((XtextResource)property, document); return; } else if (property instanceof Property) { _format((Property)property, document); return; } else if (property instanceof Model) { _format((Model)property, document); return; } else if (property instanceof TypeDeclaration) { _format((TypeDeclaration)property, document); return; } else if (property instanceof EObject) { _format((EObject)property, document); return; } else if (property == null) { _format((Void)null, document); return; } else if (property != null) { _format(property, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(property, document).toString()); } }
protected void _format(final Model model, @Extension final IFormattableDocument document) { EList<Unit> _units = model.getUnits(); for (final Unit unit : _units) { document.<Unit>format(unit); } EList<Function> _functions = model.getFunctions(); for (final Function function : _functions) { document.<Function>format(function); } }
protected void _format(final Statemachine statemachine, @Extension final IFormattableDocument document) { EList<State> _states = statemachine.getStates(); for (final State state : _states) { document.<State>format(state); } EList<Transition> _transitions = statemachine.getTransitions(); for (final Transition transition : _transitions) { document.<Transition>format(transition); } }
protected void _format(final StatePropertyExpression expression, @Extension final IFormattableDocument document) { ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(expression); ISemanticRegion _keyword = _regionFor.keyword("."); final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { @Override public void apply(final IHiddenRegionFormatter it) { it.noSpace(); } }; document.surround(_keyword, _function); }
public void format(final Object command, final IFormattableDocument document) { if (command instanceof XtextResource) { _format((XtextResource)command, document); return; } else if (command instanceof ExecuteCommand) { _format((ExecuteCommand)command, document); return; } else if (command instanceof PrintCommand) { _format((PrintCommand)command, document); return; } else if (command instanceof SetCommand) { _format((SetCommand)command, document); return; } else if (command instanceof StatePropertyExpression) { _format((StatePropertyExpression)command, document); return; } else if (command instanceof State) { _format((State)command, document); return; } else if (command instanceof Statemachine) { _format((Statemachine)command, document); return; } else if (command instanceof Transition) { _format((Transition)command, document); return; } else if (command == null) { _format((Void)null, document); return; } else if (command != null) { _format(command, document); return; } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(command, document).toString()); } }
protected void _format(final Model model, @Extension final IFormattableDocument document) { document.<XImportSection>format(model.getImportSection()); document.<XBlockExpression>format(model.getBlock()); }
protected void _format(final JvmGenericArrayTypeReference array, @Extension final IFormattableDocument document) { ISemanticRegion _ruleCallTo = this.textRegionExtensions.regionFor(array).ruleCallTo(this.grammar.getArrayBracketsRule()); ArrayBracketsFormattingReplacer _arrayBracketsFormattingReplacer = new ArrayBracketsFormattingReplacer(_ruleCallTo); document.addReplacer(_arrayBracketsFormattingReplacer); document.<JvmTypeReference>format(array.getComponentType()); }
protected void _format(final JvmTypeConstraint constraint, @Extension final IFormattableDocument document) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; document.<JvmTypeReference>format(document.<JvmTypeReference>prepend(constraint.getTypeReference(), _function)); }
protected void formatFeatureCallParams(final List<XExpression> params, final ISemanticRegion open, final ISemanticRegion close, @Extension final IFormattableDocument format) { final XClosure builder = this.builder(params); final Iterable<XExpression> explicitParams = this.explicitParams(params); this.formatCommaSeparatedList(IterableExtensions.<XExpression>toList(explicitParams), open, close, format); this.formatBuilderWithLeadingGap(builder, format); }
public String generateStubFileContents() { ResourceSet _resourceSet = this.grammar.eResource().getResourceSet(); String _stubPackageName = this.getStubPackageName(); String _fileHeader = this.service.naming.fileHeader(); @Extension final JavaEMFFile file = new JavaEMFFile(_resourceSet, _stubPackageName, _fileHeader); file.imported(IFormattableDocument.class); final LinkedHashMultimap<EClass, EReference> type2ref = LinkedHashMultimap.<EClass, EReference>create(); this.getLocallyAssignedContainmentReferences(this.grammar, type2ref); final LinkedHashMultimap<EClass, EReference> inheritedTypes = LinkedHashMultimap.<EClass, EReference>create(); this.getInheritedContainmentReferences(this.grammar, inheritedTypes, CollectionLiterals.<Grammar>newHashSet()); StringConcatenation _builder = new StringConcatenation(); _builder.append("class "); String _stubSimpleName = this.getStubSimpleName(); _builder.append(_stubSimpleName); _builder.append(" extends "); String _imported = file.imported(this.getStubSuperClassName()); _builder.append(_imported); _builder.append(" {"); _builder.newLineIfNotEmpty(); _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("@"); String _imported_1 = file.imported(Inject.class); _builder.append(_imported_1, "\t"); _builder.append(" extension "); String _imported_2 = file.imported(GrammarAccessUtil.getGrammarAccessFQName(this.grammar, this.service.naming)); _builder.append(_imported_2, "\t"); _builder.newLineIfNotEmpty(); { Set<EClass> _keySet = type2ref.keySet(); for(final EClass type : _keySet) { _builder.newLine(); _builder.append("\t"); CharSequence _generateFormatMethod = this.generateFormatMethod(type, file, type2ref.get(type), inheritedTypes.containsKey(type)); _builder.append(_generateFormatMethod, "\t"); _builder.newLineIfNotEmpty(); } } _builder.append("}"); _builder.newLine(); file.setBody(_builder.toString()); return file.toString(); }
public FilteredSubDocument(ITextSegment region, IFormattableDocument parent, Predicate<? super ITextReplacer> filter) { super(region, parent); this.filter = filter; }
public SubDocument(ITextSegment region, IFormattableDocument parent) { super(); this.region = region; this.parent = parent; }
public TextReplacerContext(IFormattableDocument document) { this(document, null, 0, null); }