Skip to content
Open

SCXML #184

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ca046f3
Initialize SCXML transformation projects
radnaib Feb 27, 2022
4bb91c1
Add root element transformation and handler
radnaib Feb 27, 2022
fef81bd
add state hierarchy transformations
radnaib Feb 28, 2022
014d25c
Add basic guard condition parser
radnaib Mar 9, 2022
f9cd8e2
Simplify basic expression parser
radnaib Mar 28, 2022
88822a8
Transform final states and add naming functions
radnaib Mar 28, 2022
d110bf8
Transform initial states
radnaib Mar 29, 2022
75e4d9a
Transform history states and transitions
radnaib Mar 29, 2022
5e9a83e
Remove unnecessary parser related classes
radnaib Mar 30, 2022
87626c2
Add variable transformation in Scxml root node
radnaib Apr 8, 2022
84b75ba
Add fixes and todo comments
radnaib Apr 22, 2022
c051bc5
Merge branch 'dev' into scxml
radnaib Apr 29, 2022
98f2389
Introduce port and event transformers
radnaib May 3, 2022
74080b7
Add interface transformation
radnaib May 10, 2022
71550c3
Transform raise event actions
radnaib May 10, 2022
458615a
Fix adding all transitions from initial states
radnaib May 22, 2022
879d8b8
Merge branch 'dev' into scxml
radnaib Sep 12, 2022
1299968
Wrap transformed statechart in async adapter
radnaib Oct 3, 2022
f4ac234
Merge remote-tracking branch 'upstream/dev' into dev
radnaib Oct 15, 2022
a5542d6
Merge branch 'dev' into scxml
radnaib Oct 15, 2022
7175e05
Update required Java version to 17
radnaib Oct 15, 2022
81c4663
Introduce composite SCXML model transformation
radnaib Nov 4, 2022
d7be791
Add transformation of port bindings and channels
radnaib Dec 2, 2022
cd3dffb
WIP: Fix composite transformation issues
radnaib Dec 6, 2022
3cbf1ca
Fix internal event selection in message queues
radnaib Dec 6, 2022
cb4accc
Update message queue control specifications
radnaib Dec 6, 2022
c379cfc
Merge branch 'dev' into scxml
radnaib Dec 8, 2022
e7c0c19
Merge branch 'dev' into scxml
radnaib Dec 8, 2022
2852fa1
Add copyright notices
radnaib Feb 27, 2023
b5b8ba0
Merge remote-tracking branch 'upstream/dev' into scxml
radnaib Mar 1, 2023
d07d4d9
Fix creating event passings in message queues
radnaib Mar 2, 2023
a1783ec
Merge branch 'dev' into scxml
radnaib Sep 17, 2023
4e2f325
Merge branch 'dev' into scxml
radnaib Feb 15, 2024
c06edd8
Remove unnecessary scxml launch config from repo
radnaib Feb 26, 2024
8d84433
Merge remote-tracking branch 'upstream/dev' into scxml
radnaib May 20, 2024
31912a9
Merge remote-tracking branch 'upstream/dev' into scxml
radnaib Sep 4, 2024
5f506e0
WIP Restructure statechart and invoke transformation
radnaib Oct 7, 2024
23a4d13
Fix composite transformation errors
radnaib Dec 11, 2024
c913c57
Transform if actions, preprocess Gamma expressions
radnaib Mar 13, 2025
4390570
Add basic send action transformation
radnaib Mar 13, 2025
db49e8e
Merge remote-tracking branch 'upstream/dev' into scxml-adaptive-state…
radnaib Mar 13, 2025
909e704
Merge remote-tracking branch 'upstream/dev' into scxml-adaptive-state…
radnaib Mar 20, 2025
0532e2c
Merge remote-tracking branch 'upstream/dev' into scxml-adaptive-state…
radnaib Mar 26, 2025
f48a17b
Merge remote-tracking branch 'upstream/dev' into scxml-adaptive-state…
radnaib Apr 3, 2025
5fbb404
Merge remote-tracking branch 'upstream/dev' into scxml-adaptive-state…
radnaib Apr 17, 2025
dfcbc71
Merge remote-tracking branch 'upstream/dev' into scxml-adaptive-state…
radnaib Sep 23, 2025
6c1758c
Merge remote-tracking branch 'upstream/dev' into scxml-adaptive-state…
radnaib Dec 9, 2025
c6169f1
Update adaptive statechart transformation and expression linking
radnaib Feb 15, 2026
91076dc
Merge remote-tracking branch 'upstream/dev' into scxml-adaptive-state…
radnaib Feb 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ protected Injector getInjector() {
return new StatechartLanguageStandaloneSetup().createInjectorAndDoEMFRegistration();
}

