use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class AbstractDefaultFeatureValueProvider method createDefaultFeatureConfiguration.
public final FeatureConfiguration createDefaultFeatureConfiguration(FeatureType type, EObject contextElement) {
FeatureConfiguration config = createConfiguration(type);
EList<FeatureParameter> parameters = type.getParameters();
for (FeatureParameter parameter : parameters) {
FeatureParameterValue parameterValue = createParameterValue(type, parameter, contextElement);
if (parameterValue != null && parameterValue.getExpression() != null) {
config.getParameterValues().add(parameterValue);
}
}
return config;
}
use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class HelpIntegrationTest method checkDocumentedFeaturesExist.
@Test
public void checkDocumentedFeaturesExist() {
List<String> features = getDocumentedFeatures();
ArrayList<String> generators = new ArrayList<String>(Arrays.asList(YAKINDU_JAVA, YAKINDU_C, YAKINDU_CPP, YAKINDU_GENERIC));
for (String generator : generators) {
Iterable<IEObjectDescription> allElements = getAllElements(generator);
for (IEObjectDescription desc : allElements) {
if (desc.getEClass() != SGenPackage.Literals.FEATURE_TYPE)
continue;
EObject o = desc.getEObjectOrProxy();
String name = null;
if (o instanceof FeatureConfiguration) {
FeatureType type = ((FeatureConfiguration) o).getType();
if (type != null) {
name = type.getName();
}
} else if (o instanceof FeatureType) {
FeatureType type = (FeatureType) o;
if (type != null) {
name = type.getName();
}
} else if (o instanceof FeatureParameter) {
FeatureType type = ((FeatureParameter) o).getFeatureType();
if (type != null) {
name = type.getName();
}
}
if (name != null)
name = name.toLowerCase();
if (name != null && features.contains(name)) {
features.remove(name);
}
}
}
if (features.size() > 0) {
fail("There are documented features that are not implemented: " + Arrays.toString(features.toArray()));
}
}
use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class FeatureConfigurationItemProvider method getText.
/**
* This returns the label text for the adapted class. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public String getText(Object object) {
FeatureConfiguration configuration = ((FeatureConfiguration) object);
FeatureType type = configuration.getType();
if (type != null) {
return type.getName() + " feature";
}
return "";
}
use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class SGenJavaValidator method checkDeprecatedFeatures.
@Check
public void checkDeprecatedFeatures(GeneratorEntry entry) {
Iterable<FeatureConfiguration> features = entry.getFeatures();
Iterable<FeatureType> deprecatedFeatures = filter(transform(features, getFeatureType()), isDeprecated());
for (FeatureType feature : deprecatedFeatures) {
warning(String.format(DEPRECATED + " %s : %s", feature.getName(), feature.getComment()), SGenPackage.Literals.GENERATOR_ENTRY__ELEMENT_REF, feature.getName());
}
}
use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class SGenJavaValidator method checkRequiredFeatures.
@Check
public void checkRequiredFeatures(GeneratorEntry entry) {
GeneratorModel model = (GeneratorModel) EcoreUtil2.getRootContainer(entry);
IGeneratorDescriptor generatorDescriptor = GeneratorExtensions.getGeneratorDescriptor(model.getGeneratorId());
Iterable<ILibraryDescriptor> libraryDescriptors = LibraryExtensions.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
Iterable<FeatureType> requiredFeatures = filter(concat(transform(transform(libraryDescriptors, getFeatureTypeLibrary()), getFeatureTypes())), isRequired());
List<String> configuredTypes = Lists.newArrayList();
for (FeatureConfiguration featureConfiguration : entry.getFeatures()) {
configuredTypes.add(featureConfiguration.getType().getName());
}
for (FeatureType featureType : requiredFeatures) {
if (!configuredTypes.contains(featureType.getName()))
error(String.format(MISSING_REQUIRED_FEATURE + " %s", featureType.getName()), SGenPackage.Literals.GENERATOR_ENTRY__ELEMENT_REF, CODE_REQUIRED_FEATURE, featureType.getName());
}
}
Aggregations