Added example
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/.classpath b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/.classpath
new file mode 100644
index 0000000..39810b7
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/.project b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/.project
new file mode 100644
index 0000000..8af8435
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/.project
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.epsilon.sirius.widget.examples.statemachine.design</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>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/META-INF/MANIFEST.MF b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c159410
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.epsilon.sirius.widget.examples.statemachine.design;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.epsilon.sirius.widget.examples.statemachine.design.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.sirius,
+ org.eclipse.sirius.common.acceleo.aql,
+ org.eclipse.epsilon.sirius.widget,
+ org.eclipse.epsilon.sirius.widget.examples.statemachine,
+ org.eclipse.sirius.common.ui,
+ org.eclipse.sirius.ui
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-Vendor: %providerName
+Automatic-Module-Name: org.eclipse.epsilon.sirius.widget.examples.statemachine.design
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/build.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/build.properties
new file mode 100644
index 0000000..1ab7df2
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ description/,\
+ plugin.properties,\
+ plugin.xml
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/description/statemachine.odesign b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/description/statemachine.odesign
new file mode 100644
index 0000000..80bd336
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/description/statemachine.odesign
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:properties="http://www.eclipse.org/sirius/properties/1.0.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/diagram/description/tool/1.1.0" xmlns:tool_1="http://www.eclipse.org/sirius/description/tool/1.1.0" name="statemachine" version="12.0.0.2017041100">
+ <ownedViewpoints name="Statemachine">
+ <ownedRepresentations xsi:type="description_1:DiagramDescription" name="State Machine Diagram" domainClass="statemachine::StateMachine" enablePopupBars="true">
+ <metamodel href="../../org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.ecore#/"/>
+ <defaultLayer name="Default">
+ <nodeMappings name="State Node" semanticCandidatesExpression="feature:states" domainClass="statemachine::State">
+ <style xsi:type="style:EllipseNodeDescription" labelSize="12" showIcon="false" labelPosition="node" resizeKind="NSEW">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
+ </style>
+ <conditionnalStyles predicateExpression="aql:self.oclIsTypeOf(statemachine::FinalState)">
+ <style xsi:type="style:EllipseNodeDescription" labelSize="12" showIcon="false" labelExpression="aql:'Final State'" labelPosition="node" resizeKind="NSEW">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='green']"/>
+ </style>
+ </conditionnalStyles>
+ </nodeMappings>
+ <nodeMappings name="Initial State Node" semanticCandidatesExpression="feature:initialState" domainClass="statemachine::InitialState">
+ <style xsi:type="style:EllipseNodeDescription" labelSize="12" showIcon="false" labelExpression="aql:'Initial State'" labelPosition="node" resizeKind="NSEW">
+ <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='blue']"/>
+ </style>
+ </nodeMappings>
+ <edgeMappings name="Transition Edge" semanticCandidatesExpression="feature:transitions" sourceMapping="//@ownedViewpoints[name='Statemachine']/@ownedRepresentations[name='State%20Machine%20Diagram']/@defaultLayer/@nodeMappings[name='State%20Node'] //@ownedViewpoints[name='Statemachine']/@ownedRepresentations[name='State%20Machine%20Diagram']/@defaultLayer/@nodeMappings[name='Initial%20State%20Node']" targetMapping="//@ownedViewpoints[name='Statemachine']/@ownedRepresentations[name='State%20Machine%20Diagram']/@defaultLayer/@nodeMappings[name='State%20Node'] //@ownedViewpoints[name='Statemachine']/@ownedRepresentations[name='State%20Machine%20Diagram']/@defaultLayer/@nodeMappings[name='Initial%20State%20Node']" targetFinderExpression="feature:to" sourceFinderExpression="feature:from" domainClass="statemachine::Transition" useDomainElement="true">
+ <style sizeComputationExpression="2">
+ <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
+ <centerLabelStyleDescription labelSize="12" showIcon="false" labelExpression="aql:self.guard">
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </centerLabelStyleDescription>
+ </style>
+ </edgeMappings>
+ <toolSections name="Creation Tools">
+ <ownedTools xsi:type="tool:NodeCreationDescription" name="Create State" nodeMappings="//@ownedViewpoints[name='Statemachine']/@ownedRepresentations[name='State%20Machine%20Diagram']/@defaultLayer/@nodeMappings[name='State%20Node']">
+ <variable name="container"/>
+ <viewVariable name="containerView"/>
+ <initialOperation>
+ <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="statemachine::State" referenceName="states"/>
+ </initialOperation>
+ </ownedTools>
+ <ownedTools xsi:type="tool:NodeCreationDescription" name="Create Initial State" nodeMappings="//@ownedViewpoints[name='Statemachine']/@ownedRepresentations[name='State%20Machine%20Diagram']/@defaultLayer/@nodeMappings[name='State%20Node']">
+ <variable name="container"/>
+ <viewVariable name="containerView"/>
+ <initialOperation>
+ <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="statemachine::InitialState" referenceName="initialState"/>
+ </initialOperation>
+ </ownedTools>
+ <ownedTools xsi:type="tool:NodeCreationDescription" name="Create Final State" nodeMappings="//@ownedViewpoints[name='Statemachine']/@ownedRepresentations[name='State%20Machine%20Diagram']/@defaultLayer/@nodeMappings[name='State%20Node']">
+ <variable name="container"/>
+ <viewVariable name="containerView"/>
+ <initialOperation>
+ <firstModelOperations xsi:type="tool_1:CreateInstance" typeName="statemachine::FinalState" referenceName="states"/>
+ </initialOperation>
+ </ownedTools>
+ <ownedTools xsi:type="tool:EdgeCreationDescription" name="Create Transition" edgeMappings="//@ownedViewpoints[name='Statemachine']/@ownedRepresentations[name='State%20Machine%20Diagram']/@defaultLayer/@edgeMappings[name='Transition%20Edge']">
+ <sourceVariable name="source"/>
+ <targetVariable name="target"/>
+ <sourceViewVariable name="sourceView"/>
+ <targetViewVariable name="targetView"/>
+ <initialOperation>
+ <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="aql:source.eContainer()">
+ <subModelOperations xsi:type="tool_1:CreateInstance" typeName="statemachine::Transition" referenceName="transitions">
+ <subModelOperations xsi:type="tool_1:SetValue" featureName="to" valueExpression="var:target"/>
+ <subModelOperations xsi:type="tool_1:SetValue" featureName="from" valueExpression="var:source"/>
+ </subModelOperations>
+ </firstModelOperations>
+ </initialOperation>
+ </ownedTools>
+ </toolSections>
+ <toolSections name="Run Tools">
+ <ownedTools xsi:type="tool_1:OperationAction" name="Run State Machine">
+ <view name="views"/>
+ <initialOperation>
+ <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="aql:self.execute()"/>
+ </initialOperation>
+ </ownedTools>
+ </toolSections>
+ </defaultLayer>
+ </ownedRepresentations>
+ <ownedJavaExtensions qualifiedClassName="org.eclipse.epsilon.sirius.widget.examples.statemachine.design.Services"/>
+ </ownedViewpoints>
+ <extensions xsi:type="properties:ViewExtensionDescription" name="Custom Properties Views">
+ <categories name="Props">
+ <pages>
+ <extends href="platform:/plugin/org.eclipse.sirius.properties.defaultrules/model/properties.odesign#//@extensions.0/@categories.0/@pages.0"/>
+ </pages>
+ <pages name="Eol Page" labelExpression="EOL" domainClass="statemachine::NamedElement" semanticCandidateExpression="var:self" groups="//@extensions.0/@categories.0/@groups.0"/>
+ <groups name="Eol Group" labelExpression="EOL" domainClass="statemachine::NamedElement" semanticCandidateExpression="var:self">
+ <controls xsi:type="properties:ContainerDescription" name="eol">
+ <controls xsi:type="properties:CustomDescription" name="org.eclipse.epsilon.sirius.widget"/>
+ </controls>
+ </groups>
+ </categories>
+ </extensions>
+</description:Group>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/plugin.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/plugin.properties
new file mode 100644
index 0000000..e8604c1
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/plugin.properties
@@ -0,0 +1,3 @@
+pluginName = org.eclipse.epsilon.sirius.widget.examples.statemachine.design
+providerName = Eclipse Modeling Project
+viewpointName = MyViewpoint
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/plugin.xml b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/plugin.xml
new file mode 100644
index 0000000..fa4de49
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/plugin.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension point="org.eclipse.sirius.componentization">
+ <component class="org.eclipse.epsilon.sirius.widget.examples.statemachine.design.Activator"
+ id="org.eclipse.epsilon.sirius.widget.examples.statemachine.design"
+ name="statemachine">
+ </component>
+ </extension>
+</plugin>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/Activator.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/Activator.java
new file mode 100644
index 0000000..a5537e0
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/Activator.java
@@ -0,0 +1,75 @@
+/*********************************************************************
+* Copyright (c) 2021 The University of York.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+**********************************************************************/
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.design;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.sirius.business.api.componentization.ViewpointRegistry;
+import org.eclipse.sirius.viewpoint.description.Viewpoint;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.epsilon.sirius.widget.examples.statemachine.design";
+
+ // The shared instance
+ private static Activator plugin;
+
+ private static Set<Viewpoint> viewpoints;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ viewpoints = new HashSet<Viewpoint>();
+ viewpoints.addAll(ViewpointRegistry.getInstance().registerFromPlugin(PLUGIN_ID + "/description/statemachine.odesign"));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ if (viewpoints != null) {
+ for (final Viewpoint viewpoint: viewpoints) {
+ ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint);
+ }
+ viewpoints.clear();
+ viewpoints = null;
+ }
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/Services.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/Services.java
new file mode 100644
index 0000000..ec6349b
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/Services.java
@@ -0,0 +1,23 @@
+/*********************************************************************
+* Copyright (c) 2021 The University of York.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+**********************************************************************/
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.design;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine;
+
+/**
+ * The services class used by VSM.
+ */
+public class Services {
+ public void execute(StateMachine self) {
+ StatemachineJob j = new StatemachineJob("Running State Machine", self.getInitialState());
+ j.setUser(true);
+ j.schedule();
+ }
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/StatemachineJob.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/StatemachineJob.java
new file mode 100644
index 0000000..e4c75c8
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.design/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/design/StatemachineJob.java
@@ -0,0 +1,100 @@
+/*********************************************************************
+* Copyright (c) 2021 The University of York.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+**********************************************************************/
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.design;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.epsilon.common.dt.console.EpsilonConsole;
+import org.eclipse.epsilon.eol.EolModule;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.State;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition;
+import org.eclipse.sirius.business.api.query.EObjectQuery;
+import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil;
+import org.eclipse.sirius.ui.business.api.dialect.DialectEditor;
+import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager;
+import org.eclipse.sirius.viewpoint.DRepresentationElement;
+import org.eclipse.sirius.viewpoint.ViewpointPackage;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+
+public class StatemachineJob extends Job {
+
+ private EolModule module;
+ private InitialState initial;
+
+ public StatemachineJob(String name, InitialState initial) {
+ super(name);
+ module = new EolModule();
+ module.getContext().setOutputStream(EpsilonConsole.getInstance().getDebugStream());
+ module.getContext().setErrorStream(EpsilonConsole.getInstance().getErrorStream());
+ module.getContext().setWarningStream(EpsilonConsole.getInstance().getWarningStream());
+ this.initial = initial;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ runStatemachine(initial);
+ } catch (Exception e) {
+ return new Status(Status.ERROR, "org.eclipse.epsilon.sirius.widget.examples.statemachine",
+ "Failed to run job", e);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ private void runStatemachine(State currentState) throws Exception {
+ selectElement(currentState);
+ module.parse(currentState.getAction());
+ if (!module.getParseProblems().isEmpty()) {
+ throw new Exception ("EOL Module has parse problems " + module.getParseProblems());
+ }
+ module.execute();
+ for (Transition t : currentState.getOutgoing()) {
+ module.parse("return " + t.getGuard());
+ if (module.execute().equals(true)) {
+ selectElement(t);
+ runStatemachine(t.getTo());
+ break;
+ }
+ }
+ }
+
+ private void selectElement(EObject element) throws InterruptedException {
+ IWorkbenchPage page = EclipseUIUtil.getActivePage();
+ IEditorPart activeEditor = page.getActiveEditor();
+ List<DRepresentationElement> elementsRepresentingTarget = new ArrayList<>();
+
+ Collection<EObject> result = new EObjectQuery(element)
+ .getInverseReferences(ViewpointPackage.Literals.DSEMANTIC_DECORATOR__TARGET);
+
+ for (EObject e : result) {
+ if (e instanceof DRepresentationElement) {
+ elementsRepresentingTarget.add((DRepresentationElement) e);
+ }
+ }
+
+ if (activeEditor instanceof DialectEditor) {
+ Display.getDefault().asyncExec(() -> DialectUIManager.INSTANCE.selectAndReveal((DialectEditor) activeEditor,
+ elementsRepresentingTarget));
+ Thread.sleep(500);
+ }
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/.classpath b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/.classpath
new file mode 100644
index 0000000..c3ba59e
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/.project b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/.project
new file mode 100644
index 0000000..f9f1f85
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.epsilon.sirius.widget.examples.statemachine.edit</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/META-INF/MANIFEST.MF b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2943760
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.epsilon.sirius.widget.examples.statemachine.edit;singleton:=true
+Automatic-Module-Name: org.eclipse.epsilon.sirius.widget.examples.statemachine.edit
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.epsilon.sirius.widget.examples.statemachine.provider.StatemachineEditPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.epsilon.sirius.widget.examples.statemachine.provider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.epsilon.sirius.widget.examples.statemachine;visibility:=reexport,
+ org.eclipse.emf.edit;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/build.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/build.properties
new file mode 100644
index 0000000..6e3e902
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/build.properties
@@ -0,0 +1,10 @@
+#
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_initialState_InitialState.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_initialState_InitialState.gif
new file mode 100644
index 0000000..b9300d3
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_initialState_InitialState.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_FinalState.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_FinalState.gif
new file mode 100644
index 0000000..7118da1
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_FinalState.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_InitialState.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_InitialState.gif
new file mode 100644
index 0000000..b9300d3
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_InitialState.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_State.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_State.gif
new file mode 100644
index 0000000..5d64176
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_states_State.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_transitions_Transition.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_transitions_Transition.gif
new file mode 100644
index 0000000..eb8a29f
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/ctool16/CreateStateMachine_transitions_Transition.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/FinalState.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/FinalState.gif
new file mode 100644
index 0000000..ea58a65
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/FinalState.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/InitialState.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/InitialState.gif
new file mode 100644
index 0000000..7b7c428
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/InitialState.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/NamedElement.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/NamedElement.gif
new file mode 100644
index 0000000..14af8aa
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/NamedElement.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/State.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/State.gif
new file mode 100644
index 0000000..cb1755a
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/State.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/StateMachine.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/StateMachine.gif
new file mode 100644
index 0000000..badaab0
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/StateMachine.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/Transition.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/Transition.gif
new file mode 100644
index 0000000..7bac4fd
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/icons/full/obj16/Transition.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/plugin.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/plugin.properties
new file mode 100644
index 0000000..c8c8dc4
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/plugin.properties
@@ -0,0 +1,36 @@
+#
+
+pluginName = Statemachine Edit Support
+providerName = www.example.org
+
+_UI_CreateChild_text = {0}
+_UI_CreateChild_text2 = {1} {0}
+_UI_CreateChild_text3 = {1}
+_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
+_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
+_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
+
+_UI_PropertyDescriptor_description = The {0} of the {1}
+
+_UI_StateMachine_type = State Machine
+_UI_NamedElement_type = Named Element
+_UI_State_type = State
+_UI_InitialState_type = Initial State
+_UI_FinalState_type = Final State
+_UI_Transition_type = Transition
+_UI_Unknown_type = Object
+
+_UI_Unknown_datatype= Value
+
+_UI_StateMachine_initialState_feature = Initial State
+_UI_StateMachine_transitions_feature = Transitions
+_UI_StateMachine_states_feature = States
+_UI_NamedElement_name_feature = Name
+_UI_State_action_feature = Action
+_UI_State_outgoing_feature = Outgoing
+_UI_State_incoming_feature = Incoming
+_UI_Transition_to_feature = To
+_UI_Transition_from_feature = From
+_UI_Transition_guard_feature = Guard
+_UI_Unknown_feature = Unspecified
+
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/plugin.xml b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/plugin.xml
new file mode 100644
index 0000000..67a8916
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/plugin.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <!-- @generated statemachine -->
+ <factory
+ uri="http://www.eclipse.org/epsilon/statemachine"
+ class="org.eclipse.epsilon.sirius.widget.examples.statemachine.provider.StatemachineItemProviderAdapterFactory"
+ supportedTypes=
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource"/>
+ </extension>
+
+</plugin>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/FinalStateItemProvider.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/FinalStateItemProvider.java
new file mode 100644
index 0000000..6b7362f
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/FinalStateItemProvider.java
@@ -0,0 +1,106 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class FinalStateItemProvider extends StateItemProvider {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FinalStateItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This returns FinalState.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/FinalState"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((FinalState)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_FinalState_type") :
+ getString("_UI_FinalState_type") + " " + label;
+ }
+
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/InitialStateItemProvider.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/InitialStateItemProvider.java
new file mode 100644
index 0000000..5c0a9ea
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/InitialStateItemProvider.java
@@ -0,0 +1,106 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class InitialStateItemProvider extends StateItemProvider {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InitialStateItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This returns InitialState.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/InitialState"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((InitialState)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_InitialState_type") :
+ getString("_UI_InitialState_type") + " " + label;
+ }
+
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/NamedElementItemProvider.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/NamedElementItemProvider.java
new file mode 100644
index 0000000..7626275
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/NamedElementItemProvider.java
@@ -0,0 +1,165 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class NamedElementItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NamedElementItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addNamePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_NamedElement_name_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_NamedElement_name_feature", "_UI_NamedElement_type"),
+ StatemachinePackage.Literals.NAMED_ELEMENT__NAME,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns NamedElement.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/NamedElement"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((NamedElement)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_NamedElement_type") :
+ getString("_UI_NamedElement_type") + " " + label;
+ }
+
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(NamedElement.class)) {
+ case StatemachinePackage.NAMED_ELEMENT__NAME:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return StatemachineEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StateItemProvider.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StateItemProvider.java
new file mode 100644
index 0000000..405c706
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StateItemProvider.java
@@ -0,0 +1,185 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.State;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StateItemProvider extends NamedElementItemProvider {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StateItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addActionPropertyDescriptor(object);
+ addOutgoingPropertyDescriptor(object);
+ addIncomingPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Action feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addActionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_State_action_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_State_action_feature", "_UI_State_type"),
+ StatemachinePackage.Literals.STATE__ACTION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Outgoing feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addOutgoingPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_State_outgoing_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_State_outgoing_feature", "_UI_State_type"),
+ StatemachinePackage.Literals.STATE__OUTGOING,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Incoming feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addIncomingPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_State_incoming_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_State_incoming_feature", "_UI_State_type"),
+ StatemachinePackage.Literals.STATE__INCOMING,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns State.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/State"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((State)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_State_type") :
+ getString("_UI_State_type") + " " + label;
+ }
+
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(State.class)) {
+ case StatemachinePackage.STATE__ACTION:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StateMachineItemProvider.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StateMachineItemProvider.java
new file mode 100644
index 0000000..12e5ec3
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StateMachineItemProvider.java
@@ -0,0 +1,222 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachineFactory;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StateMachineItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StateMachineItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(StatemachinePackage.Literals.STATE_MACHINE__INITIAL_STATE);
+ childrenFeatures.add(StatemachinePackage.Literals.STATE_MACHINE__TRANSITIONS);
+ childrenFeatures.add(StatemachinePackage.Literals.STATE_MACHINE__STATES);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns StateMachine.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/StateMachine"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_StateMachine_type");
+ }
+
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(StateMachine.class)) {
+ case StatemachinePackage.STATE_MACHINE__INITIAL_STATE:
+ case StatemachinePackage.STATE_MACHINE__TRANSITIONS:
+ case StatemachinePackage.STATE_MACHINE__STATES:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (StatemachinePackage.Literals.STATE_MACHINE__INITIAL_STATE,
+ StatemachineFactory.eINSTANCE.createInitialState()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (StatemachinePackage.Literals.STATE_MACHINE__TRANSITIONS,
+ StatemachineFactory.eINSTANCE.createTransition()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (StatemachinePackage.Literals.STATE_MACHINE__STATES,
+ StatemachineFactory.eINSTANCE.createState()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (StatemachinePackage.Literals.STATE_MACHINE__STATES,
+ StatemachineFactory.eINSTANCE.createInitialState()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (StatemachinePackage.Literals.STATE_MACHINE__STATES,
+ StatemachineFactory.eINSTANCE.createFinalState()));
+ }
+
+ /**
+ * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
+ Object childFeature = feature;
+ Object childObject = child;
+
+ boolean qualify =
+ childFeature == StatemachinePackage.Literals.STATE_MACHINE__INITIAL_STATE ||
+ childFeature == StatemachinePackage.Literals.STATE_MACHINE__STATES;
+
+ if (qualify) {
+ return getString
+ ("_UI_CreateChild_text2",
+ new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
+ }
+ return super.getCreateChildText(owner, feature, child, selection);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return StatemachineEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StatemachineEditPlugin.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StatemachineEditPlugin.java
new file mode 100644
index 0000000..324061a
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StatemachineEditPlugin.java
@@ -0,0 +1,96 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.provider;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+/**
+ * This is the central singleton for the Statemachine edit plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class StatemachineEditPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final StatemachineEditPlugin INSTANCE = new StatemachineEditPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineEditPlugin() {
+ super
+ (new ResourceLocator [] {
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipsePlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StatemachineItemProviderAdapterFactory.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StatemachineItemProviderAdapterFactory.java
new file mode 100644
index 0000000..067f592
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/StatemachineItemProviderAdapterFactory.java
@@ -0,0 +1,326 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.util.StatemachineAdapterFactory;
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StatemachineItemProviderAdapterFactory extends StatemachineAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StateMachineItemProvider stateMachineItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createStateMachineAdapter() {
+ if (stateMachineItemProvider == null) {
+ stateMachineItemProvider = new StateMachineItemProvider(this);
+ }
+
+ return stateMachineItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NamedElementItemProvider namedElementItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createNamedElementAdapter() {
+ if (namedElementItemProvider == null) {
+ namedElementItemProvider = new NamedElementItemProvider(this);
+ }
+
+ return namedElementItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StateItemProvider stateItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createStateAdapter() {
+ if (stateItemProvider == null) {
+ stateItemProvider = new StateItemProvider(this);
+ }
+
+ return stateItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected InitialStateItemProvider initialStateItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createInitialStateAdapter() {
+ if (initialStateItemProvider == null) {
+ initialStateItemProvider = new InitialStateItemProvider(this);
+ }
+
+ return initialStateItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FinalStateItemProvider finalStateItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createFinalStateAdapter() {
+ if (finalStateItemProvider == null) {
+ finalStateItemProvider = new FinalStateItemProvider(this);
+ }
+
+ return finalStateItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TransitionItemProvider transitionItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createTransitionAdapter() {
+ if (transitionItemProvider == null) {
+ transitionItemProvider = new TransitionItemProvider(this);
+ }
+
+ return transitionItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void dispose() {
+ if (stateMachineItemProvider != null) stateMachineItemProvider.dispose();
+ if (namedElementItemProvider != null) namedElementItemProvider.dispose();
+ if (stateItemProvider != null) stateItemProvider.dispose();
+ if (initialStateItemProvider != null) initialStateItemProvider.dispose();
+ if (finalStateItemProvider != null) finalStateItemProvider.dispose();
+ if (transitionItemProvider != null) transitionItemProvider.dispose();
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/TransitionItemProvider.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/TransitionItemProvider.java
new file mode 100644
index 0000000..c623bb0
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.edit/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/provider/TransitionItemProvider.java
@@ -0,0 +1,185 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class TransitionItemProvider extends NamedElementItemProvider {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public TransitionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addToPropertyDescriptor(object);
+ addFromPropertyDescriptor(object);
+ addGuardPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the To feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addToPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Transition_to_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Transition_to_feature", "_UI_Transition_type"),
+ StatemachinePackage.Literals.TRANSITION__TO,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the From feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addFromPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Transition_from_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Transition_from_feature", "_UI_Transition_type"),
+ StatemachinePackage.Literals.TRANSITION__FROM,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Guard feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addGuardPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Transition_guard_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Transition_guard_feature", "_UI_Transition_type"),
+ StatemachinePackage.Literals.TRANSITION__GUARD,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Transition.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Transition"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Transition)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Transition_type") :
+ getString("_UI_Transition_type") + " " + label;
+ }
+
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Transition.class)) {
+ case StatemachinePackage.TRANSITION__GUARD:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/.classpath b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/.classpath
new file mode 100644
index 0000000..c3ba59e
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/.project b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/.project
new file mode 100644
index 0000000..19d5bac
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.epsilon.sirius.widget.examples.statemachine.editor</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/META-INF/MANIFEST.MF b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ccab485
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.epsilon.sirius.widget.examples.statemachine.editor;singleton:=true
+Automatic-Module-Name: org.eclipse.epsilon.sirius.widget.examples.statemachine.editor
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation.StatemachineEditorPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.epsilon.sirius.widget.examples.statemachine.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.emf.edit.ui;visibility:=reexport,
+ org.eclipse.ui.ide;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/build.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/build.properties
new file mode 100644
index 0000000..5fb0771
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/build.properties
@@ -0,0 +1,10 @@
+#
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/icons/full/obj16/StatemachineModelFile.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/icons/full/obj16/StatemachineModelFile.gif
new file mode 100644
index 0000000..415a3b6
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/icons/full/obj16/StatemachineModelFile.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/icons/full/wizban/NewStatemachine.gif b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/icons/full/wizban/NewStatemachine.gif
new file mode 100644
index 0000000..acfcd36
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/icons/full/wizban/NewStatemachine.gif
Binary files differ
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/plugin.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/plugin.properties
new file mode 100644
index 0000000..0bd0a08
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/plugin.properties
@@ -0,0 +1,53 @@
+#
+
+pluginName = Statemachine Editor
+providerName = www.example.org
+
+_UI_StatemachineEditor_menu = &Statemachine Editor
+
+_UI_CreateChild_menu_item = &New Child
+_UI_CreateSibling_menu_item = N&ew Sibling
+
+_UI_ShowPropertiesView_menu_item = Show &Properties View
+_UI_RefreshViewer_menu_item = &Refresh
+
+_UI_SelectionPage_label = Selection
+_UI_ParentPage_label = Parent
+_UI_ListPage_label = List
+_UI_TreePage_label = Tree
+_UI_TablePage_label = Table
+_UI_TreeWithColumnsPage_label = Tree with Columns
+_UI_ObjectColumn_label = Object
+_UI_SelfColumn_label = Self
+
+_UI_NoObjectSelected = Selected Nothing
+_UI_SingleObjectSelected = Selected Object: {0}
+_UI_MultiObjectSelected = Selected {0} Objects
+
+_UI_OpenEditorError_label = Open Editor
+
+_UI_Wizard_category = Example EMF Model Creation Wizards
+
+_UI_CreateModelError_message = Problems encountered in file "{0}"
+
+_UI_StatemachineModelWizard_label = Statemachine Model
+_UI_StatemachineModelWizard_description = Create a new Statemachine model
+
+_UI_StatemachineEditor_label = Statemachine Model Editor
+
+_UI_StatemachineEditorFilenameDefaultBase = My
+_UI_StatemachineEditorFilenameExtensions = statemachine
+
+_UI_Wizard_label = New
+
+_WARN_FilenameExtension = The file name must end in ''.{0}''
+_WARN_FilenameExtensions = The file name must have one of the following extensions: {0}
+
+_UI_ModelObject = &Model Object
+_UI_XMLEncoding = &XML Encoding
+_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1
+_UI_Wizard_initial_object_description = Select a model object to create
+
+_UI_FileConflict_label = File Conflict
+_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes?
+
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/plugin.xml b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/plugin.xml
new file mode 100644
index 0000000..a215226
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/plugin.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <!-- @generated statemachine -->
+ <category
+ id="org.eclipse.emf.ecore.Wizard.category.ID"
+ name="%_UI_Wizard_category"/>
+ <wizard
+ id="org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation.StatemachineModelWizardID"
+ name="%_UI_StatemachineModelWizard_label"
+ class="org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation.StatemachineModelWizard"
+ category="org.eclipse.emf.ecore.Wizard.category.ID"
+ icon="icons/full/obj16/StatemachineModelFile.gif">
+ <description>%_UI_StatemachineModelWizard_description</description>
+ <selection class="org.eclipse.core.resources.IResource"/>
+ </wizard>
+ </extension>
+
+ <extension point="org.eclipse.ui.editors">
+ <!-- @generated statemachine -->
+ <editor
+ id="org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation.StatemachineEditorID"
+ name="%_UI_StatemachineEditor_label"
+ icon="icons/full/obj16/StatemachineModelFile.gif"
+ extensions="statemachine"
+ class="org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation.StatemachineEditor"
+ contributorClass="org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation.StatemachineActionBarContributor">
+ </editor>
+ </extension>
+
+</plugin>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineActionBarContributor.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineActionBarContributor.java
new file mode 100644
index 0000000..5df9ecc
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineActionBarContributor.java
@@ -0,0 +1,431 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+
+import org.eclipse.emf.edit.ui.action.ControlAction;
+import org.eclipse.emf.edit.ui.action.CreateChildAction;
+import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.action.ValidateAction;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.SubContributionItem;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * This is the action bar contributor for the Statemachine model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StatemachineActionBarContributor
+ extends EditingDomainActionBarContributor
+ implements ISelectionChangedListener {
+ /**
+ * This keeps track of the active editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IEditorPart activeEditorPart;
+
+ /**
+ * This keeps track of the current selection provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelectionProvider selectionProvider;
+
+ /**
+ * This action opens the Properties view.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IAction showPropertiesViewAction =
+ new Action(StatemachineEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
+ @Override
+ public void run() {
+ try {
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
+ }
+ catch (PartInitException exception) {
+ StatemachineEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * This action refreshes the viewer of the current editor if the editor
+ * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IAction refreshViewerAction =
+ new Action(StatemachineEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
+ @Override
+ public boolean isEnabled() {
+ return activeEditorPart instanceof IViewerProvider;
+ }
+
+ @Override
+ public void run() {
+ if (activeEditorPart instanceof IViewerProvider) {
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if (viewer != null) {
+ viewer.refresh();
+ }
+ }
+ }
+ };
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> createChildActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateChild actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createChildMenuManager;
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> createSiblingActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateSibling actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createSiblingMenuManager;
+
+ /**
+ * This creates an instance of the contributor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineActionBarContributor() {
+ super(ADDITIONS_LAST_STYLE);
+ loadResourceAction = new LoadResourceAction();
+ validateAction = new ValidateAction();
+ controlAction = new ControlAction();
+ }
+
+ /**
+ * This adds Separators for editor additions to the tool bar.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ super.contributeToToolBar(toolBarManager);
+ toolBarManager.add(new Separator("statemachine-settings"));
+ toolBarManager.add(new Separator("statemachine-additions"));
+ }
+
+ /**
+ * This adds to the menu bar a menu and some separators for editor additions,
+ * as well as the sub-menus for object creation items.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void contributeToMenu(IMenuManager menuManager) {
+ super.contributeToMenu(menuManager);
+
+ IMenuManager submenuManager = new MenuManager(StatemachineEditorPlugin.INSTANCE.getString("_UI_StatemachineEditor_menu"), "org.eclipse.epsilon.sirius.widget.examples.statemachineMenuID");
+ menuManager.insertAfter("additions", submenuManager);
+ submenuManager.add(new Separator("settings"));
+ submenuManager.add(new Separator("actions"));
+ submenuManager.add(new Separator("additions"));
+ submenuManager.add(new Separator("additions-end"));
+
+ // Prepare for CreateChild item addition or removal.
+ //
+ createChildMenuManager = new MenuManager(StatemachineEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ submenuManager.insertBefore("additions", createChildMenuManager);
+
+ // Prepare for CreateSibling item addition or removal.
+ //
+ createSiblingMenuManager = new MenuManager(StatemachineEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ submenuManager.insertBefore("additions", createSiblingMenuManager);
+
+ // Force an update because Eclipse hides empty menus now.
+ //
+ submenuManager.addMenuListener
+ (new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuManager) {
+ menuManager.updateAll(true);
+ }
+ });
+
+ addGlobalActions(submenuManager);
+ }
+
+ /**
+ * When the active editor changes, this remembers the change and registers with it as a selection provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setActiveEditor(IEditorPart part) {
+ super.setActiveEditor(part);
+ activeEditorPart = part;
+
+ // Switch to the new selection provider.
+ //
+ if (selectionProvider != null) {
+ selectionProvider.removeSelectionChangedListener(this);
+ }
+ if (part == null) {
+ selectionProvider = null;
+ }
+ else {
+ selectionProvider = part.getSite().getSelectionProvider();
+ selectionProvider.addSelectionChangedListener(this);
+
+ // Fake a selection changed event to update the menus.
+ //
+ if (selectionProvider.getSelection() != null) {
+ selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
+ }
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
+ * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
+ * that can be added to the selected object and updating the menus accordingly.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ // Remove any menu items for old selection.
+ //
+ if (createChildMenuManager != null) {
+ depopulateManager(createChildMenuManager, createChildActions);
+ }
+ if (createSiblingMenuManager != null) {
+ depopulateManager(createSiblingMenuManager, createSiblingActions);
+ }
+
+ // Query the new selection for appropriate new child/sibling descriptors
+ //
+ Collection<?> newChildDescriptors = null;
+ Collection<?> newSiblingDescriptors = null;
+
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+
+ EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
+
+ newChildDescriptors = domain.getNewChildDescriptors(object, null);
+ newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
+ }
+
+ // Generate actions for selection; populate and redraw the menus.
+ //
+ createChildActions = generateCreateChildActions(newChildDescriptors, selection);
+ createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
+
+ if (createChildMenuManager != null) {
+ populateManager(createChildMenuManager, createChildActions, null);
+ createChildMenuManager.update(true);
+ }
+ if (createSiblingMenuManager != null) {
+ populateManager(createSiblingMenuManager, createSiblingActions, null);
+ createSiblingMenuManager.update(true);
+ }
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null) {
+ for (Object descriptor : descriptors) {
+ actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null) {
+ for (Object descriptor : descriptors) {
+ actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection,
+ * by inserting them before the specified contribution item <code>contributionID</code>.
+ * If <code>contributionID</code> is <code>null</code>, they are simply added.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) {
+ if (actions != null) {
+ for (IAction action : actions) {
+ if (contributionID != null) {
+ manager.insertBefore(contributionID, action);
+ }
+ else {
+ manager.add(action);
+ }
+ }
+ }
+ }
+
+ /**
+ * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
+ if (actions != null) {
+ IContributionItem[] items = manager.getItems();
+ for (int i = 0; i < items.length; i++) {
+ // Look into SubContributionItems
+ //
+ IContributionItem contributionItem = items[i];
+ while (contributionItem instanceof SubContributionItem) {
+ contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
+ }
+
+ // Delete the ActionContributionItems with matching action.
+ //
+ if (contributionItem instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem)contributionItem).getAction();
+ if (actions.contains(action)) {
+ manager.remove(contributionItem);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This populates the pop-up menu before it appears.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void menuAboutToShow(IMenuManager menuManager) {
+ super.menuAboutToShow(menuManager);
+ MenuManager submenuManager = null;
+
+ submenuManager = new MenuManager(StatemachineEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ populateManager(submenuManager, createChildActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+
+ submenuManager = new MenuManager(StatemachineEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ populateManager(submenuManager, createSiblingActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+ }
+
+ /**
+ * This inserts global actions before the "additions-end" separator.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void addGlobalActions(IMenuManager menuManager) {
+ menuManager.insertAfter("additions-end", new Separator("ui-actions"));
+ menuManager.insertAfter("ui-actions", showPropertiesViewAction);
+
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ menuManager.insertAfter("ui-actions", refreshViewerAction);
+
+ super.addGlobalActions(menuManager);
+ }
+
+ /**
+ * This ensures that a delete action will clean up all references to deleted objects.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected boolean removeAllReferencesOnDelete() {
+ return true;
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineEditor.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineEditor.java
new file mode 100644
index 0000000..dec178a
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineEditor.java
@@ -0,0 +1,1830 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+import org.eclipse.swt.SWT;
+
+import org.eclipse.swt.custom.CTabFolder;
+
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+
+import org.eclipse.swt.layout.FillLayout;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+
+import org.eclipse.ui.dialogs.SaveAsDialog;
+
+import org.eclipse.ui.ide.IGotoMarker;
+
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.ui.MarkerHelper;
+import org.eclipse.emf.common.ui.ViewerPane;
+
+import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.URI;
+
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+
+import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+
+import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
+
+import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
+
+import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+
+import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.provider.StatemachineItemProviderAdapterFactory;
+
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+
+/**
+ * This is an example of a Statemachine model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StatemachineEditor
+ extends MultiPageEditorPart
+ implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
+ /**
+ * This keeps track of the editing domain that is used to track all changes to the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ /**
+ * This is the one adapter factory used for providing views of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory adapterFactory;
+
+ /**
+ * This is the content outline page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IContentOutlinePage contentOutlinePage;
+
+ /**
+ * This is a kludge...
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IStatusLineManager contentOutlineStatusLineManager;
+
+ /**
+ * This is the content outline page's viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer contentOutlineViewer;
+
+ /**
+ * This is the property sheet page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>();
+
+ /**
+ * This is the viewer that shadows the selection in the content outline.
+ * The parent relation must be correctly defined for this to work.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer selectionViewer;
+
+ /**
+ * This inverts the roll of parent and child in the content provider and show parents as a tree.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer parentViewer;
+
+ /**
+ * This shows how a tree view works.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer treeViewer;
+
+ /**
+ * This shows how a list view works.
+ * A list viewer doesn't support icons.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ListViewer listViewer;
+
+ /**
+ * This shows how a table view works.
+ * A table can be used as a list with icons.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TableViewer tableViewer;
+
+ /**
+ * This shows how a tree view with columns works.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer treeViewerWithColumns;
+
+ /**
+ * This keeps track of the active viewer pane, in the book.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ViewerPane currentViewerPane;
+
+ /**
+ * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Viewer currentViewer;
+
+ /**
+ * This listens to which ever viewer is active.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelectionChangedListener selectionChangedListener;
+
+ /**
+ * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
+
+ /**
+ * This keeps track of the selection of the editor as a whole.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelection editorSelection = StructuredSelection.EMPTY;
+
+ /**
+ * The MarkerHelper is responsible for creating workspace resource markers presented
+ * in Eclipse's Problems View.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MarkerHelper markerHelper = new EditUIMarkerHelper();
+
+ /**
+ * This listens for when the outline becomes active
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IPartListener partListener =
+ new IPartListener() {
+ public void partActivated(IWorkbenchPart p) {
+ if (p instanceof ContentOutline) {
+ if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
+ getActionBarContributor().setActiveEditor(StatemachineEditor.this);
+
+ setCurrentViewer(contentOutlineViewer);
+ }
+ }
+ else if (p instanceof PropertySheet) {
+ if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
+ getActionBarContributor().setActiveEditor(StatemachineEditor.this);
+ handleActivate();
+ }
+ }
+ else if (p == StatemachineEditor.this) {
+ handleActivate();
+ }
+ }
+ public void partBroughtToTop(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partClosed(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partDeactivated(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partOpened(IWorkbenchPart p) {
+ // Ignore.
+ }
+ };
+
+ /**
+ * Resources that have been removed since last activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been changed since last activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been saved.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> savedResources = new ArrayList<Resource>();
+
+ /**
+ * Map to store the diagnostic associated with a resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
+
+ /**
+ * Controls whether the problem indication should be updated.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean updateProblemIndication = true;
+
+ /**
+ * Adapter used to update the problem indication when resources are demanded loaded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EContentAdapter problemIndicationAdapter =
+ new EContentAdapter() {
+ protected boolean dispatching;
+
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (notification.getNotifier() instanceof Resource) {
+ switch (notification.getFeatureID(Resource.class)) {
+ case Resource.RESOURCE__IS_LOADED:
+ case Resource.RESOURCE__ERRORS:
+ case Resource.RESOURCE__WARNINGS: {
+ Resource resource = (Resource)notification.getNotifier();
+ Diagnostic diagnostic = analyzeResourceProblems(resource, null);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, diagnostic);
+ }
+ else {
+ resourceToDiagnosticMap.remove(resource);
+ }
+ dispatchUpdateProblemIndication();
+ break;
+ }
+ }
+ }
+ else {
+ super.notifyChanged(notification);
+ }
+ }
+
+ protected void dispatchUpdateProblemIndication() {
+ if (updateProblemIndication && !dispatching) {
+ dispatching = true;
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ dispatching = false;
+ updateProblemIndication();
+ }
+ });
+ }
+ }
+
+ @Override
+ protected void setTarget(Resource target) {
+ basicSetTarget(target);
+ }
+
+ @Override
+ protected void unsetTarget(Resource target) {
+ basicUnsetTarget(target);
+ resourceToDiagnosticMap.remove(target);
+ dispatchUpdateProblemIndication();
+ }
+ };
+
+ /**
+ * This listens for workspace changes.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IResourceChangeListener resourceChangeListener =
+ new IResourceChangeListener() {
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+ protected ResourceSet resourceSet = editingDomain.getResourceSet();
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ public boolean visit(IResourceDelta delta) {
+ if (delta.getResource().getType() == IResource.FILE) {
+ if (delta.getKind() == IResourceDelta.REMOVED ||
+ delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) {
+ Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false);
+ if (resource != null) {
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ removedResources.add(resource);
+ }
+ else if (!savedResources.remove(resource)) {
+ changedResources.add(resource);
+ }
+ }
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ public Collection<Resource> getChangedResources() {
+ return changedResources;
+ }
+
+ public Collection<Resource> getRemovedResources() {
+ return removedResources;
+ }
+ }
+
+ final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+ delta.accept(visitor);
+
+ if (!visitor.getRemovedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ removedResources.addAll(visitor.getRemovedResources());
+ if (!isDirty()) {
+ getSite().getPage().closeEditor(StatemachineEditor.this, false);
+ }
+ }
+ });
+ }
+
+ if (!visitor.getChangedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ changedResources.addAll(visitor.getChangedResources());
+ if (getSite().getPage().getActiveEditor() == StatemachineEditor.this) {
+ handleActivate();
+ }
+ }
+ });
+ }
+ }
+ catch (CoreException exception) {
+ StatemachineEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * Handles activation of the editor or it's associated views.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void handleActivate() {
+ // Recompute the read only state.
+ //
+ if (editingDomain.getResourceToReadOnlyMap() != null) {
+ editingDomain.getResourceToReadOnlyMap().clear();
+
+ // Refresh any actions that may become enabled or disabled.
+ //
+ setSelection(getSelection());
+ }
+
+ if (!removedResources.isEmpty()) {
+ if (handleDirtyConflict()) {
+ getSite().getPage().closeEditor(StatemachineEditor.this, false);
+ }
+ else {
+ removedResources.clear();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+ else if (!changedResources.isEmpty()) {
+ changedResources.removeAll(savedResources);
+ handleChangedResources();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+
+ /**
+ * Handles what to do with changed resources on activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void handleChangedResources() {
+ if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
+ ResourceSet resourceSet = editingDomain.getResourceSet();
+ if (isDirty()) {
+ changedResources.addAll(resourceSet.getResources());
+ }
+ editingDomain.getCommandStack().flush();
+
+ updateProblemIndication = false;
+ for (Resource resource : changedResources) {
+ if (resource.isLoaded()) {
+ resource.unload();
+ try {
+ resource.load(resourceSet.getLoadOptions());
+ }
+ catch (IOException exception) {
+ if (!resourceToDiagnosticMap.containsKey(resource)) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ }
+ }
+ }
+
+ if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
+ setSelection(StructuredSelection.EMPTY);
+ }
+
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+ }
+
+ /**
+ * Updates the problems indication with the information described in the specified diagnostic.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void updateProblemIndication() {
+ if (updateProblemIndication) {
+ BasicDiagnostic diagnostic =
+ new BasicDiagnostic
+ (Diagnostic.OK,
+ "org.eclipse.epsilon.sirius.widget.examples.statemachine.editor",
+ 0,
+ null,
+ new Object [] { editingDomain.getResourceSet() });
+ for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
+ if (childDiagnostic.getSeverity() != Diagnostic.OK) {
+ diagnostic.add(childDiagnostic);
+ }
+ }
+
+ int lastEditorPage = getPageCount() - 1;
+ if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
+ ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ setActivePage(lastEditorPage);
+ }
+ }
+ else if (diagnostic.getSeverity() != Diagnostic.OK) {
+ ProblemEditorPart problemEditorPart = new ProblemEditorPart();
+ problemEditorPart.setDiagnostic(diagnostic);
+ problemEditorPart.setMarkerHelper(markerHelper);
+ try {
+ addPage(++lastEditorPage, problemEditorPart, getEditorInput());
+ setPageText(lastEditorPage, problemEditorPart.getPartName());
+ setActivePage(lastEditorPage);
+ showTabs();
+ }
+ catch (PartInitException exception) {
+ StatemachineEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
+ try {
+ markerHelper.updateMarkers(diagnostic);
+ }
+ catch (CoreException exception) {
+ StatemachineEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ }
+ }
+
+ /**
+ * Shows a dialog that asks if conflicting changes should be discarded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean handleDirtyConflict() {
+ return
+ MessageDialog.openQuestion
+ (getSite().getShell(),
+ getString("_UI_FileConflict_label"),
+ getString("_WARN_FileConflict"));
+ }
+
+ /**
+ * This creates a model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineEditor() {
+ super();
+ initializeEditingDomain();
+ }
+
+ /**
+ * This sets up the editing domain for the model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void initializeEditingDomain() {
+ // Create an adapter factory that yields item providers.
+ //
+ adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+
+ adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new StatemachineItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+
+ // Create the command stack that will notify this editor as commands are executed.
+ //
+ BasicCommandStack commandStack = new BasicCommandStack();
+
+ // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
+ //
+ commandStack.addCommandStackListener
+ (new CommandStackListener() {
+ public void commandStackChanged(final EventObject event) {
+ getContainer().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null) {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) {
+ PropertySheetPage propertySheetPage = i.next();
+ if (propertySheetPage.getControl() == null || propertySheetPage.getControl().isDisposed()) {
+ i.remove();
+ }
+ else {
+ propertySheetPage.refresh();
+ }
+ }
+ }
+ });
+ }
+ });
+
+ // Create the editing domain with a special command stack.
+ //
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
+ }
+
+ /**
+ * This is here for the listener to be able to call it.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void firePropertyChange(int action) {
+ super.firePropertyChange(action);
+ }
+
+ /**
+ * This sets the selection into whichever viewer is active.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSelectionToViewer(Collection<?> collection) {
+ final Collection<?> theSelection = collection;
+ // Make sure it's okay.
+ //
+ if (theSelection != null && !theSelection.isEmpty()) {
+ Runnable runnable =
+ new Runnable() {
+ public void run() {
+ // Try to select the items in the current content viewer of the editor.
+ //
+ if (currentViewer != null) {
+ currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
+ }
+ }
+ };
+ getSite().getShell().getDisplay().asyncExec(runnable);
+ }
+ }
+
+ /**
+ * This returns the editing domain as required by the {@link IEditingDomainProvider} interface.
+ * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain}
+ * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EditingDomain getEditingDomain() {
+ return editingDomain;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object [] getElements(Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object [] getChildren(Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ Object parent = super.getParent(object);
+ return parent != null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getParent(Object object) {
+ return null;
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCurrentViewerPane(ViewerPane viewerPane) {
+ if (currentViewerPane != viewerPane) {
+ if (currentViewerPane != null) {
+ currentViewerPane.showFocus(false);
+ }
+ currentViewerPane = viewerPane;
+ }
+ setCurrentViewer(currentViewerPane.getViewer());
+ }
+
+ /**
+ * This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
+ * is the current one.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCurrentViewer(Viewer viewer) {
+ // If it is changing...
+ //
+ if (currentViewer != viewer) {
+ if (selectionChangedListener == null) {
+ // Create the listener on demand.
+ //
+ selectionChangedListener =
+ new ISelectionChangedListener() {
+ // This just notifies those things that are affected by the section.
+ //
+ public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
+ setSelection(selectionChangedEvent.getSelection());
+ }
+ };
+ }
+
+ // Stop listening to the old one.
+ //
+ if (currentViewer != null) {
+ currentViewer.removeSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Start listening to the new one.
+ //
+ if (viewer != null) {
+ viewer.addSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Remember it.
+ //
+ currentViewer = viewer;
+
+ // Set the editors selection based on the current viewer's selection.
+ //
+ setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
+ }
+ }
+
+ /**
+ * This returns the viewer as required by the {@link IViewerProvider} interface.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Viewer getViewer() {
+ return currentViewer;
+ }
+
+ /**
+ * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void createContextMenuFor(StructuredViewer viewer) {
+ MenuManager contextMenu = new MenuManager("#PopUp");
+ contextMenu.add(new Separator("additions"));
+ contextMenu.setRemoveAllWhenShown(true);
+ contextMenu.addMenuListener(this);
+ Menu menu= contextMenu.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
+
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+ Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
+ viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
+ viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createModel() {
+ URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
+ Exception exception = null;
+ Resource resource = null;
+ try {
+ // Load the resource through the editing domain.
+ //
+ resource = editingDomain.getResourceSet().getResource(resourceURI, true);
+ }
+ catch (Exception e) {
+ exception = e;
+ resource = editingDomain.getResourceSet().getResource(resourceURI, false);
+ }
+
+ Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
+ }
+
+ /**
+ * Returns a diagnostic describing the errors and warnings listed in the resource
+ * and the specified exception (if any).
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
+ boolean hasErrors = !resource.getErrors().isEmpty();
+ if (hasErrors || !resource.getWarnings().isEmpty()) {
+ BasicDiagnostic basicDiagnostic =
+ new BasicDiagnostic
+ (hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING,
+ "org.eclipse.epsilon.sirius.widget.examples.statemachine.editor",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object [] { exception == null ? (Object)resource : exception });
+ basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
+ return basicDiagnostic;
+ }
+ else if (exception != null) {
+ return
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.epsilon.sirius.widget.examples.statemachine.editor",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object[] { exception });
+ }
+ else {
+ return Diagnostic.OK_INSTANCE;
+ }
+ }
+
+ /**
+ * This is the method used by the framework to install your own controls.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void createPages() {
+ // Creates the model from the editor input
+ //
+ createModel();
+
+ // Only creates the other pages if there is something that can be edited
+ //
+ if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
+ // Create a page for the selection tree view.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), StatemachineEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ selectionViewer = (TreeViewer)viewerPane.getViewer();
+ selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ selectionViewer.setUseHashlookup(true);
+
+ selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ selectionViewer.setInput(editingDomain.getResourceSet());
+ selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+ viewerPane.setTitle(editingDomain.getResourceSet());
+
+ new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(selectionViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_SelectionPage_label"));
+ }
+
+ // Create a page for the parent tree view.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), StatemachineEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ parentViewer = (TreeViewer)viewerPane.getViewer();
+ parentViewer.setAutoExpandLevel(30);
+ parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
+ parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(parentViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_ParentPage_label"));
+ }
+
+ // This is the page for the list viewer
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), StatemachineEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new ListViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ listViewer = (ListViewer)viewerPane.getViewer();
+ listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(listViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_ListPage_label"));
+ }
+
+ // This is the page for the tree viewer
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), StatemachineEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TreeViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ treeViewer = (TreeViewer)viewerPane.getViewer();
+ treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(treeViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TreePage_label"));
+ }
+
+ // This is the page for the table viewer.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), StatemachineEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TableViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ tableViewer = (TableViewer)viewerPane.getViewer();
+
+ Table table = tableViewer.getTable();
+ TableLayout layout = new TableLayout();
+ table.setLayout(layout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableColumn objectColumn = new TableColumn(table, SWT.NONE);
+ layout.addColumnData(new ColumnWeightData(3, 100, true));
+ objectColumn.setText(getString("_UI_ObjectColumn_label"));
+ objectColumn.setResizable(true);
+
+ TableColumn selfColumn = new TableColumn(table, SWT.NONE);
+ layout.addColumnData(new ColumnWeightData(2, 100, true));
+ selfColumn.setText(getString("_UI_SelfColumn_label"));
+ selfColumn.setResizable(true);
+
+ tableViewer.setColumnProperties(new String [] {"a", "b"});
+ tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(tableViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TablePage_label"));
+ }
+
+ // This is the page for the table tree viewer.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), StatemachineEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TreeViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ treeViewerWithColumns = (TreeViewer)viewerPane.getViewer();
+
+ Tree tree = treeViewerWithColumns.getTree();
+ tree.setLayoutData(new FillLayout());
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
+ objectColumn.setText(getString("_UI_ObjectColumn_label"));
+ objectColumn.setResizable(true);
+ objectColumn.setWidth(250);
+
+ TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
+ selfColumn.setText(getString("_UI_SelfColumn_label"));
+ selfColumn.setResizable(true);
+ selfColumn.setWidth(200);
+
+ treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"});
+ treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(treeViewerWithColumns);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
+ }
+
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ if (!getContainer().isDisposed()) {
+ setActivePage(0);
+ }
+ }
+ });
+ }
+
+ // Ensures that this editor will only display the page's tab
+ // area if there are more than one page
+ //
+ getContainer().addControlListener
+ (new ControlAdapter() {
+ boolean guard = false;
+ @Override
+ public void controlResized(ControlEvent event) {
+ if (!guard) {
+ guard = true;
+ hideTabs();
+ guard = false;
+ }
+ }
+ });
+
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+
+ /**
+ * If there is just one page in the multi-page editor part,
+ * this hides the single tab at the bottom.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void hideTabs() {
+ if (getPageCount() <= 1) {
+ setPageText(0, "");
+ if (getContainer() instanceof CTabFolder) {
+ Point point = getContainer().getSize();
+ Rectangle clientArea = getContainer().getClientArea();
+ getContainer().setSize(point.x, 2 * point.y - clientArea.height - clientArea.y);
+ }
+ }
+ }
+
+ /**
+ * If there is more than one page in the multi-page editor part,
+ * this shows the tabs at the bottom.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void showTabs() {
+ if (getPageCount() > 1) {
+ setPageText(0, getString("_UI_SelectionPage_label"));
+ if (getContainer() instanceof CTabFolder) {
+ Point point = getContainer().getSize();
+ Rectangle clientArea = getContainer().getClientArea();
+ getContainer().setSize(point.x, clientArea.height + clientArea.y);
+ }
+ }
+ }
+
+ /**
+ * This is used to track the active viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void pageChange(int pageIndex) {
+ super.pageChange(pageIndex);
+
+ if (contentOutlinePage != null) {
+ handleContentOutlineSelection(contentOutlinePage.getSelection());
+ }
+ }
+
+ /**
+ * This is how the framework determines which interfaces we implement.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public <T> T getAdapter(Class<T> key) {
+ if (key.equals(IContentOutlinePage.class)) {
+ return showOutlineView() ? key.cast(getContentOutlinePage()) : null;
+ }
+ else if (key.equals(IPropertySheetPage.class)) {
+ return key.cast(getPropertySheetPage());
+ }
+ else if (key.equals(IGotoMarker.class)) {
+ return key.cast(this);
+ }
+ else {
+ return super.getAdapter(key);
+ }
+ }
+
+ /**
+ * This accesses a cached version of the content outliner.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IContentOutlinePage getContentOutlinePage() {
+ if (contentOutlinePage == null) {
+ // The content outline is just a tree.
+ //
+ class MyContentOutlinePage extends ContentOutlinePage {
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ contentOutlineViewer = getTreeViewer();
+ contentOutlineViewer.addSelectionChangedListener(this);
+
+ // Set up the tree viewer.
+ //
+ contentOutlineViewer.setUseHashlookup(true);
+ contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ contentOutlineViewer.setInput(editingDomain.getResourceSet());
+
+ // Make sure our popups work.
+ //
+ createContextMenuFor(contentOutlineViewer);
+
+ if (!editingDomain.getResourceSet().getResources().isEmpty()) {
+ // Select the root object in the view.
+ //
+ contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+ }
+ }
+
+ @Override
+ public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
+ super.makeContributions(menuManager, toolBarManager, statusLineManager);
+ contentOutlineStatusLineManager = statusLineManager;
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ }
+
+ contentOutlinePage = new MyContentOutlinePage();
+
+ // Listen to selection so that we can handle it is a special way.
+ //
+ contentOutlinePage.addSelectionChangedListener
+ (new ISelectionChangedListener() {
+ // This ensures that we handle selections correctly.
+ //
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleContentOutlineSelection(event.getSelection());
+ }
+ });
+ }
+
+ return contentOutlinePage;
+ }
+
+ /**
+ * This accesses a cached version of the property sheet.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IPropertySheetPage getPropertySheetPage() {
+ PropertySheetPage propertySheetPage =
+ new ExtendedPropertySheetPage(editingDomain, ExtendedPropertySheetPage.Decoration.NONE, null, 0, false) {
+ @Override
+ public void setSelectionToViewer(List<?> selection) {
+ StatemachineEditor.this.setSelectionToViewer(selection);
+ StatemachineEditor.this.setFocus();
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ };
+ propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ propertySheetPages.add(propertySheetPage);
+
+ return propertySheetPage;
+ }
+
+ /**
+ * This deals with how we want selection in the outliner to affect the other views.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void handleContentOutlineSelection(ISelection selection) {
+ if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
+ if (selectedElements.hasNext()) {
+ // Get the first selected element.
+ //
+ Object selectedElement = selectedElements.next();
+
+ // If it's the selection viewer, then we want it to select the same selection as this selection.
+ //
+ if (currentViewerPane.getViewer() == selectionViewer) {
+ ArrayList<Object> selectionList = new ArrayList<Object>();
+ selectionList.add(selectedElement);
+ while (selectedElements.hasNext()) {
+ selectionList.add(selectedElements.next());
+ }
+
+ // Set the selection to the widget.
+ //
+ selectionViewer.setSelection(new StructuredSelection(selectionList));
+ }
+ else {
+ // Set the input to the widget.
+ //
+ if (currentViewerPane.getViewer().getInput() != selectedElement) {
+ currentViewerPane.getViewer().setInput(selectedElement);
+ currentViewerPane.setTitle(selectedElement);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply tests the command stack.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isDirty() {
+ return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply saves the model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ // Save only resources that have actually changed.
+ //
+ final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+ saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED);
+
+ // Do the work within an operation because this is a long running activity that modifies the workbench.
+ //
+ WorkspaceModifyOperation operation =
+ new WorkspaceModifyOperation() {
+ // This is the method that gets invoked when the operation runs.
+ //
+ @Override
+ public void execute(IProgressMonitor monitor) {
+ // Save the resources to the file system.
+ //
+ boolean first = true;
+ List<Resource> resources = editingDomain.getResourceSet().getResources();
+ for (int i = 0; i < resources.size(); ++i) {
+ Resource resource = resources.get(i);
+ if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
+ try {
+ long timeStamp = resource.getTimeStamp();
+ resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp) {
+ savedResources.add(resource);
+ }
+ }
+ catch (Exception exception) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ first = false;
+ }
+ }
+ }
+ };
+
+ updateProblemIndication = false;
+ try {
+ // This runs the options, and shows progress.
+ //
+ new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
+
+ // Refresh the necessary state.
+ //
+ ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ catch (Exception exception) {
+ // Something went wrong that shouldn't.
+ //
+ StatemachineEditorPlugin.INSTANCE.log(exception);
+ }
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+
+ /**
+ * This returns whether something has been persisted to the URI of the specified resource.
+ * The implementation uses the URI converter from the editor's resource set to try to open an input stream.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean isPersisted(Resource resource) {
+ boolean result = false;
+ try {
+ InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
+ if (stream != null) {
+ result = true;
+ stream.close();
+ }
+ }
+ catch (IOException e) {
+ // Ignore
+ }
+ return result;
+ }
+
+ /**
+ * This always returns true because it is not currently supported.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * This also changes the editor's input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
+ saveAsDialog.open();
+ IPath path = saveAsDialog.getResult();
+ if (path != null) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (file != null) {
+ doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void doSaveAs(URI uri, IEditorInput editorInput) {
+ (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ IProgressMonitor progressMonitor =
+ getActionBars().getStatusLineManager() != null ?
+ getActionBars().getStatusLineManager().getProgressMonitor() :
+ new NullProgressMonitor();
+ doSave(progressMonitor);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void gotoMarker(IMarker marker) {
+ List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker);
+ if (!targetObjects.isEmpty()) {
+ setSelectionToViewer(targetObjects);
+ }
+ }
+
+ /**
+ * This is called during startup.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput editorInput) {
+ setSite(site);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ site.setSelectionProvider(this);
+ site.getPage().addPartListener(partListener);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setFocus() {
+ if (currentViewerPane != null) {
+ currentViewerPane.setFocus();
+ }
+ else {
+ getControl(getActivePage()).setFocus();
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.add(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.remove(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ISelection getSelection() {
+ return editorSelection;
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
+ * Calling this result will notify the listeners.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSelection(ISelection selection) {
+ editorSelection = selection;
+
+ for (ISelectionChangedListener listener : selectionChangedListeners) {
+ listener.selectionChanged(new SelectionChangedEvent(this, selection));
+ }
+ setStatusLineManager(selection);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setStatusLineManager(ISelection selection) {
+ IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ?
+ contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
+
+ if (statusLineManager != null) {
+ if (selection instanceof IStructuredSelection) {
+ Collection<?> collection = ((IStructuredSelection)selection).toList();
+ switch (collection.size()) {
+ case 0: {
+ statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
+ break;
+ }
+ case 1: {
+ String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
+ statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
+ break;
+ }
+ default: {
+ statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
+ break;
+ }
+ }
+ }
+ else {
+ statusLineManager.setMessage("");
+ }
+ }
+ }
+
+ /**
+ * This looks up a string in the plugin's plugin.properties file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key) {
+ return StatemachineEditorPlugin.INSTANCE.getString(key);
+ }
+
+ /**
+ * This looks up a string in plugin.properties, making a substitution.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key, Object s1) {
+ return StatemachineEditorPlugin.INSTANCE.getString(key, new Object [] { s1 });
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void menuAboutToShow(IMenuManager menuManager) {
+ ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EditingDomainActionBarContributor getActionBarContributor() {
+ return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IActionBars getActionBars() {
+ return getActionBarContributor().getActionBars();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AdapterFactory getAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void dispose() {
+ updateProblemIndication = false;
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
+
+ getSite().getPage().removePartListener(partListener);
+
+ adapterFactory.dispose();
+
+ if (getActionBarContributor().getActiveEditor() == this) {
+ getActionBarContributor().setActiveEditor(null);
+ }
+
+ for (PropertySheetPage propertySheetPage : propertySheetPages) {
+ propertySheetPage.dispose();
+ }
+
+ if (contentOutlinePage != null) {
+ contentOutlinePage.dispose();
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * Returns whether the outline view should be presented to the user.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean showOutlineView() {
+ return true;
+ }
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineEditorPlugin.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineEditorPlugin.java
new file mode 100644
index 0000000..40839d4
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineEditorPlugin.java
@@ -0,0 +1,98 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.ui.EclipseUIPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+/**
+ * This is the central singleton for the Statemachine editor plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class StatemachineEditorPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final StatemachineEditorPlugin INSTANCE = new StatemachineEditorPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineEditorPlugin() {
+ super
+ (new ResourceLocator [] {
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipseUIPlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineModelWizard.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineModelWizard.java
new file mode 100644
index 0000000..831bfa1
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.editor/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/presentation/StatemachineModelWizard.java
@@ -0,0 +1,635 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.presentation;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.StringTokenizer;
+
+import org.eclipse.emf.common.CommonPlugin;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.emf.ecore.xmi.XMLResource;
+
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+
+import org.eclipse.swt.SWT;
+
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.ModifyEvent;
+
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachineFactory;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.provider.StatemachineEditPlugin;
+
+
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+
+
+/**
+ * This is a simple wizard for creating a new model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StatemachineModelWizard extends Wizard implements INewWizard {
+ /**
+ * The supported extensions for created files.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<String> FILE_EXTENSIONS =
+ Collections.unmodifiableList(Arrays.asList(StatemachineEditorPlugin.INSTANCE.getString("_UI_StatemachineEditorFilenameExtensions").split("\\s*,\\s*")));
+
+ /**
+ * A formatted list of supported file extensions, suitable for display.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String FORMATTED_FILE_EXTENSIONS =
+ StatemachineEditorPlugin.INSTANCE.getString("_UI_StatemachineEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
+
+ /**
+ * This caches an instance of the model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StatemachinePackage statemachinePackage = StatemachinePackage.eINSTANCE;
+
+ /**
+ * This caches an instance of the model factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StatemachineFactory statemachineFactory = statemachinePackage.getStatemachineFactory();
+
+ /**
+ * This is the file creation page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StatemachineModelWizardNewFileCreationPage newFileCreationPage;
+
+ /**
+ * This is the initial object creation page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StatemachineModelWizardInitialObjectCreationPage initialObjectCreationPage;
+
+ /**
+ * Remember the selection during initialization for populating the default container.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * Remember the workbench during initialization.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWorkbench workbench;
+
+ /**
+ * Caches the names of the types that can be created as the root object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected List<String> initialObjectNames;
+
+ /**
+ * This just records the information.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(StatemachineEditorPlugin.INSTANCE.getString("_UI_Wizard_label"));
+ setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(StatemachineEditorPlugin.INSTANCE.getImage("full/wizban/NewStatemachine")));
+ }
+
+ /**
+ * Returns the names of the types that can be created as the root object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<String> getInitialObjectNames() {
+ if (initialObjectNames == null) {
+ initialObjectNames = new ArrayList<String>();
+ for (EClassifier eClassifier : statemachinePackage.getEClassifiers()) {
+ if (eClassifier instanceof EClass) {
+ EClass eClass = (EClass)eClassifier;
+ if (!eClass.isAbstract()) {
+ initialObjectNames.add(eClass.getName());
+ }
+ }
+ }
+ Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
+ }
+ return initialObjectNames;
+ }
+
+ /**
+ * Create a new model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EObject createInitialModel() {
+ EClass eClass = (EClass)statemachinePackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
+ EObject rootObject = statemachineFactory.create(eClass);
+ return rootObject;
+ }
+
+ /**
+ * Do the work after everything is specified.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean performFinish() {
+ try {
+ // Remember the file.
+ //
+ final IFile modelFile = getModelFile();
+
+ // Do the work within an operation.
+ //
+ WorkspaceModifyOperation operation =
+ new WorkspaceModifyOperation() {
+ @Override
+ protected void execute(IProgressMonitor progressMonitor) {
+ try {
+ // Create a resource set
+ //
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ //
+ URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
+
+ // Create a resource for this file.
+ //
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the initial model object to the contents.
+ //
+ EObject rootObject = createInitialModel();
+ if (rootObject != null) {
+ resource.getContents().add(rootObject);
+ }
+
+ // Save the contents of the resource to the file system.
+ //
+ Map<Object, Object> options = new HashMap<Object, Object>();
+ options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
+ resource.save(options);
+ }
+ catch (Exception exception) {
+ StatemachineEditorPlugin.INSTANCE.log(exception);
+ }
+ finally {
+ progressMonitor.done();
+ }
+ }
+ };
+
+ getContainer().run(false, false, operation);
+
+ // Select the new file resource in the current view.
+ //
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ final IWorkbenchPart activePart = page.getActivePart();
+ if (activePart instanceof ISetSelectionTarget) {
+ final ISelection targetSelection = new StructuredSelection(modelFile);
+ getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
+ }
+ });
+ }
+
+ // Open an editor on the new file.
+ //
+ try {
+ page.openEditor
+ (new FileEditorInput(modelFile),
+ workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
+ }
+ catch (PartInitException exception) {
+ MessageDialog.openError(workbenchWindow.getShell(), StatemachineEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+ catch (Exception exception) {
+ StatemachineEditorPlugin.INSTANCE.log(exception);
+ return false;
+ }
+ }
+
+ /**
+ * This is the one page of the wizard.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class StatemachineModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
+ /**
+ * Pass in the selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
+ super(pageId, selection);
+ }
+
+ /**
+ * The framework calls this to see if the file is correct.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected boolean validatePage() {
+ if (super.validatePage()) {
+ String extension = new Path(getFileName()).getFileExtension();
+ if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
+ String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
+ setErrorMessage(StatemachineEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IFile getModelFile() {
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
+ }
+ }
+
+ /**
+ * This is the page where the type of object to create is selected.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class StatemachineModelWizardInitialObjectCreationPage extends WizardPage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Combo initialObjectField;
+
+ /**
+ * @generated
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected List<String> encodings;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Combo encodingField;
+
+ /**
+ * Pass in the selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineModelWizardInitialObjectCreationPage(String pageId) {
+ super(pageId);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 12;
+ composite.setLayout(layout);
+
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+ }
+
+ Label containerLabel = new Label(composite, SWT.LEFT);
+ {
+ containerLabel.setText(StatemachineEditorPlugin.INSTANCE.getString("_UI_ModelObject"));
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ containerLabel.setLayoutData(data);
+ }
+
+ initialObjectField = new Combo(composite, SWT.BORDER);
+ {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ initialObjectField.setLayoutData(data);
+ }
+
+ for (String objectName : getInitialObjectNames()) {
+ initialObjectField.add(getLabel(objectName));
+ }
+
+ if (initialObjectField.getItemCount() == 1) {
+ initialObjectField.select(0);
+ }
+ initialObjectField.addModifyListener(validator);
+
+ Label encodingLabel = new Label(composite, SWT.LEFT);
+ {
+ encodingLabel.setText(StatemachineEditorPlugin.INSTANCE.getString("_UI_XMLEncoding"));
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ encodingLabel.setLayoutData(data);
+ }
+ encodingField = new Combo(composite, SWT.BORDER);
+ {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ encodingField.setLayoutData(data);
+ }
+
+ for (String encoding : getEncodings()) {
+ encodingField.add(encoding);
+ }
+
+ encodingField.select(0);
+ encodingField.addModifyListener(validator);
+
+ setPageComplete(validatePage());
+ setControl(composite);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ModifyListener validator =
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ };
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean validatePage() {
+ return getInitialObjectName() != null && getEncodings().contains(encodingField.getText());
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ if (initialObjectField.getItemCount() == 1) {
+ initialObjectField.clearSelection();
+ encodingField.setFocus();
+ }
+ else {
+ encodingField.clearSelection();
+ initialObjectField.setFocus();
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getInitialObjectName() {
+ String label = initialObjectField.getText();
+
+ for (String name : getInitialObjectNames()) {
+ if (getLabel(name).equals(label)) {
+ return name;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getEncoding() {
+ return encodingField.getText();
+ }
+
+ /**
+ * Returns the label for the specified type name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected String getLabel(String typeName) {
+ try {
+ return StatemachineEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
+ }
+ catch(MissingResourceException mre) {
+ StatemachineEditorPlugin.INSTANCE.log(mre);
+ }
+ return typeName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<String> getEncodings() {
+ if (encodings == null) {
+ encodings = new ArrayList<String>();
+ for (StringTokenizer stringTokenizer = new StringTokenizer(StatemachineEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) {
+ encodings.add(stringTokenizer.nextToken());
+ }
+ }
+ return encodings;
+ }
+ }
+
+ /**
+ * The framework calls this to create the contents of the wizard.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void addPages() {
+ // Create a page, set the title, and the initial model file name.
+ //
+ newFileCreationPage = new StatemachineModelWizardNewFileCreationPage("Whatever", selection);
+ newFileCreationPage.setTitle(StatemachineEditorPlugin.INSTANCE.getString("_UI_StatemachineModelWizard_label"));
+ newFileCreationPage.setDescription(StatemachineEditorPlugin.INSTANCE.getString("_UI_StatemachineModelWizard_description"));
+ newFileCreationPage.setFileName(StatemachineEditorPlugin.INSTANCE.getString("_UI_StatemachineEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
+ addPage(newFileCreationPage);
+
+ // Try and get the resource selection to determine a current directory for the file dialog.
+ //
+ if (selection != null && !selection.isEmpty()) {
+ // Get the resource...
+ //
+ Object selectedElement = selection.iterator().next();
+ if (selectedElement instanceof IResource) {
+ // Get the resource parent, if its a file.
+ //
+ IResource selectedResource = (IResource)selectedElement;
+ if (selectedResource.getType() == IResource.FILE) {
+ selectedResource = selectedResource.getParent();
+ }
+
+ // This gives us a directory...
+ //
+ if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
+ // Set this for the container.
+ //
+ newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
+
+ // Make up a unique new name here.
+ //
+ String defaultModelBaseFilename = StatemachineEditorPlugin.INSTANCE.getString("_UI_StatemachineEditorFilenameDefaultBase");
+ String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
+ String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
+ for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
+ modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
+ }
+ newFileCreationPage.setFileName(modelFilename);
+ }
+ }
+ }
+ initialObjectCreationPage = new StatemachineModelWizardInitialObjectCreationPage("Whatever2");
+ initialObjectCreationPage.setTitle(StatemachineEditorPlugin.INSTANCE.getString("_UI_StatemachineModelWizard_label"));
+ initialObjectCreationPage.setDescription(StatemachineEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
+ addPage(initialObjectCreationPage);
+ }
+
+ /**
+ * Get the file from the page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IFile getModelFile() {
+ return newFileCreationPage.getModelFile();
+ }
+
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.classpath b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.classpath
new file mode 100644
index 0000000..e801ebf
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.classpath
@@ -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-11"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.project b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.project
new file mode 100644
index 0000000..8ed0aab
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget</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>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c9545f0
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,9 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
+org.eclipse.jdt.core.compiler.compliance=11
+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=11
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/META-INF/MANIFEST.MF b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8fb83ff
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Widget
+Bundle-SymbolicName: org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Automatic-Module-Name: org.eclipse.epsilon.sirius.widget.examples.statemachine.widget
+Bundle-RequiredExecutionEnvironment: JavaSE-11
+Require-Bundle: org.eclipse.epsilon.sirius.widget,
+ org.eclipse.epsilon.sirius.widget.examples.statemachine
+Bundle-ActivationPolicy: lazy
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/build.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/plugin.xml b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/plugin.xml
new file mode 100644
index 0000000..b00df38
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/plugin.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.epsilon.sirius.widget">
+ <client
+ class="org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget.StatemachineWidget">
+ </client>
+ </extension>
+</plugin>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/eol/widget/StatemachineWidget.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/eol/widget/StatemachineWidget.java
new file mode 100644
index 0000000..ecf565e
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/eol/widget/StatemachineWidget.java
@@ -0,0 +1,50 @@
+/*********************************************************************
+* Copyright (c) 2021 The University of York.
+*
+* This program and the accompanying materials are made
+* available under the terms of the Eclipse Public License 2.0
+* which is available at https://www.eclipse.org/legal/epl-2.0/
+*
+* SPDX-License-Identifier: EPL-2.0
+**********************************************************************/
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget;
+
+import org.eclipse.epsilon.sirius.widget.eol.AbstractEolEditorWidget;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.State;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition;
+
+public class StatemachineWidget extends AbstractEolEditorWidget {
+
+ private NamedElement namedElement;
+
+ @Override
+ public void load() {
+ if (namedElement == null) {
+ namedElement = (NamedElement) this.variableManager.getVariables().get("self");
+ }
+
+ if (namedElement instanceof State) {
+ if (((State) namedElement).getAction() != null) {
+ viewer.getTextWidget().setText(((State) namedElement).getAction());
+ }
+ } else if (namedElement instanceof Transition) {
+ if (((Transition) namedElement).getGuard() != null) {
+ viewer.getTextWidget().setText(((Transition) namedElement).getGuard());
+ }
+ }
+
+ }
+
+ @Override
+ public void save(String text) {
+ this.editingContextAdapter.performModelChange(() -> {
+ if (namedElement instanceof State) {
+ ((State) namedElement).setAction(text);
+ } else if (namedElement instanceof Transition) {
+ ((Transition) namedElement).setGuard(text);
+ }
+ });
+
+ }
+}
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/.classpath b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/.classpath
new file mode 100644
index 0000000..c3ba59e
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/.project b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/.project
new file mode 100644
index 0000000..f71ef37
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.epsilon.sirius.widget.examples.statemachine</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/EOL State Machine.launch b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/EOL State Machine.launch
new file mode 100644
index 0000000..483b605
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/EOL State Machine.launch
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
+ <booleanAttribute key="append.args" value="true"/>
+ <booleanAttribute key="askclear" value="true"/>
+ <booleanAttribute key="automaticAdd" value="true"/>
+ <booleanAttribute key="automaticValidate" value="true"/>
+ <stringAttribute key="bootstrap" value=""/>
+ <stringAttribute key="checked" value="[NONE]"/>
+ <booleanAttribute key="clearConfig" value="true"/>
+ <booleanAttribute key="clearws" value="false"/>
+ <booleanAttribute key="clearwslog" value="false"/>
+ <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/EOL State Machine"/>
+ <booleanAttribute key="default" value="true"/>
+ <booleanAttribute key="includeOptional" value="true"/>
+ <stringAttribute key="location" value="${workspace_loc}/../runtime-EOLStateMachine"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+ <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+ <stringAttribute key="pde.version" value="3.3"/>
+ <stringAttribute key="product" value="org.eclipse.platform.ide"/>
+ <booleanAttribute key="show_selected_only" value="false"/>
+ <stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
+ <booleanAttribute key="tracing" value="false"/>
+ <booleanAttribute key="useCustomFeatures" value="false"/>
+ <booleanAttribute key="useDefaultConfig" value="true"/>
+ <booleanAttribute key="useDefaultConfigArea" value="true"/>
+ <booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/META-INF/MANIFEST.MF b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2443295
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.epsilon.sirius.widget.examples.statemachine;singleton:=true
+Automatic-Module-Name: org.eclipse.epsilon.sirius.widget.examples.statemachine
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.epsilon.sirius.widget.examples.statemachine,
+ org.eclipse.epsilon.sirius.widget.examples.statemachine.impl,
+ org.eclipse.epsilon.sirius.widget.examples.statemachine.util
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/build.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/build.properties
new file mode 100644
index 0000000..4465407
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/build.properties
@@ -0,0 +1,10 @@
+#
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.ecore b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.ecore
new file mode 100644
index 0000000..13b8369
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.ecore
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="statemachine" nsURI="http://www.eclipse.org/epsilon/statemachine"
+ nsPrefix="statemachine">
+ <eClassifiers xsi:type="ecore:EClass" name="StateMachine">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="initialState" eType="#//InitialState"
+ containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="transitions" upperBound="-1"
+ eType="#//Transition" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="states" upperBound="-1"
+ eType="#//State" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NamedElement">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="State" eSuperTypes="#//NamedElement">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="action" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="outgoing" upperBound="-1"
+ eType="#//Transition" eOpposite="#//Transition/from"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="incoming" upperBound="-1"
+ eType="#//Transition" eOpposite="#//Transition/to"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="InitialState" eSuperTypes="#//State"/>
+ <eClassifiers xsi:type="ecore:EClass" name="FinalState" eSuperTypes="#//State"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Transition" eSuperTypes="#//NamedElement">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="to" eType="#//State" eOpposite="#//State/incoming"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="from" eType="#//State"
+ eOpposite="#//State/outgoing"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="guard" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.emf b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.emf
new file mode 100644
index 0000000..cb6e6d9
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.emf
@@ -0,0 +1,32 @@
+@namespace(uri="http://www.eclipse.org/epsilon/statemachine", prefix="statemachine")
+package statemachine;
+
+class StateMachine {
+ val InitialState initialState;
+ val Transition[*] transitions;
+ val State[*] states;
+}
+
+class NamedElement {
+ attr String name;
+}
+
+class State extends NamedElement {
+ attr String action;
+ ref Transition[*]#from outgoing;
+ ref Transition[*]#to incoming;
+}
+
+class InitialState extends State {
+
+}
+
+class FinalState extends State {
+
+}
+
+class Transition extends NamedElement {
+ ref State#incoming to;
+ ref State#outgoing from;
+ attr String guard;
+}
\ No newline at end of file
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.genmodel b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.genmodel
new file mode 100644
index 0000000..c2795c9
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/model/statemachine.genmodel
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="* Copyright (c) 2021 The University of York.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0"
+ modelDirectory="/org.eclipse.epsilon.sirius.widget.examples.statemachine/src"
+ modelPluginID="org.eclipse.epsilon.sirius.widget.examples.statemachine" modelName="Statemachine"
+ rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" testsDirectory=""
+ testSuiteClass="" importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0"
+ copyrightFields="false" testsPluginID="org.eclipse.epsilon.sirius.widget.examples.statemachine.tests"
+ operationReflection="true" importOrganizing="true">
+ <foreignModel>statemachine.ecore</foreignModel>
+ <genPackages prefix="Statemachine" basePackage="org.eclipse.epsilon.sirius.widget.examples"
+ disposableProviderFactory="true" generateExampleClass="false" ecorePackage="statemachine.ecore#/">
+ <genClasses ecoreClass="statemachine.ecore#//StateMachine">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference statemachine.ecore#//StateMachine/initialState"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference statemachine.ecore#//StateMachine/transitions"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference statemachine.ecore#//StateMachine/states"/>
+ </genClasses>
+ <genClasses ecoreClass="statemachine.ecore#//NamedElement">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute statemachine.ecore#//NamedElement/name"/>
+ </genClasses>
+ <genClasses ecoreClass="statemachine.ecore#//State">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute statemachine.ecore#//State/action"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference statemachine.ecore#//State/outgoing"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference statemachine.ecore#//State/incoming"/>
+ </genClasses>
+ <genClasses ecoreClass="statemachine.ecore#//InitialState"/>
+ <genClasses ecoreClass="statemachine.ecore#//FinalState"/>
+ <genClasses ecoreClass="statemachine.ecore#//Transition">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference statemachine.ecore#//Transition/to"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference statemachine.ecore#//Transition/from"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute statemachine.ecore#//Transition/guard"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/plugin.properties b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/plugin.properties
new file mode 100644
index 0000000..492d48c
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = Statemachine Model
+providerName = www.example.org
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/plugin.xml b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/plugin.xml
new file mode 100644
index 0000000..24a8276
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/plugin.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <!-- @generated statemachine -->
+ <package
+ uri="http://www.eclipse.org/epsilon/statemachine"
+ class="org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage"
+ genModel="model/statemachine.genmodel"/>
+ </extension>
+
+</plugin>
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/FinalState.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/FinalState.java
new file mode 100644
index 0000000..2726381
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/FinalState.java
@@ -0,0 +1,24 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Final State</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getFinalState()
+ * @model
+ * @generated
+ */
+public interface FinalState extends State {
+} // FinalState
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/InitialState.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/InitialState.java
new file mode 100644
index 0000000..9e07e6b
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/InitialState.java
@@ -0,0 +1,24 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Initial State</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getInitialState()
+ * @model
+ * @generated
+ */
+public interface InitialState extends State {
+} // InitialState
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/NamedElement.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/NamedElement.java
new file mode 100644
index 0000000..8b626cc
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/NamedElement.java
@@ -0,0 +1,53 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Named Element</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement#getName <em>Name</em>}</li>
+ * </ul>
+ *
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getNamedElement()
+ * @model
+ * @generated
+ */
+public interface NamedElement extends EObject {
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getNamedElement_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // NamedElement
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/State.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/State.java
new file mode 100644
index 0000000..ea1d375
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/State.java
@@ -0,0 +1,83 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>State</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getAction <em>Action</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getOutgoing <em>Outgoing</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getIncoming <em>Incoming</em>}</li>
+ * </ul>
+ *
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getState()
+ * @model
+ * @generated
+ */
+public interface State extends NamedElement {
+ /**
+ * Returns the value of the '<em><b>Action</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Action</em>' attribute.
+ * @see #setAction(String)
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getState_Action()
+ * @model
+ * @generated
+ */
+ String getAction();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getAction <em>Action</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Action</em>' attribute.
+ * @see #getAction()
+ * @generated
+ */
+ void setAction(String value);
+
+ /**
+ * Returns the value of the '<em><b>Outgoing</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getFrom <em>From</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Outgoing</em>' reference list.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getState_Outgoing()
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getFrom
+ * @model opposite="from"
+ * @generated
+ */
+ EList<Transition> getOutgoing();
+
+ /**
+ * Returns the value of the '<em><b>Incoming</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition}.
+ * It is bidirectional and its opposite is '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getTo <em>To</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Incoming</em>' reference list.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getState_Incoming()
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getTo
+ * @model opposite="to"
+ * @generated
+ */
+ EList<Transition> getIncoming();
+
+} // State
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StateMachine.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StateMachine.java
new file mode 100644
index 0000000..be8f2ba
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StateMachine.java
@@ -0,0 +1,81 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>State Machine</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getInitialState <em>Initial State</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getTransitions <em>Transitions</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getStates <em>States</em>}</li>
+ * </ul>
+ *
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getStateMachine()
+ * @model
+ * @generated
+ */
+public interface StateMachine extends EObject {
+ /**
+ * Returns the value of the '<em><b>Initial State</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Initial State</em>' containment reference.
+ * @see #setInitialState(InitialState)
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getStateMachine_InitialState()
+ * @model containment="true"
+ * @generated
+ */
+ InitialState getInitialState();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getInitialState <em>Initial State</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Initial State</em>' containment reference.
+ * @see #getInitialState()
+ * @generated
+ */
+ void setInitialState(InitialState value);
+
+ /**
+ * Returns the value of the '<em><b>Transitions</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Transitions</em>' containment reference list.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getStateMachine_Transitions()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Transition> getTransitions();
+
+ /**
+ * Returns the value of the '<em><b>States</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>States</em>' containment reference list.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getStateMachine_States()
+ * @model containment="true"
+ * @generated
+ */
+ EList<State> getStates();
+
+} // StateMachine
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StatemachineFactory.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StatemachineFactory.java
new file mode 100644
index 0000000..9943b56
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StatemachineFactory.java
@@ -0,0 +1,94 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage
+ * @generated
+ */
+public interface StatemachineFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ StatemachineFactory eINSTANCE = org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachineFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>State Machine</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>State Machine</em>'.
+ * @generated
+ */
+ StateMachine createStateMachine();
+
+ /**
+ * Returns a new object of class '<em>Named Element</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Named Element</em>'.
+ * @generated
+ */
+ NamedElement createNamedElement();
+
+ /**
+ * Returns a new object of class '<em>State</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>State</em>'.
+ * @generated
+ */
+ State createState();
+
+ /**
+ * Returns a new object of class '<em>Initial State</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Initial State</em>'.
+ * @generated
+ */
+ InitialState createInitialState();
+
+ /**
+ * Returns a new object of class '<em>Final State</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Final State</em>'.
+ * @generated
+ */
+ FinalState createFinalState();
+
+ /**
+ * Returns a new object of class '<em>Transition</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Transition</em>'.
+ * @generated
+ */
+ Transition createTransition();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ StatemachinePackage getStatemachinePackage();
+
+} //StatemachineFactory
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StatemachinePackage.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StatemachinePackage.java
new file mode 100644
index 0000000..996fedc
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/StatemachinePackage.java
@@ -0,0 +1,750 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each operation of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachineFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface StatemachinePackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "statemachine";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/epsilon/statemachine";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "statemachine";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ StatemachinePackage eINSTANCE = org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateMachineImpl <em>State Machine</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateMachineImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getStateMachine()
+ * @generated
+ */
+ int STATE_MACHINE = 0;
+
+ /**
+ * The feature id for the '<em><b>Initial State</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE_MACHINE__INITIAL_STATE = 0;
+
+ /**
+ * The feature id for the '<em><b>Transitions</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE_MACHINE__TRANSITIONS = 1;
+
+ /**
+ * The feature id for the '<em><b>States</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE_MACHINE__STATES = 2;
+
+ /**
+ * The number of structural features of the '<em>State Machine</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE_MACHINE_FEATURE_COUNT = 3;
+
+ /**
+ * The number of operations of the '<em>State Machine</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE_MACHINE_OPERATION_COUNT = 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.NamedElementImpl <em>Named Element</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.NamedElementImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getNamedElement()
+ * @generated
+ */
+ int NAMED_ELEMENT = 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NAMED_ELEMENT__NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Named Element</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NAMED_ELEMENT_FEATURE_COUNT = 1;
+
+ /**
+ * The number of operations of the '<em>Named Element</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int NAMED_ELEMENT_OPERATION_COUNT = 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateImpl <em>State</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getState()
+ * @generated
+ */
+ int STATE = 2;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE__NAME = NAMED_ELEMENT__NAME;
+
+ /**
+ * The feature id for the '<em><b>Action</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE__ACTION = NAMED_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Outgoing</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE__OUTGOING = NAMED_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Incoming</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE__INCOMING = NAMED_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>State</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE_FEATURE_COUNT = NAMED_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The number of operations of the '<em>State</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STATE_OPERATION_COUNT = NAMED_ELEMENT_OPERATION_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.InitialStateImpl <em>Initial State</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.InitialStateImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getInitialState()
+ * @generated
+ */
+ int INITIAL_STATE = 3;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INITIAL_STATE__NAME = STATE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Action</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INITIAL_STATE__ACTION = STATE__ACTION;
+
+ /**
+ * The feature id for the '<em><b>Outgoing</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INITIAL_STATE__OUTGOING = STATE__OUTGOING;
+
+ /**
+ * The feature id for the '<em><b>Incoming</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INITIAL_STATE__INCOMING = STATE__INCOMING;
+
+ /**
+ * The number of structural features of the '<em>Initial State</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INITIAL_STATE_FEATURE_COUNT = STATE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of operations of the '<em>Initial State</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INITIAL_STATE_OPERATION_COUNT = STATE_OPERATION_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.FinalStateImpl <em>Final State</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.FinalStateImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getFinalState()
+ * @generated
+ */
+ int FINAL_STATE = 4;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FINAL_STATE__NAME = STATE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Action</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FINAL_STATE__ACTION = STATE__ACTION;
+
+ /**
+ * The feature id for the '<em><b>Outgoing</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FINAL_STATE__OUTGOING = STATE__OUTGOING;
+
+ /**
+ * The feature id for the '<em><b>Incoming</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FINAL_STATE__INCOMING = STATE__INCOMING;
+
+ /**
+ * The number of structural features of the '<em>Final State</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FINAL_STATE_FEATURE_COUNT = STATE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of operations of the '<em>Final State</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int FINAL_STATE_OPERATION_COUNT = STATE_OPERATION_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.TransitionImpl <em>Transition</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.TransitionImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getTransition()
+ * @generated
+ */
+ int TRANSITION = 5;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TRANSITION__NAME = NAMED_ELEMENT__NAME;
+
+ /**
+ * The feature id for the '<em><b>To</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TRANSITION__TO = NAMED_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>From</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TRANSITION__FROM = NAMED_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Guard</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TRANSITION__GUARD = NAMED_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Transition</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TRANSITION_FEATURE_COUNT = NAMED_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The number of operations of the '<em>Transition</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TRANSITION_OPERATION_COUNT = NAMED_ELEMENT_OPERATION_COUNT + 0;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine <em>State Machine</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>State Machine</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine
+ * @generated
+ */
+ EClass getStateMachine();
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getInitialState <em>Initial State</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Initial State</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getInitialState()
+ * @see #getStateMachine()
+ * @generated
+ */
+ EReference getStateMachine_InitialState();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getTransitions <em>Transitions</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Transitions</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getTransitions()
+ * @see #getStateMachine()
+ * @generated
+ */
+ EReference getStateMachine_Transitions();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getStates <em>States</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>States</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine#getStates()
+ * @see #getStateMachine()
+ * @generated
+ */
+ EReference getStateMachine_States();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement <em>Named Element</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Named Element</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement
+ * @generated
+ */
+ EClass getNamedElement();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement#getName()
+ * @see #getNamedElement()
+ * @generated
+ */
+ EAttribute getNamedElement_Name();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State <em>State</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>State</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.State
+ * @generated
+ */
+ EClass getState();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getAction <em>Action</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Action</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getAction()
+ * @see #getState()
+ * @generated
+ */
+ EAttribute getState_Action();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getOutgoing <em>Outgoing</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Outgoing</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getOutgoing()
+ * @see #getState()
+ * @generated
+ */
+ EReference getState_Outgoing();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getIncoming <em>Incoming</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Incoming</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getIncoming()
+ * @see #getState()
+ * @generated
+ */
+ EReference getState_Incoming();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState <em>Initial State</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Initial State</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState
+ * @generated
+ */
+ EClass getInitialState();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState <em>Final State</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Final State</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState
+ * @generated
+ */
+ EClass getFinalState();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition <em>Transition</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Transition</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition
+ * @generated
+ */
+ EClass getTransition();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getTo <em>To</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>To</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getTo()
+ * @see #getTransition()
+ * @generated
+ */
+ EReference getTransition_To();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getFrom <em>From</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>From</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getFrom()
+ * @see #getTransition()
+ * @generated
+ */
+ EReference getTransition_From();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getGuard <em>Guard</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Guard</em>'.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getGuard()
+ * @see #getTransition()
+ * @generated
+ */
+ EAttribute getTransition_Guard();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ StatemachineFactory getStatemachineFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each operation of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateMachineImpl <em>State Machine</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateMachineImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getStateMachine()
+ * @generated
+ */
+ EClass STATE_MACHINE = eINSTANCE.getStateMachine();
+
+ /**
+ * The meta object literal for the '<em><b>Initial State</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference STATE_MACHINE__INITIAL_STATE = eINSTANCE.getStateMachine_InitialState();
+
+ /**
+ * The meta object literal for the '<em><b>Transitions</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference STATE_MACHINE__TRANSITIONS = eINSTANCE.getStateMachine_Transitions();
+
+ /**
+ * The meta object literal for the '<em><b>States</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference STATE_MACHINE__STATES = eINSTANCE.getStateMachine_States();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.NamedElementImpl <em>Named Element</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.NamedElementImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getNamedElement()
+ * @generated
+ */
+ EClass NAMED_ELEMENT = eINSTANCE.getNamedElement();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute NAMED_ELEMENT__NAME = eINSTANCE.getNamedElement_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateImpl <em>State</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getState()
+ * @generated
+ */
+ EClass STATE = eINSTANCE.getState();
+
+ /**
+ * The meta object literal for the '<em><b>Action</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute STATE__ACTION = eINSTANCE.getState_Action();
+
+ /**
+ * The meta object literal for the '<em><b>Outgoing</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference STATE__OUTGOING = eINSTANCE.getState_Outgoing();
+
+ /**
+ * The meta object literal for the '<em><b>Incoming</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference STATE__INCOMING = eINSTANCE.getState_Incoming();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.InitialStateImpl <em>Initial State</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.InitialStateImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getInitialState()
+ * @generated
+ */
+ EClass INITIAL_STATE = eINSTANCE.getInitialState();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.FinalStateImpl <em>Final State</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.FinalStateImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getFinalState()
+ * @generated
+ */
+ EClass FINAL_STATE = eINSTANCE.getFinalState();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.TransitionImpl <em>Transition</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.TransitionImpl
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StatemachinePackageImpl#getTransition()
+ * @generated
+ */
+ EClass TRANSITION = eINSTANCE.getTransition();
+
+ /**
+ * The meta object literal for the '<em><b>To</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference TRANSITION__TO = eINSTANCE.getTransition_To();
+
+ /**
+ * The meta object literal for the '<em><b>From</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference TRANSITION__FROM = eINSTANCE.getTransition_From();
+
+ /**
+ * The meta object literal for the '<em><b>Guard</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute TRANSITION__GUARD = eINSTANCE.getTransition_Guard();
+
+ }
+
+} //StatemachinePackage
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/Transition.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/Transition.java
new file mode 100644
index 0000000..87d7b13
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/Transition.java
@@ -0,0 +1,102 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Transition</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getTo <em>To</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getFrom <em>From</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getGuard <em>Guard</em>}</li>
+ * </ul>
+ *
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getTransition()
+ * @model
+ * @generated
+ */
+public interface Transition extends NamedElement {
+ /**
+ * Returns the value of the '<em><b>To</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getIncoming <em>Incoming</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>To</em>' reference.
+ * @see #setTo(State)
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getTransition_To()
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getIncoming
+ * @model opposite="incoming"
+ * @generated
+ */
+ State getTo();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getTo <em>To</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>To</em>' reference.
+ * @see #getTo()
+ * @generated
+ */
+ void setTo(State value);
+
+ /**
+ * Returns the value of the '<em><b>From</b></em>' reference.
+ * It is bidirectional and its opposite is '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getOutgoing <em>Outgoing</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>From</em>' reference.
+ * @see #setFrom(State)
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getTransition_From()
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.State#getOutgoing
+ * @model opposite="outgoing"
+ * @generated
+ */
+ State getFrom();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getFrom <em>From</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>From</em>' reference.
+ * @see #getFrom()
+ * @generated
+ */
+ void setFrom(State value);
+
+ /**
+ * Returns the value of the '<em><b>Guard</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Guard</em>' attribute.
+ * @see #setGuard(String)
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#getTransition_Guard()
+ * @model
+ * @generated
+ */
+ String getGuard();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition#getGuard <em>Guard</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Guard</em>' attribute.
+ * @see #getGuard()
+ * @generated
+ */
+ void setGuard(String value);
+
+} // Transition
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/FinalStateImpl.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/FinalStateImpl.java
new file mode 100644
index 0000000..b72cb85
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/FinalStateImpl.java
@@ -0,0 +1,44 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.impl;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Final State</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class FinalStateImpl extends StateImpl implements FinalState {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FinalStateImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return StatemachinePackage.Literals.FINAL_STATE;
+ }
+
+} //FinalStateImpl
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/InitialStateImpl.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/InitialStateImpl.java
new file mode 100644
index 0000000..2ac5dc9
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/InitialStateImpl.java
@@ -0,0 +1,44 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.impl;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Initial State</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class InitialStateImpl extends StateImpl implements InitialState {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected InitialStateImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return StatemachinePackage.Literals.INITIAL_STATE;
+ }
+
+} //InitialStateImpl
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/NamedElementImpl.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/NamedElementImpl.java
new file mode 100644
index 0000000..e2903af
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/NamedElementImpl.java
@@ -0,0 +1,170 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Named Element</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.NamedElementImpl#getName <em>Name</em>}</li>
+ * </ul>
+ *
+ * @generated
+ */
+public class NamedElementImpl extends MinimalEObjectImpl.Container implements NamedElement {
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NamedElementImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return StatemachinePackage.Literals.NAMED_ELEMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.NAMED_ELEMENT__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case StatemachinePackage.NAMED_ELEMENT__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case StatemachinePackage.NAMED_ELEMENT__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case StatemachinePackage.NAMED_ELEMENT__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case StatemachinePackage.NAMED_ELEMENT__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuilder result = new StringBuilder(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //NamedElementImpl
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StateImpl.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StateImpl.java
new file mode 100644
index 0000000..18968b4
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StateImpl.java
@@ -0,0 +1,281 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.State;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>State</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateImpl#getAction <em>Action</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateImpl#getOutgoing <em>Outgoing</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateImpl#getIncoming <em>Incoming</em>}</li>
+ * </ul>
+ *
+ * @generated
+ */
+public class StateImpl extends NamedElementImpl implements State {
+ /**
+ * The default value of the '{@link #getAction() <em>Action</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAction()
+ * @generated
+ * @ordered
+ */
+ protected static final String ACTION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getAction() <em>Action</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAction()
+ * @generated
+ * @ordered
+ */
+ protected String action = ACTION_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getOutgoing() <em>Outgoing</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOutgoing()
+ * @generated
+ * @ordered
+ */
+ protected EList<Transition> outgoing;
+
+ /**
+ * The cached value of the '{@link #getIncoming() <em>Incoming</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIncoming()
+ * @generated
+ * @ordered
+ */
+ protected EList<Transition> incoming;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StateImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return StatemachinePackage.Literals.STATE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getAction() {
+ return action;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setAction(String newAction) {
+ String oldAction = action;
+ action = newAction;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.STATE__ACTION, oldAction, action));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Transition> getOutgoing() {
+ if (outgoing == null) {
+ outgoing = new EObjectWithInverseResolvingEList<Transition>(Transition.class, this, StatemachinePackage.STATE__OUTGOING, StatemachinePackage.TRANSITION__FROM);
+ }
+ return outgoing;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Transition> getIncoming() {
+ if (incoming == null) {
+ incoming = new EObjectWithInverseResolvingEList<Transition>(Transition.class, this, StatemachinePackage.STATE__INCOMING, StatemachinePackage.TRANSITION__TO);
+ }
+ return incoming;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case StatemachinePackage.STATE__OUTGOING:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getOutgoing()).basicAdd(otherEnd, msgs);
+ case StatemachinePackage.STATE__INCOMING:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getIncoming()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case StatemachinePackage.STATE__OUTGOING:
+ return ((InternalEList<?>)getOutgoing()).basicRemove(otherEnd, msgs);
+ case StatemachinePackage.STATE__INCOMING:
+ return ((InternalEList<?>)getIncoming()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case StatemachinePackage.STATE__ACTION:
+ return getAction();
+ case StatemachinePackage.STATE__OUTGOING:
+ return getOutgoing();
+ case StatemachinePackage.STATE__INCOMING:
+ return getIncoming();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case StatemachinePackage.STATE__ACTION:
+ setAction((String)newValue);
+ return;
+ case StatemachinePackage.STATE__OUTGOING:
+ getOutgoing().clear();
+ getOutgoing().addAll((Collection<? extends Transition>)newValue);
+ return;
+ case StatemachinePackage.STATE__INCOMING:
+ getIncoming().clear();
+ getIncoming().addAll((Collection<? extends Transition>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case StatemachinePackage.STATE__ACTION:
+ setAction(ACTION_EDEFAULT);
+ return;
+ case StatemachinePackage.STATE__OUTGOING:
+ getOutgoing().clear();
+ return;
+ case StatemachinePackage.STATE__INCOMING:
+ getIncoming().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case StatemachinePackage.STATE__ACTION:
+ return ACTION_EDEFAULT == null ? action != null : !ACTION_EDEFAULT.equals(action);
+ case StatemachinePackage.STATE__OUTGOING:
+ return outgoing != null && !outgoing.isEmpty();
+ case StatemachinePackage.STATE__INCOMING:
+ return incoming != null && !incoming.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuilder result = new StringBuilder(super.toString());
+ result.append(" (action: ");
+ result.append(action);
+ result.append(')');
+ return result.toString();
+ }
+
+} //StateImpl
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StateMachineImpl.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StateMachineImpl.java
new file mode 100644
index 0000000..d862bbb
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StateMachineImpl.java
@@ -0,0 +1,265 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.State;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>State Machine</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateMachineImpl#getInitialState <em>Initial State</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateMachineImpl#getTransitions <em>Transitions</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.StateMachineImpl#getStates <em>States</em>}</li>
+ * </ul>
+ *
+ * @generated
+ */
+public class StateMachineImpl extends MinimalEObjectImpl.Container implements StateMachine {
+ /**
+ * The cached value of the '{@link #getInitialState() <em>Initial State</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInitialState()
+ * @generated
+ * @ordered
+ */
+ protected InitialState initialState;
+
+ /**
+ * The cached value of the '{@link #getTransitions() <em>Transitions</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTransitions()
+ * @generated
+ * @ordered
+ */
+ protected EList<Transition> transitions;
+
+ /**
+ * The cached value of the '{@link #getStates() <em>States</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStates()
+ * @generated
+ * @ordered
+ */
+ protected EList<State> states;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StateMachineImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return StatemachinePackage.Literals.STATE_MACHINE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InitialState getInitialState() {
+ return initialState;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetInitialState(InitialState newInitialState, NotificationChain msgs) {
+ InitialState oldInitialState = initialState;
+ initialState = newInitialState;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatemachinePackage.STATE_MACHINE__INITIAL_STATE, oldInitialState, newInitialState);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setInitialState(InitialState newInitialState) {
+ if (newInitialState != initialState) {
+ NotificationChain msgs = null;
+ if (initialState != null)
+ msgs = ((InternalEObject)initialState).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatemachinePackage.STATE_MACHINE__INITIAL_STATE, null, msgs);
+ if (newInitialState != null)
+ msgs = ((InternalEObject)newInitialState).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatemachinePackage.STATE_MACHINE__INITIAL_STATE, null, msgs);
+ msgs = basicSetInitialState(newInitialState, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.STATE_MACHINE__INITIAL_STATE, newInitialState, newInitialState));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Transition> getTransitions() {
+ if (transitions == null) {
+ transitions = new EObjectContainmentEList<Transition>(Transition.class, this, StatemachinePackage.STATE_MACHINE__TRANSITIONS);
+ }
+ return transitions;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<State> getStates() {
+ if (states == null) {
+ states = new EObjectContainmentEList<State>(State.class, this, StatemachinePackage.STATE_MACHINE__STATES);
+ }
+ return states;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case StatemachinePackage.STATE_MACHINE__INITIAL_STATE:
+ return basicSetInitialState(null, msgs);
+ case StatemachinePackage.STATE_MACHINE__TRANSITIONS:
+ return ((InternalEList<?>)getTransitions()).basicRemove(otherEnd, msgs);
+ case StatemachinePackage.STATE_MACHINE__STATES:
+ return ((InternalEList<?>)getStates()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case StatemachinePackage.STATE_MACHINE__INITIAL_STATE:
+ return getInitialState();
+ case StatemachinePackage.STATE_MACHINE__TRANSITIONS:
+ return getTransitions();
+ case StatemachinePackage.STATE_MACHINE__STATES:
+ return getStates();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case StatemachinePackage.STATE_MACHINE__INITIAL_STATE:
+ setInitialState((InitialState)newValue);
+ return;
+ case StatemachinePackage.STATE_MACHINE__TRANSITIONS:
+ getTransitions().clear();
+ getTransitions().addAll((Collection<? extends Transition>)newValue);
+ return;
+ case StatemachinePackage.STATE_MACHINE__STATES:
+ getStates().clear();
+ getStates().addAll((Collection<? extends State>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case StatemachinePackage.STATE_MACHINE__INITIAL_STATE:
+ setInitialState((InitialState)null);
+ return;
+ case StatemachinePackage.STATE_MACHINE__TRANSITIONS:
+ getTransitions().clear();
+ return;
+ case StatemachinePackage.STATE_MACHINE__STATES:
+ getStates().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case StatemachinePackage.STATE_MACHINE__INITIAL_STATE:
+ return initialState != null;
+ case StatemachinePackage.STATE_MACHINE__TRANSITIONS:
+ return transitions != null && !transitions.isEmpty();
+ case StatemachinePackage.STATE_MACHINE__STATES:
+ return states != null && !states.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //StateMachineImpl
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StatemachineFactoryImpl.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StatemachineFactoryImpl.java
new file mode 100644
index 0000000..d665c46
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StatemachineFactoryImpl.java
@@ -0,0 +1,157 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StatemachineFactoryImpl extends EFactoryImpl implements StatemachineFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static StatemachineFactory init() {
+ try {
+ StatemachineFactory theStatemachineFactory = (StatemachineFactory)EPackage.Registry.INSTANCE.getEFactory(StatemachinePackage.eNS_URI);
+ if (theStatemachineFactory != null) {
+ return theStatemachineFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new StatemachineFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case StatemachinePackage.STATE_MACHINE: return createStateMachine();
+ case StatemachinePackage.NAMED_ELEMENT: return createNamedElement();
+ case StatemachinePackage.STATE: return createState();
+ case StatemachinePackage.INITIAL_STATE: return createInitialState();
+ case StatemachinePackage.FINAL_STATE: return createFinalState();
+ case StatemachinePackage.TRANSITION: return createTransition();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StateMachine createStateMachine() {
+ StateMachineImpl stateMachine = new StateMachineImpl();
+ return stateMachine;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NamedElement createNamedElement() {
+ NamedElementImpl namedElement = new NamedElementImpl();
+ return namedElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public State createState() {
+ StateImpl state = new StateImpl();
+ return state;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InitialState createInitialState() {
+ InitialStateImpl initialState = new InitialStateImpl();
+ return initialState;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FinalState createFinalState() {
+ FinalStateImpl finalState = new FinalStateImpl();
+ return finalState;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Transition createTransition() {
+ TransitionImpl transition = new TransitionImpl();
+ return transition;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachinePackage getStatemachinePackage() {
+ return (StatemachinePackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static StatemachinePackage getPackage() {
+ return StatemachinePackage.eINSTANCE;
+ }
+
+} //StatemachineFactoryImpl
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StatemachinePackageImpl.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StatemachinePackageImpl.java
new file mode 100644
index 0000000..b5795d9
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/StatemachinePackageImpl.java
@@ -0,0 +1,393 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.State;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachineFactory;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class StatemachinePackageImpl extends EPackageImpl implements StatemachinePackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass stateMachineEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass namedElementEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass stateEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass initialStateEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass finalStateEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass transitionEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private StatemachinePackageImpl() {
+ super(eNS_URI, StatemachineFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link StatemachinePackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static StatemachinePackage init() {
+ if (isInited) return (StatemachinePackage)EPackage.Registry.INSTANCE.getEPackage(StatemachinePackage.eNS_URI);
+
+ // Obtain or create and register package
+ Object registeredStatemachinePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
+ StatemachinePackageImpl theStatemachinePackage = registeredStatemachinePackage instanceof StatemachinePackageImpl ? (StatemachinePackageImpl)registeredStatemachinePackage : new StatemachinePackageImpl();
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theStatemachinePackage.createPackageContents();
+
+ // Initialize created meta-data
+ theStatemachinePackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theStatemachinePackage.freeze();
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(StatemachinePackage.eNS_URI, theStatemachinePackage);
+ return theStatemachinePackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getStateMachine() {
+ return stateMachineEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getStateMachine_InitialState() {
+ return (EReference)stateMachineEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getStateMachine_Transitions() {
+ return (EReference)stateMachineEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getStateMachine_States() {
+ return (EReference)stateMachineEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getNamedElement() {
+ return namedElementEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getNamedElement_Name() {
+ return (EAttribute)namedElementEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getState() {
+ return stateEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getState_Action() {
+ return (EAttribute)stateEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getState_Outgoing() {
+ return (EReference)stateEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getState_Incoming() {
+ return (EReference)stateEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getInitialState() {
+ return initialStateEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getFinalState() {
+ return finalStateEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getTransition() {
+ return transitionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getTransition_To() {
+ return (EReference)transitionEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getTransition_From() {
+ return (EReference)transitionEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getTransition_Guard() {
+ return (EAttribute)transitionEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineFactory getStatemachineFactory() {
+ return (StatemachineFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ stateMachineEClass = createEClass(STATE_MACHINE);
+ createEReference(stateMachineEClass, STATE_MACHINE__INITIAL_STATE);
+ createEReference(stateMachineEClass, STATE_MACHINE__TRANSITIONS);
+ createEReference(stateMachineEClass, STATE_MACHINE__STATES);
+
+ namedElementEClass = createEClass(NAMED_ELEMENT);
+ createEAttribute(namedElementEClass, NAMED_ELEMENT__NAME);
+
+ stateEClass = createEClass(STATE);
+ createEAttribute(stateEClass, STATE__ACTION);
+ createEReference(stateEClass, STATE__OUTGOING);
+ createEReference(stateEClass, STATE__INCOMING);
+
+ initialStateEClass = createEClass(INITIAL_STATE);
+
+ finalStateEClass = createEClass(FINAL_STATE);
+
+ transitionEClass = createEClass(TRANSITION);
+ createEReference(transitionEClass, TRANSITION__TO);
+ createEReference(transitionEClass, TRANSITION__FROM);
+ createEAttribute(transitionEClass, TRANSITION__GUARD);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ stateEClass.getESuperTypes().add(this.getNamedElement());
+ initialStateEClass.getESuperTypes().add(this.getState());
+ finalStateEClass.getESuperTypes().add(this.getState());
+ transitionEClass.getESuperTypes().add(this.getNamedElement());
+
+ // Initialize classes, features, and operations; add parameters
+ initEClass(stateMachineEClass, StateMachine.class, "StateMachine", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getStateMachine_InitialState(), this.getInitialState(), null, "initialState", null, 0, 1, StateMachine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getStateMachine_Transitions(), this.getTransition(), null, "transitions", null, 0, -1, StateMachine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getStateMachine_States(), this.getState(), null, "states", null, 0, -1, StateMachine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(namedElementEClass, NamedElement.class, "NamedElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getNamedElement_Name(), ecorePackage.getEString(), "name", null, 0, 1, NamedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(stateEClass, State.class, "State", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getState_Action(), ecorePackage.getEString(), "action", null, 0, 1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getState_Outgoing(), this.getTransition(), this.getTransition_From(), "outgoing", null, 0, -1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getState_Incoming(), this.getTransition(), this.getTransition_To(), "incoming", null, 0, -1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(initialStateEClass, InitialState.class, "InitialState", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(finalStateEClass, FinalState.class, "FinalState", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(transitionEClass, Transition.class, "Transition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getTransition_To(), this.getState(), this.getState_Incoming(), "to", null, 0, 1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTransition_From(), this.getState(), this.getState_Outgoing(), "from", null, 0, 1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTransition_Guard(), ecorePackage.getEString(), "guard", null, 0, 1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //StatemachinePackageImpl
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/TransitionImpl.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/TransitionImpl.java
new file mode 100644
index 0000000..2810678
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/impl/TransitionImpl.java
@@ -0,0 +1,372 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.State;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage;
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Transition</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.TransitionImpl#getTo <em>To</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.TransitionImpl#getFrom <em>From</em>}</li>
+ * <li>{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.impl.TransitionImpl#getGuard <em>Guard</em>}</li>
+ * </ul>
+ *
+ * @generated
+ */
+public class TransitionImpl extends NamedElementImpl implements Transition {
+ /**
+ * The cached value of the '{@link #getTo() <em>To</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTo()
+ * @generated
+ * @ordered
+ */
+ protected State to;
+
+ /**
+ * The cached value of the '{@link #getFrom() <em>From</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFrom()
+ * @generated
+ * @ordered
+ */
+ protected State from;
+
+ /**
+ * The default value of the '{@link #getGuard() <em>Guard</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getGuard()
+ * @generated
+ * @ordered
+ */
+ protected static final String GUARD_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getGuard() <em>Guard</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getGuard()
+ * @generated
+ * @ordered
+ */
+ protected String guard = GUARD_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TransitionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return StatemachinePackage.Literals.TRANSITION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public State getTo() {
+ if (to != null && to.eIsProxy()) {
+ InternalEObject oldTo = (InternalEObject)to;
+ to = (State)eResolveProxy(oldTo);
+ if (to != oldTo) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, StatemachinePackage.TRANSITION__TO, oldTo, to));
+ }
+ }
+ return to;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public State basicGetTo() {
+ return to;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTo(State newTo, NotificationChain msgs) {
+ State oldTo = to;
+ to = newTo;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__TO, oldTo, newTo);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTo(State newTo) {
+ if (newTo != to) {
+ NotificationChain msgs = null;
+ if (to != null)
+ msgs = ((InternalEObject)to).eInverseRemove(this, StatemachinePackage.STATE__INCOMING, State.class, msgs);
+ if (newTo != null)
+ msgs = ((InternalEObject)newTo).eInverseAdd(this, StatemachinePackage.STATE__INCOMING, State.class, msgs);
+ msgs = basicSetTo(newTo, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__TO, newTo, newTo));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public State getFrom() {
+ if (from != null && from.eIsProxy()) {
+ InternalEObject oldFrom = (InternalEObject)from;
+ from = (State)eResolveProxy(oldFrom);
+ if (from != oldFrom) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, StatemachinePackage.TRANSITION__FROM, oldFrom, from));
+ }
+ }
+ return from;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public State basicGetFrom() {
+ return from;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetFrom(State newFrom, NotificationChain msgs) {
+ State oldFrom = from;
+ from = newFrom;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__FROM, oldFrom, newFrom);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setFrom(State newFrom) {
+ if (newFrom != from) {
+ NotificationChain msgs = null;
+ if (from != null)
+ msgs = ((InternalEObject)from).eInverseRemove(this, StatemachinePackage.STATE__OUTGOING, State.class, msgs);
+ if (newFrom != null)
+ msgs = ((InternalEObject)newFrom).eInverseAdd(this, StatemachinePackage.STATE__OUTGOING, State.class, msgs);
+ msgs = basicSetFrom(newFrom, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__FROM, newFrom, newFrom));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getGuard() {
+ return guard;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setGuard(String newGuard) {
+ String oldGuard = guard;
+ guard = newGuard;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__GUARD, oldGuard, guard));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case StatemachinePackage.TRANSITION__TO:
+ if (to != null)
+ msgs = ((InternalEObject)to).eInverseRemove(this, StatemachinePackage.STATE__INCOMING, State.class, msgs);
+ return basicSetTo((State)otherEnd, msgs);
+ case StatemachinePackage.TRANSITION__FROM:
+ if (from != null)
+ msgs = ((InternalEObject)from).eInverseRemove(this, StatemachinePackage.STATE__OUTGOING, State.class, msgs);
+ return basicSetFrom((State)otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case StatemachinePackage.TRANSITION__TO:
+ return basicSetTo(null, msgs);
+ case StatemachinePackage.TRANSITION__FROM:
+ return basicSetFrom(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case StatemachinePackage.TRANSITION__TO:
+ if (resolve) return getTo();
+ return basicGetTo();
+ case StatemachinePackage.TRANSITION__FROM:
+ if (resolve) return getFrom();
+ return basicGetFrom();
+ case StatemachinePackage.TRANSITION__GUARD:
+ return getGuard();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case StatemachinePackage.TRANSITION__TO:
+ setTo((State)newValue);
+ return;
+ case StatemachinePackage.TRANSITION__FROM:
+ setFrom((State)newValue);
+ return;
+ case StatemachinePackage.TRANSITION__GUARD:
+ setGuard((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case StatemachinePackage.TRANSITION__TO:
+ setTo((State)null);
+ return;
+ case StatemachinePackage.TRANSITION__FROM:
+ setFrom((State)null);
+ return;
+ case StatemachinePackage.TRANSITION__GUARD:
+ setGuard(GUARD_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case StatemachinePackage.TRANSITION__TO:
+ return to != null;
+ case StatemachinePackage.TRANSITION__FROM:
+ return from != null;
+ case StatemachinePackage.TRANSITION__GUARD:
+ return GUARD_EDEFAULT == null ? guard != null : !GUARD_EDEFAULT.equals(guard);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuilder result = new StringBuilder(super.toString());
+ result.append(" (guard: ");
+ result.append(guard);
+ result.append(')');
+ return result.toString();
+ }
+
+} //TransitionImpl
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/util/StatemachineAdapterFactory.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/util/StatemachineAdapterFactory.java
new file mode 100644
index 0000000..10bdd17
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/util/StatemachineAdapterFactory.java
@@ -0,0 +1,217 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage
+ * @generated
+ */
+public class StatemachineAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static StatemachinePackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = StatemachinePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected StatemachineSwitch<Adapter> modelSwitch =
+ new StatemachineSwitch<Adapter>() {
+ @Override
+ public Adapter caseStateMachine(StateMachine object) {
+ return createStateMachineAdapter();
+ }
+ @Override
+ public Adapter caseNamedElement(NamedElement object) {
+ return createNamedElementAdapter();
+ }
+ @Override
+ public Adapter caseState(State object) {
+ return createStateAdapter();
+ }
+ @Override
+ public Adapter caseInitialState(InitialState object) {
+ return createInitialStateAdapter();
+ }
+ @Override
+ public Adapter caseFinalState(FinalState object) {
+ return createFinalStateAdapter();
+ }
+ @Override
+ public Adapter caseTransition(Transition object) {
+ return createTransitionAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine <em>State Machine</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StateMachine
+ * @generated
+ */
+ public Adapter createStateMachineAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement <em>Named Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.NamedElement
+ * @generated
+ */
+ public Adapter createNamedElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.State <em>State</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.State
+ * @generated
+ */
+ public Adapter createStateAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState <em>Initial State</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.InitialState
+ * @generated
+ */
+ public Adapter createInitialStateAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState <em>Final State</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.FinalState
+ * @generated
+ */
+ public Adapter createFinalStateAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition <em>Transition</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.Transition
+ * @generated
+ */
+ public Adapter createTransitionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //StatemachineAdapterFactory
diff --git a/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/util/StatemachineSwitch.java b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/util/StatemachineSwitch.java
new file mode 100644
index 0000000..fc6ccf6
--- /dev/null
+++ b/examples/org.eclipse.epsilon.examples.sirius.eol/org.eclipse.epsilon.sirius.widget.examples.statemachine/src/org/eclipse/epsilon/sirius/widget/examples/statemachine/util/StatemachineSwitch.java
@@ -0,0 +1,228 @@
+/**
+ * * Copyright (c) 2021 The University of York.
+ * *
+ * * This program and the accompanying materials are made
+ * * available under the terms of the Eclipse Public License 2.0
+ * * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * *
+ * * SPDX-License-Identifier: EPL-2.0
+ */
+package org.eclipse.epsilon.sirius.widget.examples.statemachine.util;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+import org.eclipse.epsilon.sirius.widget.examples.statemachine.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.epsilon.sirius.widget.examples.statemachine.StatemachinePackage
+ * @generated
+ */
+public class StatemachineSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static StatemachinePackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public StatemachineSwitch() {
+ if (modelPackage == null) {
+ modelPackage = StatemachinePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case StatemachinePackage.STATE_MACHINE: {
+ StateMachine stateMachine = (StateMachine)theEObject;
+ T result = caseStateMachine(stateMachine);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StatemachinePackage.NAMED_ELEMENT: {
+ NamedElement namedElement = (NamedElement)theEObject;
+ T result = caseNamedElement(namedElement);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StatemachinePackage.STATE: {
+ State state = (State)theEObject;
+ T result = caseState(state);
+ if (result == null) result = caseNamedElement(state);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StatemachinePackage.INITIAL_STATE: {
+ InitialState initialState = (InitialState)theEObject;
+ T result = caseInitialState(initialState);
+ if (result == null) result = caseState(initialState);
+ if (result == null) result = caseNamedElement(initialState);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StatemachinePackage.FINAL_STATE: {
+ FinalState finalState = (FinalState)theEObject;
+ T result = caseFinalState(finalState);
+ if (result == null) result = caseState(finalState);
+ if (result == null) result = caseNamedElement(finalState);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StatemachinePackage.TRANSITION: {
+ Transition transition = (Transition)theEObject;
+ T result = caseTransition(transition);
+ if (result == null) result = caseNamedElement(transition);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>State Machine</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>State Machine</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStateMachine(StateMachine object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Named Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNamedElement(NamedElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>State</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>State</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseState(State object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Initial State</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Initial State</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseInitialState(InitialState object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Final State</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Final State</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFinalState(FinalState object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Transition</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Transition</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTransition(Transition object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //StatemachineSwitch