Search in sources :

Example 6 with FeatureParameterValue

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

the class CoreLibraryDefaultFeatureValueProvider method validateParameterValue.

public IStatus validateParameterValue(FeatureParameterValue parameterValue) {
    String parameterName = parameterValue.getParameter().getName();
    if (OUTLET_FEATURE_TARGET_PROJECT.equals(parameterName) && !access.projectExists(parameterValue.getStringValue()))
        return error(String.format("The Project %s does not exist.", parameterValue.getStringValue()));
    if (OUTLET_FEATURE_TARGET_PROJECT.equals(parameterName) && access.projectExists(parameterValue.getStringValue()) && !access.projectOpened(parameterValue.getStringValue()))
        return error(String.format("The Project %s is not open.", parameterValue.getStringValue()));
    if (OUTLET_FEATURE_TARGET_FOLDER.equals(parameterName) || OUTLET_FEATURE_LIBRARY_TARGET_FOLDER.equals(parameterName) || OUTLET_FEATURE_API_TARGET_FOLDER.equals(parameterName)) {
        FeatureParameterValue targetProjectParam = parameterValue.getFeatureConfiguration().getParameterValue(OUTLET_FEATURE_TARGET_PROJECT);
        String targetProjectName = targetProjectParam != null ? targetProjectParam.getStringValue() : null;
        if (targetProjectName != null && !access.folderExists(targetProjectName, parameterValue.getStringValue())) {
            return warning(String.format("The Folder %s does not exist in Project %s", parameterValue.getStringValue(), targetProjectName));
        }
    }
    return Status.OK_STATUS;
}
Also used : FeatureParameterValue(org.yakindu.sct.model.sgen.FeatureParameterValue)

Example 7 with FeatureParameterValue

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

the class CppCodeGeneratorModule method bindIGenArtifactConfigurations.

protected void bindIGenArtifactConfigurations(GeneratorEntry entry, Binder binder) {
    FeatureParameterValue useRelativePathParam = entry.getFeatureParameterValue(FEATURE_INCLUDES, PARAMETER_INCLUDES_USE_RELATIVE_PATHS);
    boolean useRelativePath = useRelativePathParam != null ? useRelativePathParam.getBooleanValue() : true;
    if (useRelativePath) {
        binder.bind(IGenArtifactConfigurations.class).to(DefaultGenArtifactConfigurations.class);
    } else {
        binder.bind(IGenArtifactConfigurations.class).to(SimpleGenArtifactConfigurations.class);
    }
}
Also used : FeatureParameterValue(org.yakindu.sct.model.sgen.FeatureParameterValue) IGenArtifactConfigurations(org.yakindu.sct.generator.c.IGenArtifactConfigurations)

Example 8 with FeatureParameterValue

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

the class CCodeGeneratorModule method bindTracingProperty.

protected void bindTracingProperty(GeneratorEntry entry, Binder binder) {
    FeatureParameterValue traceEnterFeature = entry.getFeatureParameterValue(FEATURE_TRACING, PARAMETER_TRACING_ENTER_STATE);
    FeatureParameterValue traceExitFeature = entry.getFeatureParameterValue(FEATURE_TRACING, PARAMETER_TRACING_EXIT_STATE);
    boolean traceEnter = traceEnterFeature != null ? traceEnterFeature.getBooleanValue() : false;
    boolean traceExit = traceExitFeature != null ? traceEnterFeature.getBooleanValue() : false;
    binder.bind(Boolean.class).annotatedWith(Names.named(ADD_TRACES)).toInstance(traceEnter || traceExit);
}
Also used : FeatureParameterValue(org.yakindu.sct.model.sgen.FeatureParameterValue)

Example 9 with FeatureParameterValue

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

the class CCodeGeneratorModule method bindIGenArtifactConfigurations.

protected void bindIGenArtifactConfigurations(GeneratorEntry entry, Binder binder) {
    FeatureParameterValue useRelativePathParam = entry.getFeatureParameterValue(FEATURE_INCLUDES, PARAMETER_INCLUDES_USE_RELATIVE_PATHS);
    boolean useRelativePath = useRelativePathParam != null ? useRelativePathParam.getBooleanValue() : true;
    if (useRelativePath) {
        binder.bind(IGenArtifactConfigurations.class).to(DefaultGenArtifactConfigurations.class);
    } else {
        binder.bind(IGenArtifactConfigurations.class).to(SimpleGenArtifactConfigurations.class);
    }
}
Also used : FeatureParameterValue(org.yakindu.sct.model.sgen.FeatureParameterValue)

Example 10 with FeatureParameterValue

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

the class DefaultFileSystemAccessFactory method initLibraryTargetFolder.

protected void initLibraryTargetFolder(ISCTFileSystemAccess access, GeneratorEntry entry) {
    FeatureParameterValue libraryTargetFolderValue = helper.getLibraryTargetFolderValue(entry);
    if (libraryTargetFolderValue != null) {
        access.setOutputPath(LIBRARY_TARGET_FOLDER_OUTPUT, libraryTargetFolderValue.getStringValue());
        OutputConfiguration output = access.getOutputConfigurations().get(LIBRARY_TARGET_FOLDER_OUTPUT);
        output.setCreateOutputDirectory(true);
        output.setCanClearOutputDirectory(false);
        output.setOverrideExistingResources(false);
    }
}
Also used : FeatureParameterValue(org.yakindu.sct.model.sgen.FeatureParameterValue) OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration)

Aggregations

FeatureParameterValue (org.yakindu.sct.model.sgen.FeatureParameterValue)12 FeatureConfiguration (org.yakindu.sct.model.sgen.FeatureConfiguration)4 OutputConfiguration (org.eclipse.xtext.generator.OutputConfiguration)2 Check (org.eclipse.xtext.validation.Check)2 FeatureParameter (org.yakindu.sct.model.sgen.FeatureParameter)2 IProject (org.eclipse.core.resources.IProject)1 Path (org.eclipse.core.runtime.Path)1 URI (org.eclipse.emf.common.util.URI)1 IGenArtifactConfigurations (org.yakindu.sct.generator.c.IGenArtifactConfigurations)1 IGeneratorDescriptor (org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor)1 ILibraryDescriptor (org.yakindu.sct.generator.core.extensions.ILibraryDescriptor)1 FeatureType (org.yakindu.sct.model.sgen.FeatureType)1 GeneratorEntry (org.yakindu.sct.model.sgen.GeneratorEntry)1 GeneratorModel (org.yakindu.sct.model.sgen.GeneratorModel)1