Java Code Examples for org.eclipse.emf.ecore.util.EcoreUtil#isAncestor()

The following examples show how to use org.eclipse.emf.ecore.util.EcoreUtil#isAncestor() . 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
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated
 */
@Override
public void setBrickd(MBrickd newBrickd) {
    if (newBrickd != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.MBRICKLET_AMBIENT_LIGHT_V2__BRICKD && newBrickd != null)) {
        if (EcoreUtil.isAncestor(this, newBrickd))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newBrickd != null)
            msgs = ((InternalEObject) newBrickd).eInverseAdd(this, ModelPackage.MBRICKD__MDEVICES, MBrickd.class,
                    msgs);
        msgs = basicSetBrickd(newBrickd, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_AMBIENT_LIGHT_V2__BRICKD,
                newBrickd, newBrickd));
    }
 
Example 2
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setModel(OlapModel newModel) {
	if (newModel != eInternalContainer() || (eContainerFeatureID() != OlapModelPackage.VIRTUAL_CUBE__MODEL && newModel != null)) {
		if (EcoreUtil.isAncestor(this, newModel))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newModel != null)
			msgs = ((InternalEObject)newModel).eInverseAdd(this, OlapModelPackage.OLAP_MODEL__VIRTUAL_CUBES, OlapModel.class, msgs);
		msgs = basicSetModel(newModel, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, OlapModelPackage.VIRTUAL_CUBE__MODEL, newModel, newModel));
}
 
Example 3
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setMbrick(MBrickletLoadCell newMbrick) {
    if (newMbrick != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.LOAD_CELL_WEIGHT__MBRICK && newMbrick != null)) {
        if (EcoreUtil.isAncestor(this, newMbrick))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newMbrick != null)
            msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES,
                    MSubDeviceHolder.class, msgs);
        msgs = basicSetMbrick(newMbrick, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.LOAD_CELL_WEIGHT__MBRICK, newMbrick,
                newMbrick));
}
 
Example 4
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setMbrick(MBrickletMultiTouch newMbrick) {
    if (newMbrick != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.MULTI_TOUCH_DEVICE__MBRICK && newMbrick != null)) {
        if (EcoreUtil.isAncestor(this, newMbrick))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newMbrick != null)
            msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES,
                    MSubDeviceHolder.class, msgs);
        msgs = basicSetMbrick(newMbrick, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MULTI_TOUCH_DEVICE__MBRICK, newMbrick,
                newMbrick));
}
 
Example 5
Source Project: ifml-editor   File: ConditionalExpressionImpl.java    License: MIT License 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setParentViewComponentPart(ViewComponentPart newParentViewComponentPart) {
	if (newParentViewComponentPart != eInternalContainer() || (eContainerFeatureID() != CorePackage.CONDITIONAL_EXPRESSION__PARENT_VIEW_COMPONENT_PART && newParentViewComponentPart != null)) {
		if (EcoreUtil.isAncestor(this, newParentViewComponentPart))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newParentViewComponentPart != null)
			msgs = ((InternalEObject)newParentViewComponentPart).eInverseAdd(this, CorePackage.VIEW_COMPONENT_PART__SUB_VIEW_COMPONENT_PARTS, ViewComponentPart.class, msgs);
		msgs = basicSetParentViewComponentPart(newParentViewComponentPart, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.CONDITIONAL_EXPRESSION__PARENT_VIEW_COMPONENT_PART, newParentViewComponentPart, newParentViewComponentPart));
}
 
Example 6
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setMbrick(MBrickServo newMbrick) {
    if (newMbrick != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.MSERVO__MBRICK && newMbrick != null)) {
        if (EcoreUtil.isAncestor(this, newMbrick))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newMbrick != null)
            msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES,
                    MSubDeviceHolder.class, msgs);
        msgs = basicSetMbrick(newMbrick, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MSERVO__MBRICK, newMbrick, newMbrick));
}
 
Example 7
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setMbrick(MBrickletColor newMbrick) {
    if (newMbrick != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.COLOR_LED__MBRICK && newMbrick != null)) {
        if (EcoreUtil.isAncestor(this, newMbrick))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newMbrick != null)
            msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES,
                    MSubDeviceHolder.class, msgs);
        msgs = basicSetMbrick(newMbrick, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.COLOR_LED__MBRICK, newMbrick,
                newMbrick));
}
 
