org.eclipse.emf.ecore.util.EcoreUtil Java Examples
The following examples show how to use
org.eclipse.emf.ecore.util.EcoreUtil.
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: CreateFormFromContractOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(Messages.creatingNewForm, IProgressMonitor.UNKNOWN); try { setArtifactName(getNewName()); URL url = pageDesignerURLBuilder.newPageFromContract(formScope, artifactName); Pool parentPool = new ModelSearch(Collections::emptyList).getDirectParentOfType(contract, Pool.class); BusinessDataStore businessDataStore = new BusinessDataStore(parentPool, getRepositoryAccessor()); ContractToBusinessDataResolver contractToBusinessDataResolver = new ContractToBusinessDataResolver( businessDataStore); Contract tmpContract = EcoreUtil.copy(contract); // will contains unwanted contractInput for readOnly attributes openReadOnlyAttributeDialog(tmpContract, businessDataStore); TreeResult treeResult = contractToBusinessDataResolver.resolve(tmpContract, buildReadOnlyAttributes); Representation body = new JacksonRepresentation<>(new ToWebContract(treeResult).apply(tmpContract)); responseObject = createArtifact(url, body); } catch (MalformedURLException e) { throw new InvocationTargetException(e, "Failed to create new form url."); } }
Example #2
Source File: MDualRelayImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void setMbrick(MDualRelayBricklet newMbrick) { if (newMbrick != eInternalContainer() || (eContainerFeatureID() != ModelPackage.MDUAL_RELAY__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.MDUAL_RELAY__MBRICK, newMbrick, newMbrick)); }
Example #3
Source File: VCDeviceVoltageImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void setMbrick(MBrickletVoltageCurrent newMbrick) { if (newMbrick != eInternalContainer() || (eContainerFeatureID() != ModelPackage.VC_DEVICE_VOLTAGE__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.VC_DEVICE_VOLTAGE__MBRICK, newMbrick, newMbrick)); }
Example #4
Source File: MBrickletMultiTouchImpl.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_MULTI_TOUCH__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_MULTI_TOUCH__BRICKD, newBrickd, newBrickd)); }
Example #5
Source File: DataSourceAdapter.java From birt with Eclipse Public License 1.0 | 6 votes |
public boolean isDataSourceHandleAndDataSourceDesignEqual( OdaDataSourceHandle sourceHandle, DataSourceDesign sourceDesign ) { EqualityHelper equalityHelper = new EcoreUtil.EqualityHelper( ); // compare public properties Properties sourceHandlePublicProperties = newOdaPublicProperties( sourceHandle.getExtensionPropertyDefinitionList( ), sourceHandle ); if ( !equalityHelper.equals( sourceHandlePublicProperties, sourceDesign.getPublicProperties( ) ) ) { return false; } // compare private properties Properties sourceHandlePrivateProperties = newOdaPrivateProperties( sourceHandle.privateDriverPropertiesIterator( ) ); return equalityHelper.equals( sourceHandlePrivateProperties, sourceDesign.getPrivateProperties( ) ); }
Example #6
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 #7
Source File: JvmMemberImpl.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setDeclaringType(JvmDeclaredType newDeclaringType) { if (newDeclaringType != eInternalContainer() || (eContainerFeatureID() != TypesPackage.JVM_MEMBER__DECLARING_TYPE && newDeclaringType != null)) { if (EcoreUtil.isAncestor(this, newDeclaringType)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newDeclaringType != null) msgs = ((InternalEObject)newDeclaringType).eInverseAdd(this, TypesPackage.JVM_DECLARED_TYPE__MEMBERS, JvmDeclaredType.class, msgs); msgs = basicSetDeclaringType(newDeclaringType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_MEMBER__DECLARING_TYPE, newDeclaringType, newDeclaringType)); }
Example #8
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 #9
Source File: MBrickletIndustrialDual020mAImpl.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_INDUSTRIAL_DUAL020M_A__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_INDUSTRIAL_DUAL020M_A__BRICKD, newBrickd, newBrickd)); }
Example #10
Source File: LaserRangeFinderDistanceImpl.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void setMbrick(MBrickletLaserRangeFinder newMbrick) { if (newMbrick != eInternalContainer() || (eContainerFeatureID() != ModelPackage.LASER_RANGE_FINDER_DISTANCE__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.LASER_RANGE_FINDER_DISTANCE__MBRICK, newMbrick, newMbrick)); }
Example #11
Source File: PhysicalColumnImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void setTable(PhysicalTable newTable) { if (newTable != eInternalContainer() || (eContainerFeatureID() != PhysicalModelPackage.PHYSICAL_COLUMN__TABLE && newTable != null)) { if (EcoreUtil.isAncestor(this, newTable)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newTable != null) msgs = ((InternalEObject) newTable).eInverseAdd(this, PhysicalModelPackage.PHYSICAL_TABLE__COLUMNS, PhysicalTable.class, msgs); msgs = basicSetTable(newTable, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PhysicalModelPackage.PHYSICAL_COLUMN__TABLE, newTable, newTable)); }
Example #12
Source File: PackratParserGenUtil.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
public static Keyword findFirstKeywordWithSameConflicts(final Keyword element, final Grammar grammar) { final List<AbstractRule> conflicting = getConflictingLexerRules(element, grammar); Keyword result = element; Iterator<Keyword> iterator = Iterators.filter( Iterators.filter(EcoreUtil.getAllContents(grammar, true), Keyword.class), new Predicate<Keyword>() { @Override public boolean apply(Keyword param) { if (GrammarUtil.containingParserRule(param) == null) return false; final List<AbstractRule> otherConflicting = getConflictingLexerRules(param, grammar); return otherConflicting != null && otherConflicting.equals(conflicting); } }); if (iterator.hasNext()) result = iterator.next(); return result; }
Example #13
Source File: DiagramForElementRunnable.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void run() { final TreeIterator<EObject> allContents = resource.getAllContents(); EObject elementToFind = null; final Set<Diagram> diagrams = new HashSet<Diagram>(); while (allContents.hasNext()) { final EObject eObject = allContents.next(); if (EcoreUtil.equals(eObject, element)) { elementToFind = eObject; } if (eObject instanceof Diagram) { diagrams.add((Diagram) eObject); } } if (elementToFind == null) { return; } for (final Diagram diagram : diagrams) { final EObject diagramElement = diagram.getElement(); if (diagramElement != null && diagramElement.equals(elementToFind)) { result = diagram; break; } } }
Example #14
Source File: GConnectorImpl.java From graph-editor with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setParent(GConnectable newParent) { if (newParent != eInternalContainer() || (eContainerFeatureID() != GraphPackage.GCONNECTOR__PARENT && newParent != null)) { if (EcoreUtil.isAncestor(this, newParent)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newParent != null) msgs = ((InternalEObject)newParent).eInverseAdd(this, GraphPackage.GCONNECTABLE__CONNECTORS, GConnectable.class, msgs); msgs = basicSetParent(newParent, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.GCONNECTOR__PARENT, newParent, newParent)); }
Example #15
Source File: DefaultResourceDescriptionDeltaTest.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Test public void testHasChanges_DifferentTypes() throws Exception { TestResDesc resourceDesc = new TestResDesc(); resourceDesc.imported.add(FOO); resourceDesc.exported.add(EObjectDescription.create(BAR, EcorePackage.Literals.EANNOTATION, Collections.singletonMap("foo", "bar"))); TestResDesc resourceDesc2 = new TestResDesc(); resourceDesc2.imported.add(FOO); resourceDesc2.exported.add(new EObjectDescription(BAR, EcorePackage.Literals.EANNOTATION__CONTENTS, Collections.singletonMap("foo", "bar")){ @Override public URI getEObjectURI() { return EcoreUtil.getURI(EcorePackage.Literals.EANNOTATION); } } ); assertTrue(new DefaultResourceDescriptionDelta(resourceDesc, resourceDesc2).haveEObjectDescriptionsChanged()); }
Example #16
Source File: DefaultResourceDescription.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Override protected List<IEObjectDescription> computeExportedObjects() { if (!getResource().isLoaded()) { try { getResource().load(null); } catch (IOException e) { log.error(e.getMessage(), e); return Collections.<IEObjectDescription> emptyList(); } } final List<IEObjectDescription> exportedEObjects = newArrayList(); IAcceptor<IEObjectDescription> acceptor = new IAcceptor<IEObjectDescription>() { @Override public void accept(IEObjectDescription eObjectDescription) { exportedEObjects.add(eObjectDescription); } }; TreeIterator<EObject> allProperContents = EcoreUtil.getAllProperContents(getResource(), false); while (allProperContents.hasNext()) { EObject content = allProperContents.next(); if (!strategy.createEObjectDescriptions(content, acceptor)) allProperContents.prune(); } return exportedEObjects; }
Example #17
Source File: LinePartImpl.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setLine(Line newLine) { if (newLine != eInternalContainer() || (eContainerFeatureID() != ProcessedRichStringPackage.LINE_PART__LINE && newLine != null)) { if (EcoreUtil.isAncestor(this, newLine)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newLine != null) msgs = ((InternalEObject)newLine).eInverseAdd(this, ProcessedRichStringPackage.LINE__PARTS, Line.class, msgs); msgs = basicSetLine(newLine, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ProcessedRichStringPackage.LINE_PART__LINE, newLine, newLine)); }
Example #18
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
protected void recomputeAndCheckIdentifiers(Resource resource) { Iterator<JvmMember> iter = Iterators.filter(EcoreUtil.getAllContents(resource, false), JvmMember.class); while (iter.hasNext()) { JvmMember member = iter.next(); String identifier = member.getIdentifier(); member.internalSetIdentifier(null); String computed = member.getIdentifier(); assertNotNull(String.valueOf(member), computed); assertEquals(identifier, computed); checkDeprecatedBitSet(member); } Iterator<JvmFormalParameter> params = Iterators.filter(EcoreUtil.getAllContents(resource, false), JvmFormalParameter.class); while (params.hasNext()) { JvmFormalParameter parameter = params.next(); assertNotNull(parameter.eContainer().toString(), parameter.getName()); } }
Example #19
Source File: UnexpectedProxiesException.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
public static List<URI> getURIs(EStructuralFeature.Setting setting) { Object it = setting.get(false); if (it instanceof EObject) { return ImmutableList.of(EcoreUtil.getURI(((EObject) it))); } if (it instanceof List) { List<URI> result = new ArrayList<>(); for (Object o : ((List<?>) it)) { if (o instanceof EObject) { result.add(EcoreUtil.getURI((EObject) o)); } } return result; } return null; }
Example #20
Source File: ExpressionHelperTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void should_createExpressionFromEObject_Returns_a_ContractInputExpression_of_type_FileInputValue_if_EObject_is_a_FILE_ContractInput() throws Exception { final ContractInput input = ProcessFactory.eINSTANCE.createContractInput(); input.setName("inputName"); input.setType(ContractInputType.FILE); final Expression expression = ExpressionHelper.createExpressionFromEObject(input); assertThat(expression).hasContent(input.getName()). hasInterpreter(""). hasType(ExpressionConstants.CONTRACT_INPUT_TYPE). hasName(input.getName()). hasReturnType(FileInputValue.class.getName()); assertThat(expression.getReferencedElements()).hasSize(1); final EObject refElement = expression.getReferencedElements().get(0); assertThat(EcoreUtil.equals(input, refElement)).isTrue(); }
Example #21
Source File: ModelResourceImpl.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public void setModel(Model newModel) { if (newModel != eInternalContainer() || eContainerFeatureID() != MigrationPackage.MODEL_RESOURCE__MODEL && newModel != null) { if (EcoreUtil.isAncestor(this, (EObject) newModel)) { throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$ } NotificationChain msgs = null; if (eInternalContainer() != null) { msgs = eBasicRemoveFromContainer(msgs); } if (newModel != null) { msgs = ((InternalEObject) newModel).eInverseAdd(this, MigrationPackage.MODEL__RESOURCES, Model.class, msgs); } msgs = basicSetModel(newModel, msgs); if (msgs != null) { msgs.dispatch(); } } else if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, MigrationPackage.MODEL_RESOURCE__MODEL, newModel, newModel)); } }
Example #22
Source File: EMFTreeComposite.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * This operation performs a deep copy of the attributes of another * EMFTreeComposite into the current EMFTreeComposite. It copies ALL of the * children of the EMFTreeComposite, data and child nodes alike. * * @param otherTreeComposite */ public void copy(EMFTreeComposite otherTreeComposite) { // If null, return if (otherTreeComposite == null) { return; } if (otherTreeComposite.ecoreNodeMetaData != null) { ecoreNodeMetaData = otherTreeComposite.ecoreNodeMetaData; ecoreNode = EcoreUtil.create(ecoreNodeMetaData); } super.copy(otherTreeComposite, true); return; }
Example #23
Source File: SerializerTester.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected List<Pair<EObject, ICompositeNode>> detachNodeModel(EObject eObject) { EcoreUtil.resolveAll(eObject); List<Pair<EObject, ICompositeNode>> result = Lists.newArrayList(); Iterator<Object> iterator = EcoreUtil.getAllContents(eObject.eResource(), false); while (iterator.hasNext()) { EObject object = (EObject) iterator.next(); Iterator<Adapter> adapters = object.eAdapters().iterator(); while (adapters.hasNext()) { Adapter adapter = adapters.next(); if (adapter instanceof ICompositeNode) { adapters.remove(); result.add(Tuples.create(object, (ICompositeNode) adapter)); break; } } } return result; }
Example #24
Source File: MBrickletTiltImpl.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_TILT__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_TILT__BRICKD, newBrickd, newBrickd)); }
Example #25
Source File: DaveDriverImpl.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * @generated NOT */ @Override public Profile getProfile () { if ( this.profile == null ) { final ResourceSet rs = new ResourceSetImpl (); final Resource r = rs.createResource ( URI.createURI ( DEFAULT_URI ), "org.eclipse.scada.configuration.world.osgi.profile" ); try { r.load ( null ); } catch ( final IOException e ) { throw new RuntimeException ( e ); } this.profile = (Profile)EcoreUtil.getObjectByType ( r.getContents (), ProfilePackage.Literals.PROFILE ); if ( this.profile == null ) { throw new IllegalStateException ( String.format ( "Resource loaded from %s does not contain an object of type %s", DEFAULT_URI, Profile.class.getName () ) ); } } return this.profile; }
Example #26
Source File: AbstractProcessorBasedRenameParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected List<? extends IRenameElementContext> createRenameElementContexts(Object element) { if (element instanceof IRenameElementContext) { IRenameElementContext triggeringContext = (IRenameElementContext) element; IProject project = projectUtil.getProject(triggeringContext.getTargetElementURI()); if (project != null) { ResourceSet resourceSet = resourceSetProvider.get(project); EObject originalTarget = resourceSet.getEObject(triggeringContext.getTargetElementURI(), true); List<EObject> renamedElements = getRenamedElementsOrProxies(originalTarget); if (renamedElements == null || renamedElements.isEmpty()) return null; List<IRenameElementContext> contexts = newArrayListWithCapacity(renamedElements.size()); for (EObject renamedElement : renamedElements) contexts.add(new IRenameElementContext.Impl(EcoreUtil.getURI(renamedElement), renamedElement .eClass(), triggeringContext.getTriggeringEditor(), triggeringContext .getTriggeringEditorSelection(), triggeringContext.getContextResourceURI())); return contexts; } } return null; }
Example #27
Source File: TypeResource.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Override public EObject resolveJavaObjectURIProxy(InternalEObject proxy, EObject sender) { final URI proxyURI = proxy.eProxyURI(); if (proxyURI != null && URIHelperConstants.PROTOCOL.equals(proxyURI.scheme())) { if ("Objects".equals(proxyURI.segment(0))) { if (indexedJvmTypeAccess != null) { try { EObject result = indexedJvmTypeAccess.getIndexedJvmType(proxy.eProxyURI(), getResourceSet()); if (result != null) { return result; } } catch(UnknownNestedTypeException e) { return proxy; } } return EcoreUtil.resolve(proxy, sender); } } return null; }
Example #28
Source File: RouterPropertiesEditionComponent.java From eip-designer with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} * @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification) */ public void updatePart(Notification msg) { super.updatePart(msg); if (editingPart.isVisible()) { RouterPropertiesEditionPart basePart = (RouterPropertiesEditionPart)editingPart; if (EipPackage.eINSTANCE.getEndpoint_Name().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && basePart != null && isAccessible(EipViewsRepository.Router.Properties.name)) { if (msg.getNewValue() != null) { basePart.setName(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, msg.getNewValue())); } else { basePart.setName(""); } } if (EipPackage.eINSTANCE.getEndpoint_ToChannels().equals(msg.getFeature()) && isAccessible(EipViewsRepository.Router.Properties.toChannels)) basePart.updateToChannels(); if (EipPackage.eINSTANCE.getEndpoint_FromChannels().equals(msg.getFeature()) && isAccessible(EipViewsRepository.Router.Properties.fromChannels)) basePart.updateFromChannels(); if (EipPackage.eINSTANCE.getRouter_OwnedRoutes().equals(msg.getFeature()) && isAccessible(EipViewsRepository.Router.Properties.ownedRoutes)) basePart.updateOwnedRoutes(); if (EipPackage.eINSTANCE.getRouter_Type().equals(msg.getFeature()) && msg.getNotifier().equals(semanticObject) && isAccessible(EipViewsRepository.Router.Properties.type)) basePart.setType((RoutingType)msg.getNewValue()); } }
Example #29
Source File: ColorColorImpl.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_COLOR__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_COLOR__MBRICK, newMbrick, newMbrick)); }
Example #30
Source File: RemoteSwitchCImpl.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_C__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_C__MBRICK, newMbrick, newMbrick)); }