@Override
protected Class<? extends AbstractAntlrParser> getParserClass() {
return CustomStatechartExpressionLanguageParser.class;
}
Expand Down
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-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hu.bme.mit.gamma.scxml.transformation.commandhandler</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,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SCXML To Gamma Transformer Commandhandler
Bundle-SymbolicName: hu.bme.mit.gamma.scxml.transformation.commandhandler;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: hu.bme.mit.gamma.scxml.transformation.commandhandler
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.eclipse.core.commands,
ac.soton.scxml,
hu.bme.mit.gamma.scxml.transformation,
org.eclipse.core.resources,
org.eclipse.emf.common,
org.eclipse.emf.ecore,
org.eclipse.jface,
org.eclipse.ui.workbench,
org.eclipse.m2e.maven.runtime,
hu.bme.mit.gamma.statechart.model,
hu.bme.mit.gamma.statechart.language.ui,
org.eclipse.equinox.registry
Export-Package: hu.bme.mit.gamma.scxml.transformation.commandhandler;uses:="org.eclipse.core.commands,hu.bme.mit.gamma.util,hu.bme.mit.gamma.statechart.util"
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.ui.commands">
<command id="hu.bme.mit.gamma.scxml.transformation" name="Generate Gamma Component"/>
</extension>
<extension point="org.eclipse.ui.menus">
<menuContribution allPopups="false"
locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu">
<menu id="gammaProjectMenu" label="Gamma Commands" icon="icons/gamma-icon-16.png">
<!-- Generate Gamma Model -->
<command commandId="hu.bme.mit.gamma.scxml.transformation"
label="Generate Gamma Statechart" style="push">
<visibleWhen checkEnabled="false">
<iterate ifEmpty="false" operator="or">
<test property="org.eclipse.core.resources.name" value="*.scxml">
</test>
</iterate>
</visibleWhen>
</command>
</menu>
</menuContribution>
<menuContribution allPopups="false" locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
<menu id="gammaPackageMenu" label="Gamma Commands" icon="icons/gamma-icon-16.png">
<!-- Generate Gamma Model -->
<command commandId="hu.bme.mit.gamma.scxml.transformation"
label="Generate Gamma Component" style="push">
<visibleWhen checkEnabled="false">
<iterate ifEmpty="false" operator="or">
<test property="org.eclipse.core.resources.name" value="*.scxml">
</test>
</iterate>
</visibleWhen>
</command>
</menu>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler class="hu.bme.mit.gamma.scxml.transformation.commandhandler.CommandHandler"
commandId="hu.bme.mit.gamma.scxml.transformation"/>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/********************************************************************************
* Copyright (c) 2023-2025 Contributors to the Gamma project
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* SPDX-License-Identifier: EPL-1.0
********************************************************************************/
package hu.bme.mit.gamma.scxml.transformation.commandhandler;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;

