Search in sources :

Example 1 with FeatureParameter

use of org.yakindu.sct.model.sgen.FeatureParameter 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;
}
Also used : FeatureType(org.yakindu.sct.model.sgen.FeatureType) GeneratorEntry(org.yakindu.sct.model.sgen.GeneratorEntry) FeatureParameterValue(org.yakindu.sct.model.sgen.FeatureParameterValue) FeatureConfiguration(org.yakindu.sct.model.sgen.FeatureConfiguration) FeatureParameter(org.yakindu.sct.model.sgen.FeatureParameter)

Example 2 with FeatureParameter

use of org.yakindu.sct.model.sgen.FeatureParameter in project statecharts by Yakindu.

the class FeatureResourceDescription method computeExportedObjects.

@Override
protected List<IEObjectDescription> computeExportedObjects() {
    Iterator<EObject> contents = resource.getAllContents();
    List<IEObjectDescription> result = Lists.newArrayList();
    while (contents.hasNext()) {
        EObject eObject = contents.next();
        QualifiedName qualifiedName = qualifiedNameProvider.apply(eObject);
        if (qualifiedName != null) {
            Map<String, String> userData = new HashMap<String, String>();
            if (eObject instanceof FeatureParameter) {
                userData.put(FEATURE_CONTAINER, getFqName(eObject));
            }
            result.add(new EObjectDescription(qualifiedName, eObject, userData));
        }
    }
    return result;
}
Also used : EObjectDescription(org.eclipse.xtext.resource.EObjectDescription) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) HashMap(java.util.HashMap) EObject(org.eclipse.emf.ecore.EObject) QualifiedName(org.eclipse.xtext.naming.QualifiedName) FeatureParameter(org.yakindu.sct.model.sgen.FeatureParameter) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Example 3 with FeatureParameter

use of org.yakindu.sct.model.sgen.FeatureParameter 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;
}
Also used : FeatureParameterValue(org.yakindu.sct.model.sgen.FeatureParameterValue) FeatureConfiguration(org.yakindu.sct.model.sgen.FeatureConfiguration) FeatureParameter(org.yakindu.sct.model.sgen.FeatureParameter)

Example 4 with FeatureParameter

use of org.yakindu.sct.model.sgen.FeatureParameter 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()));
    }
}
Also used : FeatureType(org.yakindu.sct.model.sgen.FeatureType) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) FeatureConfiguration(org.yakindu.sct.model.sgen.FeatureConfiguration) FeatureParameter(org.yakindu.sct.model.sgen.FeatureParameter) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 5 with FeatureParameter

use of org.yakindu.sct.model.sgen.FeatureParameter in project statecharts by Yakindu.

the class FeatureParameterValueImpl method setParameter.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void setParameter(FeatureParameter newParameter) {
    FeatureParameter oldParameter = parameter;
    parameter = newParameter;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, SGenPackage.FEATURE_PARAMETER_VALUE__PARAMETER, oldParameter, parameter));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) FeatureParameter(org.yakindu.sct.model.sgen.FeatureParameter)

Aggregations

FeatureParameter (org.yakindu.sct.model.sgen.FeatureParameter)5 FeatureConfiguration (org.yakindu.sct.model.sgen.FeatureConfiguration)3 EObject (org.eclipse.emf.ecore.EObject)2 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)2 FeatureParameterValue (org.yakindu.sct.model.sgen.FeatureParameterValue)2 FeatureType (org.yakindu.sct.model.sgen.FeatureType)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 QualifiedName (org.eclipse.xtext.naming.QualifiedName)1 EObjectDescription (org.eclipse.xtext.resource.EObjectDescription)1 Test (org.junit.Test)1 GeneratorEntry (org.yakindu.sct.model.sgen.GeneratorEntry)1