Community
Participate
Working Groups
sca.ecore sets component´s attribute implementation as not changeable. This makes impossible to deal with new components creation through dyanmic emf. Error example: Component component = ScaFactory.eINSTANCE.createComponent(); composite.getComponent().add(component); component.setName(componentName); // Create component´s implementation JavaImplementation implementation = ScaFactory.eINSTANCE.createJavaImplementation(); implementation.setClass(compositeName + "." + componentName); component.eSet(ScaPackage.Literals.COMPONENT__IMPLEMENTATION, implementation); Returns: java.lang.IllegalArgumentException: The feature 'implementation' is not a valid changeable feature at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1093) I guess that there is an error in ecor´s file and implementation EAttribute should be changeable = true
Hi Eneko, It's not an error. To modify the implementation, you must use the feature "implementation group": JavaImplementation newValue = ScaFactory.eINSTANCE.createJavaImplementation(); ((FeatureMap.Internal) component.getImplementationGroup()).clear(); ((FeatureMap.Internal) component.getImplementationGroup()).add( ScaPackage.Literals.COMPONENT__IMPLEMENTATION_GROUP,FeatureMapUtil.createEntry( ScaPackage.Literals.DOCUMENT_ROOT__IMPLEMENTATION_JAVA, newValue)); It's the same way of doing to add an interface or a binding.
Thanks for the answer. I could manage as you said. Best