This repository contains a minimal example showing how to embed an EOL Editor into the properties view of a Sirius based modeller in the form of a state-machine language. In this example, states and transitions are specified graphically (Sirius), but guards in transitions and actions are specified textually (EOL). The EOL editor widget provides developer assistance mechanisms such as error markers and syntax highlighting. There is also a minimal example showing the execution of the state machine from within the model editor.
- Eclipse ≥ 2020-06
- Epsilon ≥ 2.0
- Sirius ≥ 6.3
- Ensure IDE installed with the prerequisites
- Clone repository
- Create new workspace
- Import all projects under plugins and example into the workspace
- Launch the provided Eclipse runtime configuration (EOL State Machine)
- Import the project under sample into the workspace
- Open the diagram (expand the
.statemachine
model in the model explorer and double click "new State Machine Diagram") - Right-click on the editor, and "Run State Machine"
- View EOL expressions by clicking on a state/transition in the editor, and then opening the EOL tab in the properties view
- Firstly, the metamodel needs to be modified to store EOL code in the model. In the state machine example, we are storing the EOL code in String attributes. See
org.eclipse.epsilon.sirius.widget.examples.statemachine
for more details. - You then need to create a new Eclipse plug-in for the widget. This plug-in should use the
org.eclipse.epsilon.sirius.widget
extension point and extend theAbstractEolEditorWidget
class to provide details of how to load and save the EOL expressions. Seeorg.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget
for more details. - You need to modify the Sirius viewpoint specification model (odesign) model to add the widget to the properties view. To do this:
- Right-click on the group (folder) in the odesign model and select New Properties > Extend Default Properties View.
- Under the category, create a new page and restrict the "Domain Class" to be model elements that contain EOL expressions.
- Create a new group under the category, again restrict the "Domain Class" to be model elements that contain EOL expressions.
- Go back to the page created above and then add the group created above to the page.
- Under the group, create a new Container, this container MUST have an Id of
eol
. - Under the container, create a new Custom Widget. This custom widget must have an Id of
org.eclipse.epsilon.sirius.widget
.
After making those changes, save and then launch a new runtime instance of Eclipse. You should now have an embedded EOL editor in your Sirius properties views.
We have provided a minimal example of running the state machine from within the editor.
- Define a tool in the Sirius viewpoint specification model (odesign model).
- Define logic in a Java service (Services.java located in the
src
directory of theorg.eclipse.epsilon.sirius.widget.examples.statemachine.design
plug-in) which then calls StatemachineJob.java.
Yes, you can create a widget which uses org.eclipse.epsilon.sirius.widget
extension point (as above), but extend AbstractXtextEditorWidget
rather than AbstractEolEditorWidget
.
You may want to read the white paper from Obeo and Typefox and also the Sirius documentation detailing how to embed custom widgets into Sirius properties views.