Skip to content

Embedding EOL editors into Sirius-based graphical workbenches

License

Notifications You must be signed in to change notification settings

epsilonlabs/eol-sirius

Repository files navigation

Embedding the Epsilon Object Language (EOL) into Sirius

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.

example

Getting started

Prerequisites

  • Eclipse ≥ 2020-06
  • Epsilon ≥ 2.0
  • Sirius ≥ 6.3

Running the example

  1. Ensure IDE installed with the prerequisites
  2. Clone repository
  3. Create new workspace
  4. Import all projects under plugins and example into the workspace
  5. Launch the provided Eclipse runtime configuration (EOL State Machine)
  6. Import the project under sample into the workspace
  7. Open the diagram (expand the.statemachine model in the model explorer and double click "new State Machine Diagram") image
  8. Right-click on the editor, and "Run State Machine" image
  9. View EOL expressions by clicking on a state/transition in the editor, and then opening the EOL tab in the properties view image

Embedding an EOL editor into a Sirius modeller

  1. 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. image
  2. 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 the AbstractEolEditorWidget class to provide details of how to load and save the EOL expressions. See org.eclipse.epsilon.sirius.widget.examples.statemachine.eol.widget for more details.
  3. You need to modify the Sirius viewpoint specification model (odesign) model to add the widget to the properties view. To do this:
    1. Right-click on the group (folder) in the odesign model and select New Properties > Extend Default Properties View. image
    2. Under the category, create a new page and restrict the "Domain Class" to be model elements that contain EOL expressions. image image
    3. Create a new group under the category, again restrict the "Domain Class" to be model elements that contain EOL expressions. image image
    4. Go back to the page created above and then add the group created above to the page. image
    5. Under the group, create a new Container, this container MUST have an Id of eol. image image
    6. Under the container, create a new Custom Widget. This custom widget must have an Id of org.eclipse.epsilon.sirius.widget image. image

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.

Running EOL expressions in the editor

We have provided a minimal example of running the state machine from within the editor.

  1. Define a tool in the Sirius viewpoint specification model (odesign model).

image

  1. Define logic in a Java service (Services.java located in the src directory of the org.eclipse.epsilon.sirius.widget.examples.statemachine.design plug-in) which then calls StatemachineJob.java. image

Can I embed Xtext in Sirius?

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.

About

Embedding EOL editors into Sirius-based graphical workbenches

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages