Skip to content

Commit

Permalink
adopted syntax, added code generator example, added gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasmuelder committed May 3, 2017
1 parent 521c6a5 commit 73e51fb
Show file tree
Hide file tree
Showing 71 changed files with 1,036 additions and 108,044 deletions.
13 changes: 13 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="plugins/com.yakindu.sct.domain.scenario.lang.ui/src"/>
<classpathentry kind="src" path="plugins/com.yakindu.sct.domain.scenario.lang.ui/src-gen"/>
<classpathentry kind="src" path="plugins/com.yakindu.sct.domain.scenario.lang.ui/xtend-gen"/>
<classpathentry kind="src" path="plugins/com.yakindu.sct.domain.scenario.lang/src"/>
<classpathentry kind="src" path="plugins/com.yakindu.sct.domain.scenario.lang/src-gen"/>
<classpathentry kind="src" path="plugins/com.yakindu.sct.domain.scenario.lang/xtend-gen"/>
<classpathentry kind="src" path="plugins/com.yakindu.sct.domain.scenario.ui/src"/>
<classpathentry kind="src" path="plugins/com.yakindu.sct.domain.scenario/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="plugins/com.yakindu.sct.domain.scenario/bin"/>
</classpath>
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>SBPinSC</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/bin/
/target/
/xtend-gen/
/src-gen/
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.yakindu.sct.domain.scenario.generator.example</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtend.shared.ui.xtendBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtend.shared.ui.xtendXPandNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
encoding/.classpath=Cp1252
encoding//.settings/org.eclipse.core.resources.prefs=Cp1252
encoding//.settings/org.eclipse.jdt.core.prefs=Cp1252
encoding//.settings/org.eclipse.xtend.shared.ui.prefs=Cp1252
encoding//META-INF/MANIFEST.MF=Cp1252
encoding//src/com/yakindu/sct/domain/scenario/generator/example/ScenarioExampleGenerator.xtend=Cp1252
encoding//src/com/yakindu/sct/domain/scenario/generator/example/ScenarioExampleGeneratorModule.java=Cp1252
encoding/<project>=Cp1252
encoding/build.properties=Cp1252
encoding/plugin.xml=Cp1252
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eclipse.preferences.version=1
project.specific.metamodel=true
metamodelContributor=org.eclipse.xtend.typesystem.emf.ui.EmfMetamodelContributor
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.yakindu.sct.domain.scenario.generator.example
Bundle-SymbolicName: com.yakindu.sct.domain.scenario.generator.example; singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.eclipse.jdt.core,
org.apache.commons.logging,
org.apache.log4j;resolution:=optional,
com.ibm.icu,
org.antlr.runtime,
org.eclipse.core.runtime,
org.eclipse.emf.mwe.utils,
org.eclipse.emf.ecore.xmi,
org.eclipse.jface.text,
org.eclipse.xtend;bundle-version="0.7.0",
org.eclipse.xtend.typesystem.emf;bundle-version="0.7.0",
org.eclipse.xtext.xbase.lib,
org.eclipse.xtend.lib,
org.yakindu.sct.generator.core,
org.yakindu.sct.model.sgen,
org.yakindu.sct.model.sexec,
org.yakindu.sct.model.stext,
org.yakindu.sct.model.sgraph,
com.yakindu.sct.domain.scenario.lang,
org.yakindu.sct.generator.java
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source.. = src/,\
xtend-gen
bin.includes = META-INF/,.,plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.yakindu.sct.generator.core.generator">
<SCTGenerator
executor="org.yakindu.sct.generator.core.execution.SGraphGeneratorEntryExecutor"
bindings="com.yakindu.sct.domain.scenario.generator.example.ScenarioExampleGeneratorModule"
description=""
id="example::Scenario"
name="Example Scenario Generator"
contentType="statechart"
elementRefType="org.yakindu.sct.model.sgraph.Statechart">
<FeatureLibrary
library_id="org.yakindu.generator.core.features">
</FeatureLibrary>
</SCTGenerator>
</extension>
<extension point="org.yakindu.sct.generator.core.extensions">
<ExtensionGeneratorMapping fileExtension="sct" generatorId="example::Scenario">
</ExtensionGeneratorMapping>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.yakindu.sct.domain.scenario.generator.example

import com.yakindu.sct.domain.scenario.scenarioText.BlockedEventSet
import com.yakindu.sct.domain.scenario.scenarioText.RequestedEventSet
import com.yakindu.sct.domain.scenario.scenarioText.StateScope
import org.eclipse.xtext.generator.IFileSystemAccess
import org.yakindu.sct.generator.core.ISGraphGenerator
import org.yakindu.sct.model.sgen.GeneratorEntry
import org.yakindu.sct.model.sgraph.State
import org.yakindu.sct.model.sgraph.Statechart

/**
* Simple example how to use Blocks / Requested Event sets in code generator based on SGraph Meta Model
*/
class ScenarioExampleGenerator implements ISGraphGenerator {

override generate(Statechart sc, GeneratorEntry entry, IFileSystemAccess access) {
access.generateFile(sc.name + '.txt', sc.info);
}

def info(
Statechart sc) {
'''
The name of the state machine is '«sc.name»'
The state machine has the following states:
«FOR State state : sc.regions.map[vertices].flatten.filter(State)»
«state.name»
The state blocks the following events:
«FOR blockedEventSet : state.scopes.filter(StateScope).map[scenarios.filter(BlockedEventSet)].flatten»
«FOR event : blockedEventSet.events»
«event.name»
«ENDFOR»
«ENDFOR»
The state requested the following events:
«FOR requestedEventSet : state.scopes.filter(StateScope).map[scenarios.filter(RequestedEventSet)].flatten»
«FOR event : requestedEventSet.events»
«event.name»
«ENDFOR»
«ENDFOR»
«ENDFOR»
'''.toString
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.yakindu.sct.domain.scenario.generator.example;

import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.yakindu.sct.generator.core.GeneratorModule;
import org.yakindu.sct.generator.core.ISGraphGenerator;
import org.yakindu.sct.model.sgen.GeneratorEntry;
import org.yakindu.sct.model.stext.naming.StextNameProvider;

import com.google.inject.Binder;

public class ScenarioExampleGeneratorModule implements GeneratorModule {

public void configure(GeneratorEntry entry, Binder binder) {
binder.bind(ISGraphGenerator.class).to(ScenarioExampleGenerator.class);
binder.bind(IQualifiedNameProvider.class).to(StextNameProvider.class);
}
}
2 changes: 0 additions & 2 deletions plugins/com.yakindu.sct.domain.scenario.lang.ui/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
/bin/
/target/
.antlr-generator-3.2.0-patch.jar
.antlr-generator-3.2.0.jar
Loading

0 comments on commit 73e51fb

Please sign in to comment.