protected IScope getExecutableScope(XAbstractFeatureCall call, JvmIdentifiableElement feature) { QualifiedName name = QualifiedName.create(feature.getSimpleName()); 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) { String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(3)); return new SingletonScope(EObjectDescription.create(propertyName, feature), IScope.NULLSCOPE); } if (call.isExplicitOperationCallOrBuilderSyntax() || ((JvmExecutable) feature).getParameters().size() > 1 || (!call.isExtension() && ((JvmExecutable) feature).getParameters().size() == 1)) { return new SingletonScope(EObjectDescription.create(name, feature), IScope.NULLSCOPE); } if (feature.getSimpleName().startsWith("get") || feature.getSimpleName().startsWith("is")) { List<IEObjectDescription> result = Lists.newArrayListWithCapacity(2); result.add(EObjectDescription.create(name, feature)); if (feature.getSimpleName().startsWith("get")) { String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(3)); result.add(EObjectDescription.create(propertyName, feature)); } else { String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(2)); result.add(EObjectDescription.create(propertyName, feature)); } return new SimpleScope(result); } return new SingletonScope(EObjectDescription.create(name, feature), IScope.NULLSCOPE); }
protected void computeFeatureCallHighlighting( XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor) { JvmIdentifiableElement feature = featureCall.getFeature(); if (feature != null && !feature.eIsProxy()) { if (feature instanceof JvmField) { if (((JvmField) feature).isStatic()) { highlightFeatureCall(featureCall, acceptor, STATIC_FIELD); } else { highlightFeatureCall(featureCall, acceptor, FIELD); } } else if (feature instanceof JvmOperation && !featureCall.isOperation()) { JvmOperation jvmOperation = (JvmOperation) feature; if (jvmOperation.isStatic()) highlightFeatureCall(featureCall, acceptor, STATIC_METHOD_INVOCATION); } if (!(featureCall instanceof XBinaryOperation || featureCall instanceof XUnaryOperation || featureCall instanceof XPostfixOperation)) { if (featureCall.isExtension()) { highlightFeatureCall(featureCall, acceptor, EXTENSION_METHOD_INVOCATION); } else { // Extensions without implicit first argument XExpression implicitReceiver = featureCall.getImplicitReceiver(); if (implicitReceiver != null && implicitReceiver instanceof XAbstractFeatureCall) { if (isExtension(((XAbstractFeatureCall) implicitReceiver).getFeature())) highlightFeatureCall(featureCall, acceptor, EXTENSION_METHOD_INVOCATION); } } } if (feature instanceof JvmAnnotationTarget && DeprecationUtil.isDeprecated((JvmAnnotationTarget) feature)) { highlightFeatureCall(featureCall, acceptor, DEPRECATED_MEMBERS); } } }