gpt4 book ai didi

org.eclipse.xtext.xbase.XExpression.eResource()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 14:13:05 25 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.xtext.xbase.XExpression.eResource()方法的一些代码示例,展示了XExpression.eResource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XExpression.eResource()方法的具体详情如下:
包路径:org.eclipse.xtext.xbase.XExpression
类名称:XExpression
方法名:eResource

XExpression.eResource介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

private void resolveTypes(final XExpression expression) {
 final Resource resource = expression.eResource();
 IResolvedTypes resolvedTypes = this.resolvedTypesPerResource.get(resource);
 if ((resolvedTypes == null)) {
  resolvedTypes = this.typeResolver.resolveTypes(expression);
  this.resolvedTypesPerResource.put(resource, resolvedTypes);
 }
 this.resolvedTypesStack.push(resolvedTypes);
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

@Override
public void associateLogicalContainer(XExpression logicalChild, JvmIdentifiableElement element) {
  if (logicalChild == null)
    return;
  final Map<EObject, JvmIdentifiableElement> mapping = getLogicalContainerMapping(logicalChild.eResource());
  mapping.put(logicalChild, element);
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Replies the resource to which the XExpression is attached.
 */
@Pure
public Resource eResource() {
  return getXExpression().eResource();
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Replies the resource to which the XExpression is attached.
 */
@Pure
public Resource eResource() {
  return getXExpression().eResource();
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

@Override
public void applyToModel(IResolvedTypes resolvedTypes) {
  Resource resource = getExpression().eResource();
  if (resource instanceof LazyLinkingResource) {
    LazyLinkingResource lazyLinkingResource = (LazyLinkingResource) resource;
    EObject referenced = (InternalEObject) getExpression().eGet(XbasePackage.Literals.XCONSTRUCTOR_CALL__CONSTRUCTOR, false);
    lazyLinkingResource.markUnresolvable(referenced);
  }
}

代码示例来源:origin: openhab/openhab-core

@Override
public Object execute() throws ScriptExecutionException {
  if (xExpression != null) {
    Resource resource = xExpression.eResource();
    IEvaluationContext evaluationContext = null;
    if (resource instanceof XtextResource) {
      IResourceServiceProvider provider = ((XtextResource) resource).getResourceServiceProvider();
      evaluationContext = provider.get(IEvaluationContext.class);
    }
    return execute(evaluationContext);
  } else {
    throw new ScriptExecutionException("Script does not contain any expression");
  }
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Create a reference to "this" object or to the current type.
 *
 * @return the reference.
 */
public XFeatureCall createReferenceToThis() {
  final XExpression expr = getXExpression();
  XtendTypeDeclaration type = EcoreUtil2.getContainerOfType(expr, XtendTypeDeclaration.class);
  JvmType jvmObject = getAssociatedElement(JvmType.class, type, expr.eResource());
  final XFeatureCall thisFeature = XbaseFactory.eINSTANCE.createXFeatureCall();
  thisFeature.setFeature(jvmObject);
  return thisFeature;
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

@Override
public void applyToModel(IResolvedTypes resolvedTypes) {
  Resource resource = getExpression().eResource();
  if (resource instanceof LazyLinkingResource) {
    LazyLinkingResource lazyLinkingResource = (LazyLinkingResource) resource;
    EObject referenced = (InternalEObject) getExpression().eGet(getReference(), false);
    lazyLinkingResource.markUnresolvable(referenced);
  }
}

代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core

public Object evaluate(final XExpression expression, final JvmTypeReference expectedType) {
 try {
  final Object result = this.interpreter.evaluate(expression, expectedType);
  return this.translate(result);
 } catch (final Throwable _t) {
  if (_t instanceof ConstantExpressionEvaluationException) {
   final ConstantExpressionEvaluationException e = (ConstantExpressionEvaluationException)_t;
   String _message = e.getMessage();
   final EObjectDiagnosticImpl error = new EObjectDiagnosticImpl(Severity.ERROR, "constant_expression_evaluation_problem", _message, expression, null, (-1), null);
   expression.eResource().getErrors().add(error);
   return null;
  } else {
   throw Exceptions.sneakyThrow(_t);
  }
 }
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

if (encoder.isCrossLinkFragment(expression.eResource(), fragment)) {
  INode node = encoder.getNode(expression, fragment);
  final EClass requiredType = reference.getEReferenceType();

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

@Override
public final ITypeComputationResult computeTypes(/* @Nullable */ XExpression expression) {
  resolvedTypes.checkCanceled();
  if (expression != null) {
    if (expression.eContainer() == null && expression.eResource() == null)
      throw new IllegalStateException("Dangling expression: " + expression);
    assert getResolvedTypes().doGetTypeData(expression) == null : "Expression was already resolved: " + expression;  
    ExpressionAwareStackedResolvedTypes stackedResolvedTypes = doComputeTypes(expression);
    stackedResolvedTypes.performMergeIntoParent();
    return new ResolutionBasedComputationResult(expression, resolvedTypes);
  } else {
    return new NoTypeResult(null, getReferenceOwner());
  }
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

@Override
public void applyToModel(IResolvedTypes resolvedTypes) {
  Resource resource = getExpression().eResource();
  if (resource instanceof LazyLinkingResource) {
    LazyLinkingResource lazyLinkingResource = (LazyLinkingResource) resource;
    
    TypeAwareLinkingDiagnosticContext context = new TypeAwareLinkingDiagnosticContext(this, resolvedTypes);
    DiagnosticMessage message = lazyLinkingResource.getDiagnosticMessageProvider()
        .getUnresolvedProxyMessage(context);
    if (message != null) {
      List<Resource.Diagnostic> diagnostics = getDiagnosticList(lazyLinkingResource, message);
      Diagnostic diagnostic = createDiagnostic(message);
      diagnostics.add(diagnostic);
    }
    EObject referenced = (InternalEObject) getExpression().eGet(getReference(), false);
    lazyLinkingResource.markUnresolvable(referenced);
  }
}

代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core

HashMap<String, JvmIdentifiableElement> _xblockexpression = null;
 Resource _eResource = expression.eResource();
 final Resource res = _eResource;
 boolean _matched = false;
 final Provider<HashMap<String, JvmIdentifiableElement>> _function = () -> {
  final HashMap<String, JvmIdentifiableElement> result = CollectionLiterals.<String, JvmIdentifiableElement>newHashMap();
  Resource _eResource_1 = expression.eResource();
  final XImportSection section = this.importSectionLocator.getImportSection(((XtextResource) _eResource_1));
  if ((section != null)) {
  return result;
 };
 _xblockexpression = this.cache.<HashMap<String, JvmIdentifiableElement>>get(_mappedTo, expression.eResource(), _function);

代码示例来源:origin: openhab/openhab-core

@Override
public Object execute(final IEvaluationContext evaluationContext) throws ScriptExecutionException {
  if (xExpression != null) {
    Resource resource = xExpression.eResource();
    IExpressionInterpreter interpreter = null;
    if (resource instanceof XtextResource) {

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Create a reference to "super" object or to the super type.
 *
 * @return the reference.
 */
public XFeatureCall createReferenceToSuper() {
  final XExpression expr = getXExpression();
  XtendTypeDeclaration type = EcoreUtil2.getContainerOfType(expr, XtendTypeDeclaration.class);
  JvmType jvmObject = getAssociatedElement(JvmType.class, type, expr.eResource());
  final XFeatureCall superFeature = XbaseFactory.eINSTANCE.createXFeatureCall();
  JvmIdentifiableElement feature;
  if (jvmObject instanceof JvmDeclaredType) {
    feature = ((JvmDeclaredType) jvmObject).getExtendedClass().getType();
  } else {
    feature = findType(expr, getQualifiedName(type)).getType();
    if (feature instanceof JvmDeclaredType) {
      feature = ((JvmDeclaredType) feature).getExtendedClass().getType();
    } else {
      feature = null;
    }
  }
  if (feature == null) {
    return null;
  }
  superFeature.setFeature(feature);
  return superFeature;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com