Java 类org.eclipse.xtext.xbase.lib.Extension 实例源码

项目:xtext-extras    文件:XbaseFormatter.java   
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);
}
项目:xtext-extras    文件:IndentOnceAutowrapFormatter.java   
@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;
  }
}
项目:xtext-extras    文件:XSwitchExpressions.java   
public LightweightTypeReference getSwitchVariableType(final XSwitchExpression it) {
  @Extension
  final IResolvedTypes resolvedTypes = this._iBatchTypeResolver.resolveTypes(it);
  final JvmFormalParameter declaredParam = it.getDeclaredParam();
  if ((declaredParam == null)) {
    return resolvedTypes.getActualType(it.getSwitch());
  }
  final LightweightTypeReference paramType = resolvedTypes.getActualType(declaredParam);
  LightweightTypeReference _elvis = null;
  if (paramType != null) {
    _elvis = paramType;
  } else {
    LightweightTypeReference _actualType = resolvedTypes.getActualType(it.getSwitch());
    _elvis = _actualType;
  }
  return _elvis;
}
项目:xtext-core    文件:AbstractLanguageServerTest.java   
protected void testFormatting(final Procedure1<? super FormattingConfiguration> configurator) {
  try {
    @Extension
    final FormattingConfiguration configuration = new FormattingConfiguration();
    configuration.setFilePath(("MyModel." + this.fileExtension));
    configurator.apply(configuration);
    final FileInfo fileInfo = this.initializeContext(configuration);
    DocumentFormattingParams _documentFormattingParams = new DocumentFormattingParams();
    final Procedure1<DocumentFormattingParams> _function = (DocumentFormattingParams it) -> {
      String _uri = fileInfo.getUri();
      TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(_uri);
      it.setTextDocument(_textDocumentIdentifier);
    };
    DocumentFormattingParams _doubleArrow = ObjectExtensions.<DocumentFormattingParams>operator_doubleArrow(_documentFormattingParams, _function);
    final CompletableFuture<List<? extends TextEdit>> changes = this.languageServer.formatting(_doubleArrow);
    String _contents = fileInfo.getContents();
    final Document result = new Document(1, _contents).applyChanges(ListExtensions.<TextEdit>reverse(CollectionLiterals.<TextEdit>newArrayList(((TextEdit[])Conversions.unwrapArray(changes.get(), TextEdit.class)))));
    this.assertEquals(configuration.getExpectedText(), result.getContents());
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:xtext-lib    文件:PropertyProcessor.java   
@Override
public void doTransform(final MutableFieldDeclaration it, @Extension final TransformationContext context) {
  @Extension
  final AccessorsProcessor.Util util = new AccessorsProcessor.Util(context);
  boolean _hasGetter = util.hasGetter(it);
  boolean _not = (!_hasGetter);
  if (_not) {
    util.addGetter(it, Visibility.PUBLIC);
  }
  if (((!it.isFinal()) && (!util.hasSetter(it)))) {
    util.addSetter(it, Visibility.PUBLIC);
  }
  String _firstLower = StringExtensions.toFirstLower(it.getSimpleName());
  String _plus = ("_" + _firstLower);
  it.setSimpleName(_plus);
}
项目:Vitruv    文件:CreateMaleMemberOfFamilyRoutine.java   
public void callRoutine1(final Male person, final FamilyRegister familiesRegister, final Member member, @Extension final RoutinesFacade _routinesFacade) {
  EList<Family> collectionFamilies = familiesRegister.getFamilies();
  int _size = collectionFamilies.size();
  final List<String> familiesNames = new ArrayList<String>(_size);
  for (final Family f : collectionFamilies) {
    familiesNames.add(f.getLastName());
  }
  final String selectMsg = "Please select the family to which the person belongs.";
  final int selected = this.userInteracting.selectFromMessage(UserInteractionType.MODAL, selectMsg, ((String[])Conversions.unwrapArray(familiesNames, String.class)));
  final Family selectedFamily = collectionFamilies.get(selected);
  selectedFamily.setLastName(person.getFullName().split(" ")[1]);
  List<String> collectionRoles = new ArrayList<String>();
  Iterables.<String>addAll(collectionRoles, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Father", "Son")));
  final String selectMsgRoles = "Please select whether the person is a father or a son.";
  final List<String> _converted_collectionRoles = (List<String>)collectionRoles;
  final int selectedRole = this.userInteracting.selectFromMessage(UserInteractionType.MODAL, selectMsgRoles, ((String[])Conversions.unwrapArray(_converted_collectionRoles, String.class)));
  if ((selectedRole == 0)) {
    selectedFamily.setFather(member);
  } else {
    selectedFamily.getSons().add(member);
  }
  _routinesFacade.addCorr(person, selectedFamily);
}
项目:Vitruv    文件:CreateFemaleMemberOfFamilyRoutine.java   
public void callRoutine1(final Female person, final FamilyRegister familyRegister, final Member member, @Extension final RoutinesFacade _routinesFacade) {
  EList<Family> collectionFamilies = familyRegister.getFamilies();
  int _size = collectionFamilies.size();
  final List<String> familiesNames = new ArrayList<String>(_size);
  for (final Family f : collectionFamilies) {
    familiesNames.add(f.getLastName());
  }
  final String selectMsg = "Please select the family to which the person belongs.";
  final int selected = this.userInteracting.selectFromMessage(UserInteractionType.MODAL, selectMsg, ((String[])Conversions.unwrapArray(familiesNames, String.class)));
  final Family selectedFamily = collectionFamilies.get(selected);
  selectedFamily.setLastName(person.getFullName().split(" ")[1]);
  List<String> collectionRoles = new ArrayList<String>();
  Iterables.<String>addAll(collectionRoles, Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("Mother", "Daughter")));
  final String selectMsgRoles = "Please select whether the person is a mother or a daughter.";
  final List<String> _converted_collectionRoles = (List<String>)collectionRoles;
  final int selectedRole = this.userInteracting.selectFromMessage(UserInteractionType.MODAL, selectMsgRoles, ((String[])Conversions.unwrapArray(_converted_collectionRoles, String.class)));
  if ((selectedRole == 0)) {
    selectedFamily.setMother(member);
  } else {
    selectedFamily.getDaughters().add(member);
  }
  _routinesFacade.addCorr(person, selectedFamily);
}
项目:OCCI-Studio    文件:OCCIFormatter.java   
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);
}
项目:xtext-core    文件:RegionAccessDiffTest.java   
@Test
public void testDeleteTwo() {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("4/*1*/prefix/*2*/foo/*3*/");
  _builder.newLine();
  final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
  final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
    @Extension
    final ITextRegionExtensions ext = access.getExtensions();
    EObject _semanticElement = access.regionForRootEObject().getSemanticElement();
    final PrefixedUnassigned rootObj = ((PrefixedUnassigned) _semanticElement);
    final ISemanticRegion prefix = ext.regionFor(rootObj.getDelegate()).keyword("prefix");
    final ISemanticRegion foo = ext.regionFor(rootObj.getDelegate()).feature(RegionaccesstestlanguagePackage.Literals.DELEGATE__NAME);
    it.remove(prefix.getPreviousHiddenRegion(), foo.getNextHiddenRegion());
  };
  ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append(" ");
  _builder_1.append("0  0   H");
  _builder_1.newLine();
  _builder_1.append("        ");
  _builder_1.append("B PrefixedUnassigned Root");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("0  1    S \"4\"        PrefixedUnassigned:\'4\'");
  _builder_1.newLine();
  _builder_1.append("        ");
  _builder_1.append("E PrefixedUnassigned Root");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("1    1 H \"/*1*/\"    Comment:TerminalRule\'ML_COMMENT\'");
  _builder_1.newLine();
  _builder_1.append("   ");
  _builder_1.append("10   \"/*3*/\"    Comment:TerminalRule\'ML_COMMENT\'");
  _builder_1.newLine();
  _builder_1.append("------------ diff 1 ------------");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("1  5  H \"/*1*/\"    Comment:TerminalRule\'ML_COMMENT\'");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("6  6  S \"prefix\"   PrefixedDelegate:\'prefix\'");
  _builder_1.newLine();
  _builder_1.append("12  5  H \"/*2*/\"    Comment:TerminalRule\'ML_COMMENT\'");
  _builder_1.newLine();
  _builder_1.append("17  3  S \"foo\"      Delegate:name=ID");
  _builder_1.newLine();
  _builder_1.append("20  5  H \"/*3*/\"    Comment:TerminalRule\'ML_COMMENT\'");
  _builder_1.newLine();
  this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_1);
}
项目:xtext-extras    文件:XbaseFormatter.java   
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());
}
项目:lsp4j    文件:JsonRpcDataProcessor.java   
protected void addEitherSetter(final MutableFieldDeclaration field, final String setterName, final EitherTypeArgument argument, @Extension final JsonRpcDataTransformationContext context) {
  final Procedure1<MutableMethodDeclaration> _function = (MutableMethodDeclaration method) -> {
    context.setPrimarySourceElement(method, context.getPrimarySourceElement(field));
    method.addParameter(field.getSimpleName(), argument.getType());
    method.setStatic(field.isStatic());
    method.setVisibility(Visibility.PUBLIC);
    method.setReturnType(context.getPrimitiveVoid());
    final CompilationStrategy _function_1 = (CompilationStrategy.CompilationContext ctx) -> {
      return this.compileEitherSetterBody(field, argument, field.getSimpleName(), ctx, context);
    };
    method.setBody(_function_1);
  };
  field.getDeclaringType().addMethod(setterName, _function);
}
项目:xtext-extras    文件:XbaseFormatter.java   
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());
}
项目:xtext-extras    文件:XtypeFormatter.java   
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);
  }
}
项目:xtext-extras    文件:XtypeFormatter.java   
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);
    }
  }
}
项目:xtext-extras    文件:XtypeFormatter.java   
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);
      }
    }
  }
}
项目:xtext-extras    文件:TypesOrderUtil.java   
public boolean isHandled(final LightweightTypeReference actualTypeReference, final LightweightTypeReference previousTypeReference) {
  boolean _xblockexpression = false;
  {
    @Extension
    final TypeConformanceComputer typeConformanceComputer = this.services.getTypeConformanceComputer();
    final int conformant = typeConformanceComputer.isConformant(previousTypeReference, actualTypeReference, 
      ((RawTypeConformanceComputer.ALLOW_BOXING_UNBOXING | RawTypeConformanceComputer.ALLOW_PRIMITIVE_WIDENING) | RawTypeConformanceComputer.ALLOW_RAW_TYPE_CONVERSION));
    _xblockexpression = ((conformant & RawTypeConformanceComputer.SUCCESS) != 0);
  }
  return _xblockexpression;
}
项目:xtext-extras    文件:XSwitchExpressions.java   
public boolean isJavaCaseExpression(final XSwitchExpression it, final XCasePart casePart) {
  boolean _xblockexpression = false;
  {
    JvmTypeReference _typeGuard = casePart.getTypeGuard();
    boolean _tripleNotEquals = (_typeGuard != null);
    if (_tripleNotEquals) {
      return false;
    }
    final XExpression case_ = casePart.getCase();
    if ((case_ == null)) {
      return false;
    }
    @Extension
    final IResolvedTypes resolvedTypes = this._iBatchTypeResolver.resolveTypes(it);
    final LightweightTypeReference caseType = resolvedTypes.getActualType(case_);
    if ((caseType == null)) {
      return false;
    }
    final LightweightTypeReference switchType = this.getSwitchVariableType(it);
    boolean _isAssignableFrom = switchType.isAssignableFrom(caseType);
    boolean _not = (!_isAssignableFrom);
    if (_not) {
      return false;
    }
    _xblockexpression = true;
  }
  return _xblockexpression;
}
项目:xtext-core    文件:Indexer.java   
protected List<IResourceDescription.Delta> getDeltasForChangedResources(final Iterable<URI> affectedUris, final ResourceDescriptionsData oldIndex, @Extension final BuildContext context) {
  try {
    this.compilerPhases.setIndexing(context.getResourceSet(), true);
    final Function1<Resource, IResourceDescription.Delta> _function = (Resource it) -> {
      return this.addToIndex(it, true, oldIndex, context);
    };
    return IterableExtensions.<IResourceDescription.Delta>toList(context.<IResourceDescription.Delta>executeClustered(affectedUris, _function));
  } finally {
    this.compilerPhases.setIndexing(context.getResourceSet(), false);
  }
}
项目:Vitruv    文件:CreateAdRootXReRootMappingInstanceRoutine.java   
public void executeAction1(final Addresses aRoot, final Recipients rRoot, @Extension final RoutinesFacade _routinesFacade) {
  AdRootXReRootMapping.adRootXReRootMapping().registerRightElementsAndPromoteCandidates(aRoot, rRoot);
  String _lastSegment = aRoot.eResource().getURI().trimFileExtension().lastSegment();
  String _plus = (_lastSegment + ".");
  String _plus_1 = (_plus + RecipientsNamespace.FILE_EXTENSION);
  this.persistProjectRelative(aRoot, rRoot, _plus_1);
}
项目:xtext-core    文件:XtextAntlrGeneratorFragment2.java   
protected void generateContentAssistGrammar() {
  @Extension
  final ContentAssistGrammarNaming naming = this.contentAssistNaming;
  final IXtextGeneratorFileSystemAccess fsa = this.getProjectConfig().getGenericIde().getSrcGen();
  this.contentAssistGenerator.generate(this.getGrammar(), this.getOptions(), fsa);
  this.runAntlr(naming.getParserGrammar(this.getGrammar()), naming.getLexerGrammar(this.getGrammar()), fsa);
  this.simplifyUnorderedGroupPredicatesIfRequired(this.getGrammar(), fsa, naming.getInternalParserClass(this.getGrammar()));
  this.splitParserAndLexerIfEnabled(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
  this.normalizeTokens(fsa, naming.getLexerGrammar(this.getGrammar()).getTokensFileName());
  this.suppressWarnings(fsa, naming.getInternalParserClass(this.getGrammar()), naming.getLexerClass(this.getGrammar()));
  this.normalizeLineDelimiters(fsa, naming.getLexerClass(this.getGrammar()), naming.getInternalParserClass(this.getGrammar()));
  if (this.removeBacktrackingGuards) {
    this.removeBackTrackingGuards(fsa, naming.getInternalParserClass(this.getGrammar()), this.lookaheadThreshold);
  }
}
项目:xtext-core    文件:RegionAccessDiffTest.java   
@Test
public void testInsertReplaceReplace() {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("8 a");
  _builder.newLine();
  final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
  final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
    @Extension
    final ITextRegionExtensions ext = access.getExtensions();
    EObject _semanticElement = access.regionForRootEObject().getSemanticElement();
    final ValueList rootObj = ((ValueList) _semanticElement);
    final ISemanticRegion a = ext.regionFor(rootObj).keyword("8").getNextSemanticRegion();
    it.replace(a, "b");
    it.replace(a, "c");
  };
  ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("0 0   H");
  _builder_1.newLine();
  _builder_1.append("      ");
  _builder_1.append("B ValueList\'[a]\' Root");
  _builder_1.newLine();
  _builder_1.append("0 1    S \"8\"        Root:\'8\'");
  _builder_1.newLine();
  _builder_1.append("1 1    H \" \"        Whitespace:TerminalRule\'WS\'");
  _builder_1.newLine();
  _builder_1.append("2 1 1  S \"c\"        ValueList:name+=ID");
  _builder_1.newLine();
  _builder_1.append("      ");
  _builder_1.append("E ValueList\'[a]\' Root");
  _builder_1.newLine();
  _builder_1.append("3 0   H");
  _builder_1.newLine();
  _builder_1.append("------------ diff 1 ------------");
  _builder_1.newLine();
  _builder_1.append("2 1 S \"a\"        ValueList:name+=ID");
  _builder_1.newLine();
  this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_1);
}
项目:xtext-core    文件:RegionAccessDiffTest.java   
@Test
public void testSingleSemanticToken() {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("1 foo");
  _builder.newLine();
  final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
  final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
    @Extension
    final ITextRegionExtensions ext = access.getExtensions();
    final EObject root = access.regionForRootEObject().getSemanticElement();
    final ISemanticRegion foo = ext.allRegionsFor(root).feature(RegionaccesstestlanguagePackage.Literals.SIMPLE__NAME);
    it.replace(foo, "baaar");
  };
  ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("0 0   H");
  _builder_1.newLine();
  _builder_1.append("      ");
  _builder_1.append("B Simple\'foo\' Root");
  _builder_1.newLine();
  _builder_1.append("0 1    S \"1\"        Simple:\'1\'");
  _builder_1.newLine();
  _builder_1.append("1 1    H \" \"        Whitespace:TerminalRule\'WS\'");
  _builder_1.newLine();
  _builder_1.append("2 5 1  S \"baaar\"    Simple:name=ID");
  _builder_1.newLine();
  _builder_1.append("      ");
  _builder_1.append("E Simple\'foo\' Root");
  _builder_1.newLine();
  _builder_1.append("7 0   H");
  _builder_1.newLine();
  _builder_1.append("------------ diff 1 ------------");
  _builder_1.newLine();
  _builder_1.append("2 3 S \"foo\"      Simple:name=ID");
  _builder_1.newLine();
  this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_1);
}
项目:xtext-core    文件:BeeLangTestLanguageFormatter.java   
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);
  }
}
项目:xtext-lib    文件:FinalFieldsConstructorProcessor.java   
@Override
public void doTransform(final List<? extends MutableTypeParameterDeclarator> elements, @Extension final TransformationContext context) {
  final Procedure1<MutableTypeParameterDeclarator> _function = new Procedure1<MutableTypeParameterDeclarator>() {
    @Override
    public void apply(final MutableTypeParameterDeclarator it) {
      FinalFieldsConstructorProcessor.this.transform(it, context);
    }
  };
  IterableExtensions.forEach(elements, _function);
}
项目:xtext-lib    文件:FinalFieldsConstructorProcessor.java   
protected void _transform(final MutableClassDeclaration it, @Extension final TransformationContext context) {
  AnnotationReference _findAnnotation = it.findAnnotation(context.findTypeGlobally(Data.class));
  boolean _tripleNotEquals = (_findAnnotation != null);
  if (_tripleNotEquals) {
    return;
  }
  AnnotationReference _findAnnotation_1 = it.findAnnotation(context.findTypeGlobally(Accessors.class));
  boolean _tripleNotEquals_1 = (_findAnnotation_1 != null);
  if (_tripleNotEquals_1) {
    return;
  }
  @Extension
  final FinalFieldsConstructorProcessor.Util util = new FinalFieldsConstructorProcessor.Util(context);
  util.addFinalFieldsConstructor(it);
}
项目:xtext-lib    文件:AccessorsProcessor.java   
@Override
public void doTransform(final List<? extends MutableMemberDeclaration> elements, @Extension final TransformationContext context) {
  final Procedure1<MutableMemberDeclaration> _function = new Procedure1<MutableMemberDeclaration>() {
    @Override
    public void apply(final MutableMemberDeclaration it) {
      AccessorsProcessor.this.transform(it, context);
    }
  };
  IterableExtensions.forEach(elements, _function);
}
项目:xtext-lib    文件:AccessorsProcessor.java   
protected void _transform(final MutableFieldDeclaration it, @Extension final TransformationContext context) {
  @Extension
  final AccessorsProcessor.Util util = new AccessorsProcessor.Util(context);
  boolean _shouldAddGetter = util.shouldAddGetter(it);
  if (_shouldAddGetter) {
    util.addGetter(it, util.toVisibility(util.getGetterType(it)));
  }
  boolean _shouldAddSetter = util.shouldAddSetter(it);
  if (_shouldAddSetter) {
    util.addSetter(it, util.toVisibility(util.getSetterType(it)));
  }
}
项目:xtext-core    文件:AbstractLanguageServerTest.java   
protected void testDefinition(final Procedure1<? super DefinitionTestConfiguration> configurator) {
  try {
    @Extension
    final DefinitionTestConfiguration configuration = new DefinitionTestConfiguration();
    configuration.setFilePath(("MyModel." + this.fileExtension));
    configurator.apply(configuration);
    final String fileUri = this.initializeContext(configuration).getUri();
    TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
    final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
      TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
      it.setTextDocument(_textDocumentIdentifier);
      int _line = configuration.getLine();
      int _column = configuration.getColumn();
      Position _position = new Position(_line, _column);
      it.setPosition(_position);
    };
    TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function);
    final CompletableFuture<List<? extends Location>> definitionsFuture = this.languageServer.definition(_doubleArrow);
    final List<? extends Location> definitions = definitionsFuture.get();
    Procedure1<? super List<? extends Location>> _assertDefinitions = configuration.getAssertDefinitions();
    boolean _tripleNotEquals = (_assertDefinitions != null);
    if (_tripleNotEquals) {
      configuration.getAssertDefinitions().apply(definitions);
    } else {
      final String actualDefinitions = this.toExpectation(definitions);
      this.assertEquals(configuration.getExpectedDefinitions(), actualDefinitions);
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:Vitruv    文件:EnforceAdRootXReRootMappingConditionsFromLeftToRightRoutine.java   
public void callRoutine1(final Addresses aRoot, final Recipients rRoot, @Extension final RoutinesFacade _routinesFacade) {
  _routinesFacade.enforceRightAdRootXReRootMappingConditions(rRoot);
}
项目:Vitruv    文件:CreateAddressXRecipientLocationCityMappingInstanceRoutine.java   
public void callRoutine1(final Recipients rRoot, final Recipient r, final Location l, final City c, final Addresses aRoot, final Address a, @Extension final RoutinesFacade _routinesFacade) {
  _routinesFacade.enforceAddressXRecipientLocationCityMappingConditionsFromRightToLeft(aRoot, rRoot, a, r, l, c);
}
项目:xtext-extras    文件:XbaseFormatter.java   
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());
}
项目:Vitruv    文件:ChangedLastNameReaction.java   
public void callRoutine1(final ReplaceSingleValuedEAttribute replaceChange, final Family affectedEObject, final EAttribute affectedFeature, final String oldValue, final String newValue, @Extension final RoutinesFacade _routinesFacade) {
  _routinesFacade.changeFullNameFromLast(affectedEObject);
}
项目:xtext-extras    文件:XbaseFormatter.java   
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);
}
项目:Vitruv    文件:AddressesCreatedReaction.java   
public void callRoutine1(final Addresses affectedEObject, @Extension final RoutinesFacade _routinesFacade) {
  AdRootXReRootMapping.adRootXReRootMapping().addAddresses(affectedEObject);
}
项目:xtext-core    文件:RegionAccessDiffTest.java   
@Test
public void testInsertBeforeComment() {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("8");
  _builder.newLine();
  _builder.append("/**/");
  _builder.newLine();
  _builder.append("a b");
  _builder.newLine();
  final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
  final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
    @Extension
    final ITextRegionExtensions ext = access.getExtensions();
    EObject _semanticElement = access.regionForRootEObject().getSemanticElement();
    final ValueList rootObj = ((ValueList) _semanticElement);
    final ISemanticRegion a = ext.regionFor(rootObj).keyword("8").getNextSemanticRegion();
    final ISemanticRegion b = a.getNextSemanticRegion();
    it.replace(a.getPreviousHiddenRegion(), a.getPreviousHiddenRegion(), b.getPreviousHiddenRegion(), b.getNextHiddenRegion());
  };
  ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append(" ");
  _builder_1.append("0 0   H");
  _builder_1.newLine();
  _builder_1.append("       ");
  _builder_1.append("B ValueList\'[a, b]\' Root");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("0 1    S \"8\"        Root:\'8\'");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("1 1 1  H \"\\n\"       Whitespace:TerminalRule\'WS\'");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("2 1 1  S \"b\"        ValueList:name+=ID");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("3   1  H \"/**/\"     Comment:TerminalRule\'ML_COMMENT\'");
  _builder_1.newLine();
  _builder_1.append("   ");
  _builder_1.append("5    \"\\n\"       Whitespace:TerminalRule\'WS\'");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("8 1    S \"a\"        ValueList:name+=ID");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("9 1    H \" \"        Whitespace:TerminalRule\'WS\'");
  _builder_1.newLine();
  _builder_1.append("10 1    S \"b\"        ValueList:name+=ID");
  _builder_1.newLine();
  _builder_1.append("       ");
  _builder_1.append("E ValueList\'[a, b]\' Root");
  _builder_1.newLine();
  _builder_1.append("11 0   H");
  _builder_1.newLine();
  _builder_1.append("------------ diff 1 ------------");
  _builder_1.newLine();
  _builder_1.append(" ");
  _builder_1.append("1   H \"\\n\"       Whitespace:TerminalRule\'WS\'");
  _builder_1.newLine();
  _builder_1.append("       ");
  _builder_1.append("\"/**/\"     Comment:TerminalRule\'ML_COMMENT\'");
  _builder_1.newLine();
  _builder_1.append("   ");
  _builder_1.append("6   \"\\n\"       Whitespace:TerminalRule\'WS\'");
  _builder_1.newLine();
  this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_1);
}
项目:Vitruv    文件:RecipientsDeletedReaction.java   
public void callRoutine1(final Recipients affectedEObject, @Extension final RoutinesFacade _routinesFacade) {
  AdRootXReRootMapping.adRootXReRootMapping().removeRecipients(affectedEObject);
}
项目:Vitruv    文件:EnsureAllMappingsRoutine.java   
public void callRoutine1(@Extension final RoutinesFacade _routinesFacade) {
  _routinesFacade.ensureAdRootXReRootMapping();
  _routinesFacade.ensureAddressXRecipientLocationCityMapping();
}
项目:Vitruv    文件:RecipientsCreatedReaction.java   
public void callRoutine1(final Recipients affectedEObject, @Extension final RoutinesFacade _routinesFacade) {
  AdRootXReRootMapping.adRootXReRootMapping().addRecipients(affectedEObject);
}
项目:xtext-extras    文件:XbaseHighlightingCalculator.java   
protected boolean isExtension(JvmIdentifiableElement jvmIdentifiableElement){
    if(jvmIdentifiableElement instanceof JvmAnnotationTarget){
        return annotationLookup.findAnnotation((JvmAnnotationTarget) jvmIdentifiableElement, Extension.class) != null;
    }
    return false;
}
项目:Vitruv    文件:AddressesDeletedReaction.java   
public void callRoutine1(final Addresses affectedEObject, @Extension final RoutinesFacade _routinesFacade) {
  AdRootXReRootMapping.adRootXReRootMapping().removeAddresses(affectedEObject);
}