Example 8
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setBrickd(MBrickd newBrickd) {
    if (newBrickd != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.MBRICKLET_DISTANCE_US__BRICKD && newBrickd != null)) {
        if (EcoreUtil.isAncestor(this, newBrickd))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newBrickd != null)
            msgs = ((InternalEObject) newBrickd).eInverseAdd(this, ModelPackage.MBRICKD__MDEVICES, MBrickd.class,
                    msgs);
        msgs = basicSetBrickd(newBrickd, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_DISTANCE_US__BRICKD, newBrickd,
                newBrickd));
}
 
Example 9
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setModel(PhysicalModel newModel) {
	if (newModel != eInternalContainer() || (eContainerFeatureID() != PhysicalModelPackage.PHYSICAL_PRIMARY_KEY__MODEL && newModel != null)) {
		if (EcoreUtil.isAncestor(this, newModel))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newModel != null)
			msgs = ((InternalEObject)newModel).eInverseAdd(this, PhysicalModelPackage.PHYSICAL_MODEL__PRIMARY_KEYS, PhysicalModel.class, msgs);
		msgs = basicSetModel(newModel, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, PhysicalModelPackage.PHYSICAL_PRIMARY_KEY__MODEL, newModel, newModel));
}
 
Example 10
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setBrickd(MBrickd newBrickd) {
    if (newBrickd != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.MBRICK_SERVO__BRICKD && newBrickd != null)) {
        if (EcoreUtil.isAncestor(this, newBrickd))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newBrickd != null)
            msgs = ((InternalEObject) newBrickd).eInverseAdd(this, ModelPackage.MBRICKD__MDEVICES, MBrickd.class,
                    msgs);
        msgs = basicSetBrickd(newBrickd, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICK_SERVO__BRICKD, newBrickd,
                newBrickd));
}
 
Example 11
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setMbrick(MBrickletRemoteSwitch newMbrick) {
    if (newMbrick != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.REMOTE_SWITCH_A__MBRICK && newMbrick != null)) {
        if (EcoreUtil.isAncestor(this, newMbrick))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newMbrick != null)
            msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES,
                    MSubDeviceHolder.class, msgs);
        msgs = basicSetMbrick(newMbrick, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REMOTE_SWITCH_A__MBRICK, newMbrick,
                newMbrick));
}
 
Example 12
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setMbrick(MBrickletJoystick newMbrick) {
    if (newMbrick != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.JOYSTICK_XPOSITION__MBRICK && newMbrick != null)) {
        if (EcoreUtil.isAncestor(this, newMbrick))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newMbrick != null)
            msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES,
                    MSubDeviceHolder.class, msgs);
        msgs = basicSetMbrick(newMbrick, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.JOYSTICK_XPOSITION__MBRICK, newMbrick,
                newMbrick));
}
 
Example 13
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setModel(BusinessModel newModel) {
	if (newModel != eInternalContainer() || (eContainerFeatureID() != BusinessModelPackage.BUSINESS_RELATIONSHIP__MODEL && newModel != null)) {
		if (EcoreUtil.isAncestor(this, newModel))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newModel != null)
			msgs = ((InternalEObject)newModel).eInverseAdd(this, BusinessModelPackage.BUSINESS_MODEL__RELATIONSHIPS, BusinessModel.class, msgs);
		msgs = basicSetModel(newModel, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, BusinessModelPackage.BUSINESS_RELATIONSHIP__MODEL, newModel, newModel));
}
 
Example 14
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setModel(OlapModel newModel) {
	if (newModel != eInternalContainer() || (eContainerFeatureID() != OlapModelPackage.DIMENSION__MODEL && newModel != null)) {
		if (EcoreUtil.isAncestor(this, newModel))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newModel != null)
			msgs = ((InternalEObject)newModel).eInverseAdd(this, OlapModelPackage.OLAP_MODEL__DIMENSIONS, OlapModel.class, msgs);
		msgs = basicSetModel(newModel, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, OlapModelPackage.DIMENSION__MODEL, newModel, newModel));
}
 
Example 15
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setOwner(Composite newOwner) {
	if (newOwner != eInternalContainer() || (eContainerFeatureID() != DomPackage.COMPOSED_CONTENT__OWNER && newOwner != null)) {
		if (EcoreUtil.isAncestor(this, newOwner))
			throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
		NotificationChain msgs = null;
		if (eInternalContainer() != null)
			msgs = eBasicRemoveFromContainer(msgs);
		if (newOwner != null)
			msgs = ((InternalEObject)newOwner).eInverseAdd(this, DomPackage.COMPOSITE__CONTENTS, Composite.class, msgs);
		msgs = basicSetOwner(newOwner, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.COMPOSED_CONTENT__OWNER, newOwner, newOwner));
}
 
