use of org.yakindu.sct.model.sgen.FeatureType 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.FeatureType in project statecharts by Yakindu.
the class SGenTemplateProposalProvider method createFeatureConfigurationTemplates.
private void createFeatureConfigurationTemplates(TemplateContext templateContext, ContentAssistContext context, ITemplateAcceptor acceptor) {
GeneratorModel model = (GeneratorModel) EcoreUtil2.getRootContainer(context.getCurrentModel());
IGeneratorDescriptor generatorDescriptor = GeneratorExtensions.getGeneratorDescriptor(model.getGeneratorId());
Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
for (ILibraryDescriptor desc : libraryDescriptor) {
ResourceSet set = new ResourceSetImpl();
Resource resource = set.getResource(desc.getURI(), true);
FeatureTypeLibrary lib = (FeatureTypeLibrary) resource.getContents().get(0);
EList<FeatureType> types = lib.getTypes();
for (FeatureType featureType : types) {
Template template = new Template(featureType.getName() + " feature", "Creates feature " + featureType.getName(), featureType.getName(), creator.createProposal(featureType, desc.createFeatureValueProvider(SGenActivator.getInstance().getInjector(SGenActivator.ORG_YAKINDU_SCT_GENERATOR_GENMODEL_SGEN)), context.getCurrentModel()), false);
TemplateProposal proposal = createProposal(template, templateContext, context, getImage(template), getRelevance(template));
acceptor.accept(proposal);
}
}
}
use of org.yakindu.sct.model.sgen.FeatureType 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;
}
use of org.yakindu.sct.model.sgen.FeatureType in project statecharts by Yakindu.
the class FeatureConfigurationImpl method setType.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setType(FeatureType newType) {
FeatureType oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SGenPackage.FEATURE_CONFIGURATION__TYPE, oldType, type));
}
use of org.yakindu.sct.model.sgen.FeatureType 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()));
}
}
Aggregations