import ac.soton.scxml.ScxmlScxmlType;
import hu.bme.mit.gamma.expression.model.ConstantDeclaration;
import hu.bme.mit.gamma.scxml.transformation.CompositeTraceability;
import hu.bme.mit.gamma.scxml.transformation.Namings;
import hu.bme.mit.gamma.scxml.transformation.ScxmlToGammaCompositeTransformer;
import hu.bme.mit.gamma.statechart.derivedfeatures.StatechartModelDerivedFeatures;
import hu.bme.mit.gamma.statechart.interface_.Component;
import hu.bme.mit.gamma.statechart.interface_.Interface;
import hu.bme.mit.gamma.statechart.interface_.Package;
import hu.bme.mit.gamma.statechart.language.ui.serializer.StatechartLanguageSerializer;
import hu.bme.mit.gamma.statechart.util.StatechartUtil;
import hu.bme.mit.gamma.util.FileUtil;
import hu.bme.mit.gamma.util.GammaEcoreUtil;

public class CommandHandler extends AbstractHandler {

protected final FileUtil fileUtil = FileUtil.INSTANCE;
protected final GammaEcoreUtil ecoreUtil = GammaEcoreUtil.INSTANCE;
protected final StatechartUtil statechartUtil = StatechartUtil.INSTANCE;
protected final Logger logger = Logger.getLogger("GammaLogger");

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
ISelection sel = HandlerUtil.getActiveMenuSelection(event);
if (sel instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection) sel;
Object firstElement = selection.getFirstElement();
if (selection.size() == 1) {
if (firstElement != null && firstElement instanceof IFile) {
IFile file = (IFile) firstElement;
IContainer parentFolder = file.getParent();
String fileName = file.getName();
String extensionlessFileName = fileUtil.getExtensionlessName(fileName);
String parentPath = parentFolder.getFullPath().toString();
String path = file.getFullPath().toString();

// Model processing
ScxmlToGammaCompositeTransformer compositeTransformer = new ScxmlToGammaCompositeTransformer(path);
CompositeTraceability compositeTraceability = compositeTransformer.execute();

// Interfaces and type declarations have to be explicitly serialized in another package
List<Interface> gammaInterfaces = new ArrayList<Interface>(
compositeTraceability.getInterfaces());
gammaInterfaces.removeIf(i -> i == null);
ScxmlScxmlType scxmlRoot = compositeTraceability.getScxmlRoot();
Package gammaInterfacePackage = statechartUtil.createPackage(
Namings.getInterfacePackageName(scxmlRoot));
gammaInterfacePackage.getInterfaces().addAll(gammaInterfaces);

List<ConstantDeclaration> gammaConstants = new ArrayList<ConstantDeclaration>(
compositeTraceability.getConstantDeclarations());
gammaInterfacePackage.getConstantDeclarations().addAll(gammaConstants);

// Pack and serialize asynchronous component
Component rootComponent = compositeTraceability.getRootComponent();
Package gammaCompositePackage = statechartUtil.wrapIntoPackage(rootComponent);
Collection<Component> components = compositeTraceability.getComponents();
gammaCompositePackage.getComponents().addAll(components);
gammaCompositePackage.getImports()
.addAll(StatechartModelDerivedFeatures.getImportablePackages(gammaCompositePackage));
gammaCompositePackage.getImports().remove(gammaCompositePackage);

StatechartLanguageSerializer packageSerializer = new StatechartLanguageSerializer();
logger.log(Level.INFO, "Start serializing Gamma packages...");

// String declarationsPackageFileName = extensionlessFileName + "Declarations.gsm";
// ecoreUtil.normalSave(gammaInterfacePackage, parentPath,
// declarationsPackageFileName);
String declarationsPackageFileName = extensionlessFileName + "Declarations.gcd";
packageSerializer.serialize(gammaInterfacePackage, parentPath, declarationsPackageFileName);

// String compositePackageFileName = extensionlessFileName + ".gsm";
// ecoreUtil.normalSave(gammaCompositePackage, parentPath,
// compositePackageFileName);
String compositePackageFileName = extensionlessFileName + ".gcd";
packageSerializer.serialize(gammaCompositePackage, parentPath, compositePackageFileName);

logger.log(Level.INFO, "The SCXML - Gamma statechart transformation has finished.");
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}

}
12 changes: 12 additions & 0 deletions plugins/scxml/hu.bme.mit.gamma.scxml.transformation/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
34 changes: 34 additions & 0 deletions plugins/scxml/hu.bme.mit.gamma.scxml.transformation/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hu.bme.mit.gamma.scxml.transformation</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<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>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SCXML To Gamma Transformation
Bundle-SymbolicName: hu.bme.mit.gamma.scxml.transformation;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: hu.bme.mit.gamma.scxml.transformation
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: ac.soton.scxml,
hu.bme.mit.gamma.statechart.model,
com.google.guava,
org.eclipse.xtext.xbase.lib,
org.eclipse.xtend.lib,
org.eclipse.xtend.lib.macro,
hu.bme.mit.gamma.expression.language,
com.google.inject;bundle-version="3.0.0",
hu.bme.mit.gamma.expression.model,
org.eclipse.xtext
Export-Package: hu.bme.mit.gamma.scxml.transformation
Import-Package: hu.bme.mit.gamma.statechart.language.parser,
org.antlr.runtime,
org.eclipse.xtext,
org.eclipse.xtext.nodemodel,
org.eclipse.xtext.parser,
org.eclipse.xtext.scoping,
org.eclipse.xtext.scoping.impl,
org.eclipse.xtext.util
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/,\
xtend-gen/
output.. = bin/
bin.includes = META-INF/,\
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/********************************************************************************
* Copyright (c) 2023-2025 Contributors to the Gamma project
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* SPDX-License-Identifier: EPL-1.0
********************************************************************************/
package hu.bme.mit.gamma.scxml.transformation

import hu.bme.mit.gamma.action.model.ActionModelFactory
import hu.bme.mit.gamma.expression.model.ExpressionModelFactory
import hu.bme.mit.gamma.expression.util.ExpressionTypeDeterminator2
import hu.bme.mit.gamma.scxml.transformation.parse.ScxmlGammaExpressionLanguageLinker
import hu.bme.mit.gamma.scxml.transformation.parse.ScxmlGammaExpressionLanguageParser
import hu.bme.mit.gamma.statechart.composite.CompositeModelFactory
import hu.bme.mit.gamma.statechart.interface_.InterfaceModelFactory
import hu.bme.mit.gamma.statechart.phase.PhaseModelFactory
import hu.bme.mit.gamma.statechart.statechart.StatechartModelFactory
import hu.bme.mit.gamma.statechart.util.StatechartUtil
import hu.bme.mit.gamma.util.GammaEcoreUtil
import java.util.logging.Logger

abstract class AbstractTransformer {

protected final extension GammaEcoreUtil ecoreUtil = GammaEcoreUtil.INSTANCE
protected final extension StatechartUtil statechartUtil = StatechartUtil.INSTANCE
// protected final extension ActionUtil actionUtil = ActionUtil.INSTANCE
// protected final extension ExpressionUtil expressionUtil = ExpressionUtil.INSTANCE

protected final extension InterfaceModelFactory interfaceModelFactory = InterfaceModelFactory.eINSTANCE
protected final extension CompositeModelFactory compositeModelFactory = CompositeModelFactory.eINSTANCE
protected final extension StatechartModelFactory statechartModelFactory = StatechartModelFactory.eINSTANCE
protected final extension PhaseModelFactory phaseModelFactory = PhaseModelFactory.eINSTANCE
protected final extension ActionModelFactory actionModelFactory = ActionModelFactory.eINSTANCE
protected final extension ExpressionModelFactory expressionModelFactory = ExpressionModelFactory.eINSTANCE

protected final ScxmlGammaExpressionLanguageParser expressionLanguageParser = new ScxmlGammaExpressionLanguageParser()
protected final ScxmlGammaExpressionLanguageLinker expressionLanguageLinker = new ScxmlGammaExpressionLanguageLinker()
protected final ExpressionTypeDeterminator2 expressionTypeDeterminator = ExpressionTypeDeterminator2.INSTANCE

protected final Logger logger = Logger.getLogger("GammaLogger")

}
Loading