Java Code Examples for org.eclipse.xtext.xbase.XAbstractFeatureCall#isExtension()
The following examples show how to use
org.eclipse.xtext.xbase.XAbstractFeatureCall#isExtension() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SerializerScopeProvider.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected IScope getExecutableScope(XAbstractFeatureCall call, JvmIdentifiableElement feature) { final String simpleName = feature.getSimpleName(); QualifiedName name = QualifiedName.create(simpleName); if (call.isOperation()) { QualifiedName operator = getOperator(call, name); if (operator == null) { return IScope.NULLSCOPE; } return new SingletonScope(EObjectDescription.create(operator, feature), IScope.NULLSCOPE); } if (call instanceof XAssignment) { return getAccessorScope(simpleName, name, feature); } if (call.isExplicitOperationCallOrBuilderSyntax() || ((JvmExecutable) feature).getParameters().size() > 1 || (!call.isExtension() && ((JvmExecutable) feature).getParameters().size() == 1)) { return new SingletonScope(EObjectDescription.create(name, feature), IScope.NULLSCOPE); } return getAccessorScope(simpleName, name, feature); }
Example 2
Source File: FeatureCallCompiler.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
private boolean isPotentialJavaOperation(XAbstractFeatureCall featureCall) { if (featureCall.isOperation()) { return true; } if (featureCall.eClass() == XbasePackage.Literals.XMEMBER_FEATURE_CALL && featureCall.isStatic() && featureCall.isExtension() && featureCall.getActualArguments().size() == 2) { JvmIdentifiableElement feature = featureCall.getFeature(); if (feature.eClass() == TypesPackage.Literals.JVM_OPERATION) { JvmDeclaredType declarator = ((JvmOperation) feature).getDeclaringType(); if (IntegerExtensions.class.getName().equals(declarator.getIdentifier()) || LongExtensions.class.getName().equals(declarator.getIdentifier())) { String simpleName = feature.getSimpleName(); if (simpleName.startsWith("bitwise") || simpleName.startsWith("shift")) { return true; } } } } return false; }
Example 3
Source File: TypeUsageCollector.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected void collectStaticImportsFrom(XExpression expression, JvmIdentifiableElement feature) { if (expression instanceof XAbstractFeatureCall) { if (feature instanceof JvmEnumerationLiteral && expression instanceof XFeatureCall) { if (isEnumLiteralImplicitelyImported(expression, (JvmEnumerationLiteral) feature)) { return; } } XAbstractFeatureCall featureCall = (XAbstractFeatureCall) expression; if ((feature instanceof JvmOperation || feature instanceof JvmField) && featureCall.isStatic()) { if (featureCall.isExtension()) { acceptStaticExtensionImport((JvmMember) feature); } else { acceptStaticImport((JvmMember) feature); } } } }
Example 4
Source File: ImportsCollector.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void collectStaticImportsFrom(final XAbstractFeatureCall abstractFeatureCall, final ImportsAcceptor acceptor) { boolean _isStatic = abstractFeatureCall.isStatic(); if (_isStatic) { boolean _isExtension = abstractFeatureCall.isExtension(); if (_isExtension) { acceptor.acceptStaticExtensionImport(abstractFeatureCall); } else { acceptor.acceptStaticImport(abstractFeatureCall); } } }
Example 5
Source File: XbaseHighlightingCalculator.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected void computeFeatureCallHighlighting(XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor) { JvmIdentifiableElement feature = featureCall.getFeature(); if (feature != null && !feature.eIsProxy()) { if (feature instanceof XVariableDeclaration) { if (!SPECIAL_FEATURE_NAMES.contains(((XVariableDeclaration) feature).getName())) { // highlighting of special identifiers is done separately, so it's omitted here highlightFeatureCall(featureCall, acceptor, LOCAL_VARIABLE); if (!((XVariableDeclaration) feature).isWriteable()) { highlightFeatureCall(featureCall, acceptor, LOCAL_FINAL_VARIABLE); } } } else if (feature instanceof JvmFormalParameter) { if (!SPECIAL_FEATURE_NAMES.contains(((JvmFormalParameter) feature).getName())) { // highlighting of special identifiers is done separately, so it's omitted here final EObject eContainingFeature = feature.eContainingFeature(); if (eContainingFeature == TypesPackage.Literals.JVM_EXECUTABLE__PARAMETERS || eContainingFeature == XbasePackage.Literals.XCLOSURE__DECLARED_FORMAL_PARAMETERS) { // which is the case for constructors and methods highlightFeatureCall(featureCall, acceptor, PARAMETER_VARIABLE); } else { // covers parameters of for and template expr FOR loops, as well as switch statements highlightFeatureCall(featureCall, acceptor, LOCAL_VARIABLE); highlightFeatureCall(featureCall, acceptor, LOCAL_FINAL_VARIABLE); } } } else if (feature instanceof JvmTypeParameter) { highlightFeatureCall(featureCall, acceptor, TYPE_VARIABLE); } else if (feature instanceof JvmField) { highlightFeatureCall(featureCall, acceptor, FIELD); if (((JvmField) feature).isStatic()) { highlightFeatureCall(featureCall, acceptor, STATIC_FIELD); if (((JvmField) feature).isFinal()) { highlightFeatureCall(featureCall, acceptor, STATIC_FINAL_FIELD); } } } else if (feature instanceof JvmOperation && !featureCall.isOperation()) { JvmOperation jvmOperation = (JvmOperation) feature; highlightFeatureCall(featureCall, acceptor, METHOD); if (jvmOperation.isAbstract()) { highlightFeatureCall(featureCall, acceptor, ABSTRACT_METHOD_INVOCATION); } if (jvmOperation.isStatic()) { highlightFeatureCall(featureCall, acceptor, STATIC_METHOD_INVOCATION); } if (featureCall.isExtension() || isExtensionWithImplicitFirstArgument(featureCall)) { highlightFeatureCall(featureCall, acceptor, EXTENSION_METHOD_INVOCATION); } } else if (feature instanceof JvmDeclaredType) { highlightReferenceJvmType(acceptor, featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, feature); } if(feature instanceof JvmAnnotationTarget && DeprecationUtil.isTransitivelyDeprecated((JvmAnnotationTarget)feature)){ highlightFeatureCall(featureCall, acceptor, DEPRECATED_MEMBERS); } } }