use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class AbstractJavaGeneratorTest method createGeneratorEntry.
private GeneratorEntry createGeneratorEntry(String targetProject, String targetFolder) {
GeneratorEntry entry = SGenFactory.eINSTANCE.createGeneratorEntry();
entry.setContentType(CONTENT_TYPE);
FeatureConfiguration config = SGenFactory.eINSTANCE.createFeatureConfiguration();
FeatureType type = SGenFactory.eINSTANCE.createFeatureType();
type.setName(OUTLET_FEATURE);
config.setType(type);
FeatureParameterValue project = SGenFactory.eINSTANCE.createFeatureParameterValue();
FeatureParameter projectParameter = SGenFactory.eINSTANCE.createFeatureParameter();
projectParameter.setName(TARGET_PROJECT);
project.setParameter(projectParameter);
project.setValue(targetProject);
config.getParameterValues().add(project);
FeatureParameterValue targetFolderValue = SGenFactory.eINSTANCE.createFeatureParameterValue();
FeatureParameter targetParameter = SGenFactory.eINSTANCE.createFeatureParameter();
targetParameter.setName(TARGET_FOLDER);
targetFolderValue.setParameter(targetParameter);
targetFolderValue.setValue(targetFolder);
config.getParameterValues().add(targetFolderValue);
entry.getFeatures().add(config);
return entry;
}
use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class SGenJavaValidator method checkDuplicateFeatureParameter.
@Check
public void checkDuplicateFeatureParameter(final FeatureParameterValue value) {
FeatureConfiguration entry = (FeatureConfiguration) value.eContainer();
Iterable<FeatureParameterValue> filter = Iterables.filter(entry.getParameterValues(), new Predicate<FeatureParameterValue>() {
public boolean apply(FeatureParameterValue input) {
return (input.getParameter().getName().equals(value.getParameter().getName()));
}
});
if (Iterables.size(filter) > 1) {
error(DUPLICATE_PARAMETER, SGenPackage.Literals.FEATURE_PARAMETER_VALUE__PARAMETER);
}
}
use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class SGenJavaValidator method checkDuplicateGeneratorEntryFeature.
@Check
public void checkDuplicateGeneratorEntryFeature(final FeatureConfiguration config) {
GeneratorEntry entry = (GeneratorEntry) config.eContainer();
Iterable<FeatureConfiguration> filter = Iterables.filter(entry.getFeatures(), new Predicate<FeatureConfiguration>() {
public boolean apply(FeatureConfiguration input) {
return (input.getType().getName().equals(config.getType().getName()));
}
});
if (Iterables.size(filter) > 1) {
error(DUPLICATE_FEATURE, SGenPackage.Literals.FEATURE_CONFIGURATION__TYPE);
}
}
use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class WorkspaceGeneratorExecutor method getLookupRoot.
protected IProject getLookupRoot(GeneratorEntry entry) {
IProject project = null;
FeatureConfiguration templateConfig = entry.getFeatureConfiguration(TEMPLATE_FEATURE);
FeatureParameterValue projectName = templateConfig.getParameterValue(GENERATOR_PROJECT);
if (projectName != null) {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName.getStringValue());
} else {
URI uri = entry.getElementRef().eResource().getURI();
project = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true))).getProject();
}
return project;
}
use of org.yakindu.sct.model.sgen.FeatureConfiguration in project statecharts by Yakindu.
the class ModelCreator method createGeneratorEntry.
private GeneratorEntry createGeneratorEntry(EObject eobject) {
GeneratorEntry entry = factory.createGeneratorEntry();
entry.setContentType(descriptor.getContentType());
entry.setElementRef(eobject);
List<FeatureType> featureTypes = getFeatureTypes(descriptor);
for (FeatureType featureType : featureTypes) {
FeatureConfiguration config = createFeatureConfiguration(eobject, featureType);
if (config != null && !config.getParameterValues().isEmpty()) {
entry.getFeatures().add(config);
}
}
return entry;
}
Aggregations