public boolean eContains(EObject eObject) { return EcoreUtil.isAncestor(this, eObject); }
/** * Return true if the specified eReference from eObject to crossReferencedEObject should be * considered a cross reference by this cross referencer. * @param eObject an object in the cross referencer's content tree. * @param eReference a reference from the object. * @param crossReferencedEObject the target of the specified reference. * @return if the cross referencer should consider the specified reference a cross reference. */ @Override protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject) { return !isAncestor(emfObjects, crossReferencedEObject); }
/** * Return true if the specified eReference from eObject to crossReferencedEObject should be * considered a cross reference by this cross referencer. * @param eObject an object in the cross referencer's content tree. * @param eReference a reference from the object. * @param crossReferencedEObject the target of the specified reference. * @return if the cross referencer should consider the specified reference a cross reference. */ @Override protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject) { return !isAncestor(emfObjects, crossReferencedEObject); }
public boolean eContains(EObject eObject) { return EcoreUtil.isAncestor(this, eObject); }
protected boolean doIsHandled(EObject root, EObject instance) { if (root.eClass() == XtendPackage.Literals.ANONYMOUS_CLASS) { // the immediate constructor call is not processed by the anonymous class itself AnonymousClass casted = (AnonymousClass) root; if (casted == instance || EcoreUtil.isAncestor(casted.getConstructorCall(), instance)) { return false; } } boolean result = EcoreUtil.isAncestor(root, instance); return result; }
private static boolean isLocalEntity(XAbstractFeatureCall featureCall, XExpression container, List<JvmFormalParameter> containerParameters) { final JvmIdentifiableElement feature = featureCall.getFeature(); if (feature instanceof JvmFormalParameter) { if (containerParameters.contains(feature)) { return true; } } else if (feature instanceof XVariableDeclaration) { if (EcoreUtil.isAncestor(container, feature)) { return true; } } return false; }
public void acceptError(String message, EObject object, EStructuralFeature feature, String code, String... issueData) { if (erroneousElements.add(object) && EcoreUtil.isAncestor(inspectedGrammar, object)) validationMessageAcceptor.acceptError(message, object, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code, issueData); }
public void acceptError(String message, EObject object, EStructuralFeature feature, int index, String code, String... issueData) { if (erroneousElements.add(object) && EcoreUtil.isAncestor(inspectedGrammar, object)) validationMessageAcceptor.acceptError(message, object, feature, index, code, issueData); }
@Override protected void doGetElements(JvmType type, List<IEObjectDescription> result) { for(int i = 0; i < types.size(); i++) { JvmType knownType = types.get(i); if (EcoreUtil.isAncestor(knownType, type)) { doGetDescriptions(type, knownType, i, result); } } super.doGetElements(type, result); }
public void announceEof(int lookAhead) { AbstractElement current = getCurrentGrammarElement(); if (current != null && (lastAddedElement == null || !EcoreUtil.isAncestor(current, lastAddedElement))) { if (marked) lookAhead+=lookAheadAddOn; followElements.add(createFollowElement(current, lookAhead)); lastAddedElement = current; } }
@Override public void announceEof(int lookAhead) { AbstractElement current = getCurrentGrammarElement(); if (current != null && (lastAddedElement == null || !EcoreUtil.isAncestor(current, lastAddedElement))) { if (marked > 0) lookAhead += lookAheadAddOn; followElements.add(createFollowElement(current, lookAhead)); lastAddedElement = current; } }
private static void collectVariableFromExpression(XExpression xExpression, IJvmModelAssociations associations, Set<Variable> result, EObject expression) { EList<EObject> eCrossReferences = expression.eCrossReferences(); for (EObject eObject : eCrossReferences) { if (eObject instanceof JvmFormalParameter && !EcoreUtil.isAncestor(xExpression, eObject)) { for (EObject obj : associations.getSourceElements(eObject)) { if (obj instanceof Variable) { result.add((Variable) obj); } } } } }
protected XSDConcreteComponentImpl getDiagnosticTarget(XSDConcreteComponent xsdConcreteComponent) { return EcoreUtil.isAncestor(this, xsdConcreteComponent) && !xsdConcreteComponent.eContainmentFeature().isTransient() ? (XSDConcreteComponentImpl)xsdConcreteComponent : this; }
protected XSDConcreteComponentImpl getDiagnosticTarget(XSDConcreteComponent xsdConcreteComponent) { return EcoreUtil.isAncestor(this, xsdConcreteComponent) && !xsdConcreteComponent.eContainmentFeature().isTransient() ? (XSDConcreteComponentImpl)xsdConcreteComponent : this; }
/** * Provide the error message for mutable variables that may not be captured in lambdas. * * @param variable the writable variable declaration * @param featureCall the reference to the variable * @param resolvedTypes type information */ protected String getInvalidWritableVariableAccessMessage(XVariableDeclaration variable, XAbstractFeatureCall featureCall, IResolvedTypes resolvedTypes) { // TODO this should be part of a separate validation service XClosure containingClosure = EcoreUtil2.getContainerOfType(featureCall, XClosure.class); if (containingClosure != null && !EcoreUtil.isAncestor(containingClosure, variable)) { return String.format("Cannot %srefer to the non-final variable %s inside a lambda expression", getImplicitlyMessagePart(featureCall), variable.getSimpleName()); } return null; }
@Override protected void doGetElements(JvmType type, List<IEObjectDescription> result) { if (type instanceof JvmDeclaredType) { JvmDeclaredType declarator = innermost; while(declarator != null) { if (declarator != type && EcoreUtil.isAncestor(declarator, type)) { doGetDescriptions(type, declarator, 0, result); } declarator = EcoreUtil2.getContainerOfType(declarator.eContainer(), JvmDeclaredType.class); } } super.doGetElements(type, result); }
/** * @generated This field/method will be replaced during code generation. */ public void setRelationshipGen(EJBRelation newRelationship) { if (newRelationship != eInternalContainer() || (eContainerFeatureID != EjbPackage.EJB_RELATIONSHIP_ROLE__RELATIONSHIP && newRelationship != null)) { if (EcoreUtil.isAncestor(this, newRelationship)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newRelationship != null) msgs = ((InternalEObject)newRelationship).eInverseAdd(this, EjbPackage.EJB_RELATION__RELATIONSHIP_ROLES, EJBRelation.class, msgs); msgs = basicSetRelationship(newRelationship, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.EJB_RELATIONSHIP_ROLE__RELATIONSHIP, newRelationship, newRelationship)); }
/** * @generated This field/method will be replaced during code generation. */ public void setEjbJar(EJBJar newEjbJar) { if (newEjbJar != eInternalContainer() || (eContainerFeatureID != EjbPackage.RELATIONSHIPS__EJB_JAR && newEjbJar != null)) { if (EcoreUtil.isAncestor(this, newEjbJar)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newEjbJar != null) msgs = ((InternalEObject)newEjbJar).eInverseAdd(this, EjbPackage.EJB_JAR__RELATIONSHIP_LIST, EJBJar.class, msgs); msgs = basicSetEjbJar(newEjbJar, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EjbPackage.RELATIONSHIPS__EJB_JAR, newEjbJar, newEjbJar)); }
/** * @generated This field/method will be replaced during code generation. */ public void setSecConstraint(SecurityConstraint newSecConstraint) { if (newSecConstraint != eInternalContainer() || (eContainerFeatureID != WebapplicationPackage.USER_DATA_CONSTRAINT__SEC_CONSTRAINT && newSecConstraint != null)) { if (EcoreUtil.isAncestor(this, newSecConstraint)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newSecConstraint != null) msgs = ((InternalEObject)newSecConstraint).eInverseAdd(this, WebapplicationPackage.SECURITY_CONSTRAINT__USER_DATA_CONSTRAINT, SecurityConstraint.class, msgs); msgs = basicSetSecConstraint(newSecConstraint, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, WebapplicationPackage.USER_DATA_CONSTRAINT__SEC_CONSTRAINT, newSecConstraint, newSecConstraint)); }
@Override protected String getInvalidWritableVariableAccessMessage(XVariableDeclaration variable, XAbstractFeatureCall featureCall, IResolvedTypes resolvedTypes) { // Overriding for proper lambda expression. final EObject containingStructure = getNearestClosureOrTypeDeclaration(featureCall, resolvedTypes); if (containingStructure instanceof XClosure && !EcoreUtil.isAncestor(containingStructure, variable)) { final GeneratorConfig generatorConfig = this.generatorConfigProvider.get( EcoreUtil.getRootContainer(containingStructure)); if (generatorConfig != null && generatorConfig.getJavaSourceVersion().isAtLeast(JavaVersion.JAVA8)) { return null; } } return super.getInvalidWritableVariableAccessMessage(variable, featureCall, resolvedTypes); }