Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314089 - Cannot add implementation to component EClass
Summary: Cannot add implementation to component EClass
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sca (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-24 06:02 EDT by Eneko Fernandez CLA
Modified: 2017-03-30 14:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eneko Fernandez CLA 2010-05-24 06:02:07 EDT
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
Comment 1 Stephane Drapeau CLA 2010-05-25 03:36:09 EDT
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.
Comment 2 Eneko Fernandez CLA 2010-05-31 02:52:54 EDT
Thanks for the answer. I could manage as you said.

Best