Example 16
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setMbrick(MBrickletPTC newMbrick) {
    if (newMbrick != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.PTC_CONNECTED__MBRICK && newMbrick != null)) {
        if (EcoreUtil.isAncestor(this, newMbrick))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newMbrick != null)
            msgs = ((InternalEObject) newMbrick).eInverseAdd(this, ModelPackage.MSUB_DEVICE_HOLDER__MSUBDEVICES,
                    MSubDeviceHolder.class, msgs);
        msgs = basicSetMbrick(newMbrick, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.PTC_CONNECTED__MBRICK, newMbrick,
                newMbrick));
}
 
Example 17
Source Project: M2Doc   File: TemplateImpl.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public void setDocumentTemplate(DocumentTemplate newDocumentTemplate) {
    if (newDocumentTemplate != eInternalContainer()
        || (eContainerFeatureID() != TemplatePackage.TEMPLATE__DOCUMENT_TEMPLATE && newDocumentTemplate != null)) {
        if (EcoreUtil.isAncestor(this, newDocumentTemplate))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newDocumentTemplate != null)
            msgs = ((InternalEObject) newDocumentTemplate).eInverseAdd(this,
                    TemplatePackage.DOCUMENT_TEMPLATE__TEMPLATES, DocumentTemplate.class, msgs);
        msgs = basicSetDocumentTemplate(newDocumentTemplate, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, TemplatePackage.TEMPLATE__DOCUMENT_TEMPLATE,
                newDocumentTemplate, newDocumentTemplate));
}
 
Example 18
@Override
public void completeType_Members(EObject model, Assignment assignment, ContentAssistContext context,
		ICompletionProposalAcceptor acceptor) {
	if (isValidTypeForOverriding(model)) {
		INode node = context.getCurrentNode();
		EObject eObject = NodeModelUtils.findActualSemanticObjectFor(node);
		if (!(eObject instanceof AnonymousClass)) {
			// due to some optimizations in the CA parser, we get some bogus context here and have to
			// double check that an override proposal would be valid at this location
			// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=370955
			EObject prevModel = context.getPreviousModel();
			if (prevModel instanceof XExpression) {
				XtendMember containingMember = EcoreUtil2.getContainerOfType(prevModel, XtendMember.class);
				XBlockExpression blockExpression = EcoreUtil2.getContainerOfType(prevModel, XBlockExpression.class);
				if (blockExpression != null && blockExpression != prevModel) {
					if (EcoreUtil.isAncestor(containingMember, blockExpression)) { // still inside block
						return;
					}
				}
			}
			overrideAssist.createOverrideProposals((XtendTypeDeclaration) model, context, acceptor, getConflictHelper());
		}
	}
	super.completeType_Members(model, assignment, context, acceptor);
}
 
Example 19
protected boolean shouldRender(IRenderingSession<Element> context, Element source, Element destination) {
    boolean isModelLibrary = MDDUtil.getRootPackage(destination.getNearestPackage()).isModelLibrary();
    boolean showModelLibraries = context.getSettings().getBoolean(SHOW_ELEMENTS_IN_LIBRARIES);
    if (isModelLibrary && !showModelLibraries)
        return false;

    ShowCrossPackageElementOptions crossPackageElementOption = context.getSettings().getSelection(
            ShowCrossPackageElementOptions.class);
    switch (crossPackageElementOption) {
    case Never:
        return EcoreUtil.equals(source.getNearestPackage(), destination.getNearestPackage());
    case Immediate:
        return EcoreUtil.isAncestor(context.getRoot(), source);
    case Always:
        return true;
    case Local:
        return ElementUtils.sameRepository(context.getRoot(), destination);
    }
    // should never run
    return false;
}
 
Example 20
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setBrickd(MBrickd newBrickd) {
    if (newBrickd != eInternalContainer()
            || (eContainerFeatureID() != ModelPackage.MBRICKLET_LCD2_0X4__BRICKD && newBrickd != null)) {
        if (EcoreUtil.isAncestor(this, newBrickd))
            throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
        NotificationChain msgs = null;
        if (eInternalContainer() != null)
            msgs = eBasicRemoveFromContainer(msgs);
        if (newBrickd != null)
            msgs = ((InternalEObject) newBrickd).eInverseAdd(this, ModelPackage.MBRICKD__MDEVICES, MBrickd.class,
                    msgs);
        msgs = basicSetBrickd(newBrickd, msgs);
        if (msgs != null)
            msgs.dispatch();
    } else if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_LCD2_0X4__BRICKD, newBrickd,
                newBrickd));
}