blob: f0239e76e3a6d8d5144f74d11d4f5db7ffaf70d8 [file] [log] [blame]
package org.eclipse.epf.library.realization.impl;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.epf.library.configuration.ConfigurationHelper;
import org.eclipse.epf.library.edit.realization.IRealizedDescriptor;
import org.eclipse.epf.library.edit.realization.IRealizedElement;
import org.eclipse.epf.uma.Descriptor;
import org.eclipse.epf.uma.MethodElement;
import org.eclipse.epf.uma.UmaPackage;
import org.eclipse.epf.uma.ecore.util.OppositeFeature;
public class RealizedDescriptor extends RealizedElement implements
IRealizedDescriptor, IRealizedElement {
private static Set<EStructuralFeature> featureSet = new HashSet<EStructuralFeature>();
static {
UmaPackage up = UmaPackage.eINSTANCE;
featureSet.add(up.getNamedElement_Name());
featureSet.add(up.getMethodElement_PresentationName());
}
public RealizedDescriptor(Descriptor descriptor) {
super(descriptor);
}
public boolean handleFeature(EStructuralFeature feature) {
return featureSet.contains(feature);
}
public Object getFeatureValue(EStructuralFeature feature) {
if (! featureSet.contains(feature)) {
return null;
}
MethodElement linkedElement = getLinkedElement();
if (feature instanceof EAttribute) {
MethodElement elementUsed = linkedElement == null ? getDescriptor() : linkedElement;
Object value = ConfigurationHelper.calcAttributeFeatureValue(elementUsed, feature, getConfig());
return value;
}
return super.getFeatureValue(feature);
}
public Object getOFeatureValue(OppositeFeature ofeature) {
return super.getOFeatureValue(ofeature);
}
protected MethodElement getLinkedElement() {
throw new UnsupportedOperationException();
}
protected Descriptor getDescriptor() {
return (Descriptor) getElement();
}
}