当前位置: 首页>>代码示例>>Java>>正文


Java Extension类代码示例

本文整理汇总了Java中org.eclipse.xtext.xbase.lib.Extension的典型用法代码示例。如果您正苦于以下问题:Java Extension类的具体用法?Java Extension怎么用?Java Extension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Extension类属于org.eclipse.xtext.xbase.lib包,在下文中一共展示了Extension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _format

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:26,代码来源:XbaseFormatter.java

示例2: format

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
@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;
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:24,代码来源:IndentOnceAutowrapFormatter.java

示例3: getSwitchVariableType

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:XSwitchExpressions.java

示例4: testFormatting

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:23,代码来源:AbstractLanguageServerTest.java

示例5: doTransform

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
@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);
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:17,代码来源:PropertyProcessor.java

示例6: callRoutine1

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:24,代码来源:CreateMaleMemberOfFamilyRoutine.java

示例7: callRoutine1

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:24,代码来源:CreateFemaleMemberOfFamilyRoutine.java

示例8: _format

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:8,代码来源:OCCIFormatter.java

示例9: testDeleteTwo

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
@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);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:52,代码来源:RegionAccessDiffTest.java

示例10: addEitherSetter

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:15,代码来源:JsonRpcDataProcessor.java

示例11: _format

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:15,代码来源:XtypeFormatter.java

示例12: isHandled

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:TypesOrderUtil.java

示例13: isJavaCaseExpression

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:29,代码来源:XSwitchExpressions.java

示例14: getDeltasForChangedResources

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:12,代码来源:Indexer.java

示例15: executeAction1

import org.eclipse.xtext.xbase.lib.Extension; //导入依赖的package包/类
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);
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:8,代码来源:CreateAdRootXReRootMappingInstanceRoutine.java


注:本文中的org.eclipse.xtext.xbase.lib.Extension类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。