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
Source File: RemoteSwitchAImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 2
Source File: MBrickletLCD20x4Impl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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)); }
Example 3
Source File: AbstractRelationshipRenderer.java From textuml with Eclipse Public License 1.0 | 6 votes |
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 4
Source File: XtendProposalProvider.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@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 5
Source File: TemplateImpl.java From M2Doc with Eclipse Public License 1.0 | 6 votes |
/** * <!-- 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 6
Source File: PTCConnectedImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 7
Source File: ComposedContentImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- 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 8
Source File: DimensionImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * <!-- 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 9
Source File: BusinessRelationshipImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * <!-- 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 10
Source File: JoystickXPositionImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 11
Source File: MBrickletAmbientLightV2Impl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 12
Source File: MBrickServoImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 13
Source File: PhysicalPrimaryKeyImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * <!-- 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 14
Source File: MBrickletDistanceUSImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 15
Source File: ColorLedImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 16
Source File: MServoImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 17
Source File: ConditionalExpressionImpl.java From ifml-editor with MIT License | 6 votes |
/** * <!-- 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 18
Source File: MultiTouchDeviceImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 19
Source File: LoadCellWeightImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- 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 20
Source File: VirtualCubeImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * <!-- 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)); }