Testing the Model

Here is the catch, The TP2 instructions does not mention a lot of details about how to generate the FinalStateMachine creation wizard, because it is not a predefined option in Eclipse, you're the one who is supposed to create it.

In this section we will view how to generate our creation wizard.

circle-exclamation

Step 6.0: Preparing

Before proceeding to the next steps, ensure that our project/model folder contains a file named “FinalStateMachine.genmodel”, which is responsible for creation wizard plugin.

If you cannot find it, expand the “Creating a .genmodel file” guide below; otherwise, proceed to the next step.

chevron-rightCreating a .genmodel filehashtag

Right click on project root then click on New -> Other...

In "Eclipse Modeling Framework" select "EMF Generator Model" and press "Next"

Select model folder and set file name to "FiniteStateMachine.genmodel" then press "Next >" button

Select "Ecore model" and click next button.

Click on "Browse Workspace..." then select your .ecore file, click ok then click Next button.

Confirm root package to generate then click "Finish" button.

Finally, the FinalStateMachine.genmodel file will appear immediately in our project/model folder

Step 6.1: Generating the Creation Wizard

Right click on FiniteStateMachine.genmodel then Open with -> EMF Generator

then right click the project root and click "Generate All" option

Wait for Eclipse to finish generating all the files and the project directory tree should look like this:

Step 6.2: Starting Runtime Instance

to find the FiniteStateMachine creation wizard, we have first to start a runtime instance of Eclipse IDE on our project. Right click on project root then click on "Run As" then "Eclipse Application"

and wait for the new instance to open

Step 6.3: Creating a sample project.

after the the new Eclipse instance window appears we create a new empty project

you can give it a name, I will name it "AutomatonProject"

After creating the project we will create the sample automaton file by right-clicking the project root -> New -> Other...

And now we will find FiniteStateMachine Model in the "Example EMF Model Creation Wizards" folder

circle-info

Model Creation Wizard name depends on the main package name. In my case the main package name is FinalStateMachine. In teacher's case main package name is FinalStateMachine. In your case it might be FSMPackage or something else.

We will select it then press Next.

Now you can give your final state machine file a proper name

circle-info

File extension name depends on the main package name. In my case the main package name is FinalStateMachine. In teacher's case main package name is fsm. In your case it might be FSMPackage or something else. It doesn't matter since it has same principle, your file name must be [given name].[main package name]

Step 6.3: Creating Objects tree and validating.

As we see we have Automation object in here, we start making our objects tree and validating each time to confirm that we've respected our class diagram layout.

Last updated