How to install and use the Statemachine-Editor

Available sections:

Overview

This plug-in for Eclipse allows you to create new statemachines and change existing statemachines in an graphical editor. You can open existing statemachines from a xml file or create a new statemachine in a new xml file.

This document will tell you how to install the plug-in for eclipse and how to use it.

How to Install the Statemachine-Editor

First of all you have to install Eclipse (Eclipse Classic) and the plug-in Graphical Editing Framework (GEF). Furthermore we need the packages JDOM (jdom.jar) and Java3D (vecmath.jar).

Caution: There have been problems reported with GEF runtime versions > 3.3.2. A known working configuration is: Eclipse SDK: 3.3.1 J3D: 1.5.1 Jdom: 1.0 GEF runtime: 3.3.2 Java Runtime Environment: jre6

Now you have to unzip the file StateMachines.zip into your eclipse folder. The file is located in your SVN checkout mitk.

Start Eclipse and select "File" -> "Import...".

Import.PNG

Fig.1: Import

In the popup window (Fig.1: Import) select the folder "Plug-in Development" and "Plug-ins and Fragments". Click "Next >".

Import2.PNG

Fig.2: Import Plug-ins and Fragments

On the page "Import Plug-ins and Fragments" ( Fig.2: Import Plug-ins and Fragments) just click "Next >".

Import3.PNG

Fig.3: Selection

On the page "Selection" ( Fig.3: Selection) select the "StateMachines (1.0.0)" Plug-in and click the "Add ->" button.

Import4.PNG

Fig.4: Selection 2

Click "Finish" ( Fig.4: Selection 2).

Now you have to make sure that the path to vecmath.jar and jdom.jar is set correctly.

BuildPath.PNG

Fig.5: Set build path

You can find the build path by selecting the project in the "Package Explorer" view. Then go to "Project" -> "Properties" -> "Java Build Path" in the tab "Libraries" (as you can see in Fig.5: Set build path).

Now you should be able to start a Run-time Workbench.

Runas.png

Fig.6: Start Run-time Workbench

Therefore you have to press the "Run" button and select "Eclipse Application". Click "OK" (Fig.6: Start Run-time Workbench).

A new Eclipse workbench opens where we can use the Statemachine-Editor.

How to use the Statemachine-Editor

In the Eclipse Run-time Workbench we have to create a new Java project first (Fig.7: Create a new Java project).

CreateJavaProject.PNG

Fig.7: Create a new Java project

Then you can select one of the two buttons:

New Statemachines

When you press the button "New Statemachine" the following window will pop up:

NewStatemachine.PNG

Fig.8: New Statemachine

Here, you have to "Browse..." for your Java-Project as your file container (Fig.8: New Statemachine).

NewStatemachine1.PNG

Fig.9: New Statemachine 1

Select your Project and click "OK" (Fig.9: New Statemachine 1).

NewStatemachine2.PNG

Fig.10: New Statemachine 2

As soon as you have selected a container and a File name, the "Finish" button will become enabled (Fig.10: New Statemachine 2).

Attention: If the filename has already been used, you have to set another filename to enable the "Finish" button.

NewStatemachine3.PNG

Fig.11: New Statemachine 3

As a last step you have to enter the location and name for the xml file to be generated (Fig.11: New Statemachine 3). If you want to have predefined events and actions, make sure the "mitkEventAndActionConstants.xml" file is in the same folder.

Read on in Section Work with the Editor.

Statemachines from *.xml

When you press the button "Statemachines from *.xml" the following window will pop up:

openstatemachinexml.png

Fig.12: Open Statemachine from *.xml

Here you have to select the xml file, which contains the statemachines (Fig.12: Open Statemachine from *.xml). If you want to have predefined events and actions, make sure the "mitkEventAndActionConstants.xml" file is in the same folder.

specifycontainer.png

Fig.13: Select container

Here, you have to "Browse..." for your Java-Project as your file container (Fig.13: Select container).

specifycontainer2.png

Fig.14: Select container 1

Select your Project and click "OK" (Fig.14: Select container 1).

specifycontainer3.png

Fig.15: Select container 2

As soon as you have selected a container, the "Finish" button will become enabled (Fig.15: Select container 2).

Read on in Section Work with the Editor.

Work with the Editor

Now your workspace looks something like this:

application.PNG

Fig.16: Workspace

You can open a statemachine from the "Statemachines List" view (Fig.16: Workspace) by performing a double click on the statemachine. An editor opens and on its palette you can find different tools, such as create state or create transition.

openPropertiesView.PNG

Fig.17: Open the properties view

application1.PNG

Fig.18: Change statename in the properties view

To edit the statename or state ID you have to open the "Properties" view (Fig.18: Change statename in the properties view). You will get it by "Window"->"Show View" -> "Other..." -> "General" -> "Properties" (Fig.17: Open the properties view).

changeEvent.PNG

Fig.19: Change Event

addAction.PNG

Fig.20: Add Action

To change a transitions event or action you have to select the transition and open its context menu (Fig.19: Change Event, Fig.20: Add Action). You can connect a transition to another state by drag one end of it and drop it to another state. All these changes are connected with an undo/redo controller.

When you save your statemachine it will be saved as an xml file which you either have created with your new statemachine or have opened before.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines