Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
#899 extracted workspace runner plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasmuelder committed Aug 12, 2016
1 parent 02b801c commit dd48684
Show file tree
Hide file tree
Showing 22 changed files with 185 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.yakindu.sct.domain.generic.modules.GenericSequencerModule;
import org.yakindu.sct.generator.c.features.ICFeatureConstants;
import org.yakindu.sct.generator.c.types.CTypeSystemAccess;
import org.yakindu.sct.generator.core.impl.GenericJavaBasedGenerator;
import org.yakindu.sct.generator.core.impl.AbstractSExecModelGenerator;
import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess;
import org.yakindu.sct.model.sexec.ExecutionFlow;
import org.yakindu.sct.model.sexec.naming.INamingService;
Expand All @@ -37,26 +37,26 @@
* @author axel terfloth
*
*/
public class CCodeGenerator extends GenericJavaBasedGenerator {
public class CCodeGenerator extends AbstractSExecModelGenerator {

public static String GENERATOR_ID = "yakindu::c";

@Inject
private CGenerator delegate;

@Inject
private IGenArtifactConfigurations artifactConfigs;

@Override
protected void prepareGenerator(GeneratorEntry entry) {
super.prepareGenerator(entry);
initGenArtifactConfigurations();
}

protected void initGenArtifactConfigurations() {
artifactConfigs.setFileSystemAccess(sctFsa);
}

@Override
public void runGenerator(Statechart statechart, GeneratorEntry entry) {
ExecutionFlow flow = createExecutionFlow(statechart, entry);
Expand All @@ -76,7 +76,7 @@ public void configure(Binder binder) {
binder.bind(GeneratorEntry.class).toInstance(entry);
binder.bind(INamingService.class).to(CNamingService.class);
binder.bind(ICodegenTypeSystemAccess.class).to(CTypeSystemAccess.class);

binder.bind(IGenArtifactConfigurations.class).to(GenArtifactConfigurations.class);
// default binding to ensure consistency of already used API
binder.bind(IGenArtifactConfigurations.class)
Expand Down
30 changes: 0 additions & 30 deletions plugins/org.yakindu.sct.generator.core/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,5 @@
defaultProvider="org.yakindu.sct.generator.core.library.impl.CoreLibraryDefaultFeatureValueProvider"
uri="platform:/plugin/org.yakindu.sct.generator.core/library/CoreFeatureTypeLibrary.xmi">
</FeatureLibrary>
<FeatureLibrary
library_id="org.yakindu.generator.core.features.generic"
defaultProvider="org.yakindu.sct.generator.core.library.impl.GenericJavaLibraryDefaultValueProvider"
uri="platform:/plugin/org.yakindu.sct.generator.core/library/GenericJavaFeatureTypeLibrary.xmi">
</FeatureLibrary>
</extension>
<extension
point="org.yakindu.sct.generator.core.generator">
<SCTGenerator
class="org.yakindu.sct.generator.core.impl.GenericJavaBasedGenerator"
contentType="statechart"
description="Generate Code using Xpand Templates"
elementRefType="org.yakindu.sct.model.sgraph.Statechart"
icon="icons/sct.png"
id="yakindu::generic"
name="Custom Xtend2/Java-based Generator">
<FeatureLibrary
library_id="org.yakindu.generator.core.features">
</FeatureLibrary>
<FeatureLibrary
library_id="org.yakindu.generator.core.features.generic">
</FeatureLibrary>
</SCTGenerator>
</extension>
<extension
point="org.yakindu.sct.generator.core.extensions">
<ExtensionGeneratorMapping
fileExtension="sct"
generatorId="yakindu::generic">
</ExtensionGeneratorMapping>
</extension>
</plugin>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.yakindu.sct.generator.c.GenArtifactConfigurations;
import org.yakindu.sct.generator.c.IGenArtifactConfigurations;
import org.yakindu.sct.generator.c.types.CTypeSystemAccess;
import org.yakindu.sct.generator.core.impl.GenericJavaBasedGenerator;
import org.yakindu.sct.generator.core.impl.AbstractSExecModelGenerator;
import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess;
import org.yakindu.sct.model.sexec.ExecutionFlow;
import org.yakindu.sct.model.sexec.naming.INamingService;
Expand All @@ -31,24 +31,24 @@
* @author Markus Mühlbrandt - Initial contribution and API
*
*/
public class CppCodeGenerator extends GenericJavaBasedGenerator {
public class CppCodeGenerator extends AbstractSExecModelGenerator {

@Inject
private CppGenerator delegate;

@Inject
private IGenArtifactConfigurations artifactConfigs;

@Override
protected void prepareGenerator(GeneratorEntry entry) {
super.prepareGenerator(entry);
initGenArtifactConfigurations();
}

protected void initGenArtifactConfigurations() {
artifactConfigs.setFileSystemAccess(sctFsa);
}

@Override
public void runGenerator(Statechart statechart, GeneratorEntry entry) {
ExecutionFlow flow = createExecutionFlow(statechart, entry);
Expand All @@ -66,7 +66,7 @@ public void configure(Binder binder) {
binder.bind(ICodegenTypeSystemAccess.class).to(CTypeSystemAccess.class);
binder.bind(INamingService.class).to(CppNamingService.class);
binder.bind(GeneratorEntry.class).toInstance(entry);

binder.bind(IGenArtifactConfigurations.class).to(GenArtifactConfigurations.class);
// default binding to ensure consistency of already used API
binder.bind(IGenArtifactConfigurations.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
package org.yakindu.sct.generator.csharp;

import org.yakindu.sct.generator.core.impl.GenericJavaBasedGenerator;
import org.yakindu.sct.generator.core.impl.AbstractSExecModelGenerator;
import org.yakindu.sct.generator.core.types.ICodegenTypeSystemAccess;
import org.yakindu.sct.generator.csharp.types.CSharpTypeSystemAccess;
import org.yakindu.sct.model.sexec.ExecutionFlow;
Expand All @@ -22,12 +22,11 @@
import com.google.inject.Module;
import com.google.inject.util.Modules;

public class CSharpCodeGenerator extends GenericJavaBasedGenerator {
public class CSharpCodeGenerator extends AbstractSExecModelGenerator {

@Inject
CSharpGenerator delegate;



@Override
public void runGenerator(Statechart statechart, GeneratorEntry entry) {
ExecutionFlow flow = createExecutionFlow(statechart, entry);
Expand All @@ -37,18 +36,16 @@ public void runGenerator(Statechart statechart, GeneratorEntry entry) {
delegate.generate(flow, entry, sctFsa.getIFileSystemAccess());
}


@Override
public Module getOverridesModule(final GeneratorEntry entry) {
Module module = super.getOverridesModule(entry);
return Modules.override(module).with(new Module() {
public void configure(Binder binder) {
binder.bind(ICodegenTypeSystemAccess.class)
.to(CSharpTypeSystemAccess.class);
binder.bind(ICodegenTypeSystemAccess.class).to(CSharpTypeSystemAccess.class);
binder.bind(INamingService.class).to(CSharpNamingService.class);
binder.bind(GeneratorEntry.class).toInstance(entry);
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
*/
package org.yakindu.sct.generator.java;

import org.yakindu.sct.generator.core.impl.GenericJavaBasedGenerator;
import static org.yakindu.sct.generator.core.library.ICoreLibraryConstants.OUTLET_FEATURE;
import static org.yakindu.sct.generator.core.library.ICoreLibraryConstants.OUTLET_FEATURE_TARGET_FOLDER;

import org.yakindu.sct.generator.core.impl.AbstractSExecModelGenerator;
import org.yakindu.sct.model.sgen.FeatureConfiguration;
import org.yakindu.sct.model.sgen.GeneratorEntry;
import org.yakindu.sct.model.sgraph.Statechart;
import static org.yakindu.sct.generator.core.library.ICoreLibraryConstants.*;

abstract public class AbstractJavaCodeGenerator extends GenericJavaBasedGenerator {
abstract public class AbstractJavaCodeGenerator extends AbstractSExecModelGenerator {

abstract public void generate(Statechart statechart, GeneratorEntry entry);

Expand Down
7 changes: 7 additions & 0 deletions plugins/org.yakindu.sct.generator.runner/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions plugins/org.yakindu.sct.generator.runner/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
28 changes: 28 additions & 0 deletions plugins/org.yakindu.sct.generator.runner/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.yakindu.sct.generator.runner</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
14 changes: 14 additions & 0 deletions plugins/org.yakindu.sct.generator.runner/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: YAKINDU Workspace Generator Runner
Bundle-SymbolicName: org.yakindu.sct.generator.runner;singleton:=true
Bundle-Version: 2.7.1.qualifier
Bundle-Activator: org.yakindu.sct.generator.runner.RunnerActivator
Bundle-Vendor: statecharts.org
Require-Bundle: org.eclipse.core.runtime,
org.yakindu.sct.generator.core,
org.yakindu.sct.generator.genmodel,
org.yakindu.sct.commons,
org.eclipse.jdt.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
5 changes: 5 additions & 0 deletions plugins/org.yakindu.sct.generator.runner/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions plugins/org.yakindu.sct.generator.runner/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.yakindu.sct.generator.core.featuretypes">
<FeatureLibrary
library_id="org.yakindu.generator.core.features.generic"
defaultProvider="org.yakindu.sct.generator.runner.lib.GenericJavaLibraryDefaultValueProvider"
uri="platform:/plugin/org.yakindu.sct.generator.runner/library/GenericJavaFeatureTypeLibrary.xmi">
</FeatureLibrary>
</extension>
<extension
point="org.yakindu.sct.generator.core.generator">
<SCTGenerator
class="org.yakindu.sct.generator.runner.GenericJavaBasedGenerator"
contentType="statechart"
description="Generate Code using a runtime code generator"
elementRefType="org.yakindu.sct.model.sgraph.Statechart"
icon="icons/sct.png"
id="yakindu::generic"
name="Custom Xtend2/Java-based Generator">
<FeatureLibrary
library_id="org.yakindu.generator.core.features">
</FeatureLibrary>
<FeatureLibrary
library_id="org.yakindu.generator.core.features.generic">
</FeatureLibrary>
</SCTGenerator>
</extension>
<extension
point="org.yakindu.sct.generator.core.extensions">
<ExtensionGeneratorMapping
fileExtension="sct"
generatorId="yakindu::generic">
</ExtensionGeneratorMapping>
</extension>
</plugin>
15 changes: 15 additions & 0 deletions plugins/org.yakindu.sct.generator.runner/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.yakindu.sct</groupId>
<artifactId>org.yakindu.sct.releng</artifactId>
<version>2.7.1-SNAPSHOT</version>
<relativePath>../../releng/org.yakindu.sct.releng/pom.xml</relativePath>
</parent>
<artifactId>org.yakindu.sct.generator.runner</artifactId>
<groupId>org.yakindu.sct.plugins</groupId>
<packaging>eclipse-plugin</packaging>
</project>
Loading

0 comments on commit dd48684

Please sign in to comment.