/** * @since 2.7 */ public void resolveBatched(EObject root, CancelIndicator monitor) { batchTypeResolver.resolveTypes(root, monitor); }
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); }
protected LightweightTypeReference getActualType(EObject context, JvmIdentifiableElement element) { return typeResolver.resolveTypes(context).getActualType(element); }
protected LightweightTypeReference getActualType(XExpression expression) { return typeResolver.resolveTypes(expression).getActualType(expression); }
protected LightweightTypeReference getExpectedType(XExpression expression) { return typeResolver.resolveTypes(expression).getExpectedType(expression); }
protected LightweightTypeReference getActualType(JvmIdentifiableElement identifiable) { return typeResolver.resolveTypes(identifiable).getActualType(identifiable); }
protected IResolvedTypes getResolvedTypes(EObject obj) { return getTypeResolver().resolveTypes(obj); }
public InvokedResolvedOperation resolve(XAbstractFeatureCall featureCall) { IResolvedTypes resolvedTypes = batchTypeResolver.resolveTypes(featureCall); ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, featureCall); return resolve(featureCall, resolvedTypes, owner); }
private LightweightTypeReference determineReturnType(JvmOperation operation) { // operation could have been removed by AA, thus the resource is possibly null if(operation != null && operation.eResource() != null) { return batchTypeResolver.resolveTypes(operation).getActualType(operation); } return null; }
protected LightweightTypeReference resolveType(XExpression element, Class<?> clazz) { LightweightTypeReference elementType = typeResolver.resolveTypes(element).getActualType(element); return elementType != null && elementType.isType(clazz) ? elementType : null; }
/** Compute the expected type of the given expression. * * @param expr the expression. * @return the expected type of the argument. */ protected LightweightTypeReference getExpectedType(XExpression expr) { final IResolvedTypes resolvedTypes = getTypeResolver().resolveTypes(expr); final LightweightTypeReference actualType = resolvedTypes.getActualType(expr); return actualType; }
/** Compute the expected type of the given expression. * * @param expr the expression. * @return the expected type of the argument. */ protected LightweightTypeReference getExpectedType(XExpression expr) { final IResolvedTypes resolvedTypes = getTypeResolver().resolveTypes(expr); final LightweightTypeReference actualType = resolvedTypes.getActualType(expr); return actualType; }
protected String expressionTypes(Iterable<XExpression> expressions) { Iterator<XExpression> iterator = expressions.iterator(); if (iterator.hasNext()) { XExpression expression = iterator.next(); IResolvedTypes resolvedTypes = typeResolver.resolveTypes(expression); LightweightTypeReference reference = resolvedTypes.getActualType(expression); if (!iterator.hasNext()) { return referenceToString(reference); } StringBuilder result = new StringBuilder(reference.toString()); while (iterator.hasNext()) { reference = resolvedTypes.getActualType(iterator.next()); result.append(", "); result.append(referenceToString(reference)); } return result.toString(); } else { return ""; } }
protected LightweightTypeReference resolveType(XExpression element, Class<?> clazz) { LightweightTypeReference elementType = batchTypeResolver.resolveTypes(element).getActualType(element); return elementType != null && elementType.isType(clazz) ? elementType : null; }
/** * @param context the current instance that owns the referenced proxy. * @param reference the {@link EReference} that has the proxy value. * @param uriFragment the lazy linking fragment. * @param monitor used to cancel type resolution * * @return the resolved object for the given context or <code>null</code> if it couldn't be resolved * @since 2.7 */ public EObject resolveBatched(EObject context, EReference reference, String uriFragment, CancelIndicator monitor) { if (reference.isMany()) throw new IllegalArgumentException("Not yet implemented for #many references"); batchTypeResolver.resolveTypes(context, monitor); EObject result = (EObject) context.eGet(reference, false); if (result.eIsProxy()) return null; return result; }
protected void createLocalVariableAndImplicitProposals(final EObject model, final IExpressionScope.Anchor anchor, final ContentAssistContext context, final IIdeContentProposalAcceptor acceptor) { String prefix = context.getPrefix(); if (((prefix.length() > 0) && (!Character.isJavaIdentifierStart(prefix.charAt(0))))) { return; } IResolvedTypes _xifexpression = null; if ((model != null)) { _xifexpression = this.typeResolver.resolveTypes(model); } else { _xifexpression = this.typeResolver.resolveTypes(context.getResource()); } final IResolvedTypes resolvedTypes = _xifexpression; final IExpressionScope expressionScope = resolvedTypes.getExpressionScope(model, anchor); final IScope scope = expressionScope.getFeatureScope(); this.getCrossrefProposalProvider().lookupCrossReference(scope, this._xbaseGrammarAccess.getXFeatureCallAccess().getFeatureJvmIdentifiableElementCrossReference_2_0(), context, acceptor, this.featureDescriptionPredicate); }
@Override public boolean filterKeyword(final Keyword keyword, final ContentAssistContext context) { final String value = keyword.getValue(); if (((value.length() > 1) && Character.isLetter(value.charAt(0)))) { if ((Objects.equal(value, "as") || Objects.equal(value, "instanceof"))) { final EObject previousModel = context.getPreviousModel(); if ((previousModel instanceof XExpression)) { if (((context.getPrefix().length() == 0) && (NodeModelUtils.getNode(previousModel).getEndOffset() > context.getOffset()))) { return false; } final LightweightTypeReference type = this.typeResolver.resolveTypes(previousModel).getActualType(((XExpression)previousModel)); if (((type == null) || type.isPrimitiveVoid())) { return false; } } } return true; } return false; }
/** * @param context unused in this context but required for dispatching * @param indicator unused in this context but required for dispatching */ protected Object _doEvaluate(XStringLiteral literal, IEvaluationContext context, CancelIndicator indicator) { LightweightTypeReference type = typeResolver.resolveTypes(literal).getActualType(literal); if (type != null && (type.isType(Character.TYPE) || type.isType(Character.class))) { return literal.getValue().charAt(0); } return literal.getValue(); }
protected JvmIdentifiableElement getReferencedElement(EObject owner, EReference reference) { JvmIdentifiableElement referencedThing = (JvmIdentifiableElement) owner.eGet(reference); if (referencedThing != null && owner instanceof XConstructorCall && referencedThing.eIsProxy()) { JvmIdentifiableElement potentiallyLinkedType = batchTypeResolver.resolveTypes(owner).getLinkedFeature((XConstructorCall)owner); if (potentiallyLinkedType != null && !potentiallyLinkedType.eIsProxy()) { referencedThing = potentiallyLinkedType; } } return referencedThing; }
protected Object internalEvaluate(XExpression expression, IEvaluationContext context, CancelIndicator indicator) throws EvaluationException { if (indicator.isCanceled()) throw new InterpreterCanceledException(); Object result = doEvaluate(expression, context, indicator); final LightweightTypeReference expectedType = typeResolver.resolveTypes(expression).getExpectedType(expression); if(expectedType != null) result = wrapOrUnwrapArray(result, expectedType); return result; }