This page gives an introduction into JTransformer and presents the first steps.
First of all, you need to download and install JTransformer. After a successful installation including a restart of Eclipse, the Eclipse menu will contain a JTransformer entry.
As a first step after installing JTransformer we recommended to use the
JT User perspective. You can open it from the menu JTransformer → JT User Perspective. This perspective contains the most important view of JTransformer, the Control Center, and also the Package Explorer and the Outline. The perspective should look like this.
JTransformer offers several small examples, so called Example Projects. These projects can be loaded into your workspace by selecting File → New → Example… → JTransformer Example Projects. You should then see the depicted dialog offering the example projects.
Select the following two projects:
- JTransformer Tutorial - Java Files containing Java code and
- JTransformer Tutorial - Prolog Files containing small example analyses and transformations.
The analyses from the second project will find several results in the first project.
After loading the example projects you need to activate JTransformer for the JT_Tutorial project. For this select the project in the package explorer, open the context menu and choose Configure → Assign JTransformer Factbase. A new dialog will be opened. For the purpose of this introduction you can use the default values in the dialog and click OK.
The activation of JTransformer for the project will trigger the initial generation of the factbase. After the generation is finished the project icon will have a green JT overlay . From then on JTransformer will automatically update the factbase each time any Java source code is modified in the project.
Once the initial generation of the factbase is finished select the newly created factbase named
JT_Tutorial in the Control Center. After the selection of the factbase the Control Center will show an empty table below the factbase selector, the analysis table. It lists all available analyses of the selected factbase, i.e. all analyses loaded in the factbase.
After selecting the factbase in the Control Center you can load the analyses and transformations from the
JT_Tutorial_Prolog project. To do this you need to expand the project in the package explorer and select the file
load.pl in the
pl folder. Open the context menu and choose Prolog Development Tools → (Re)consult. This will load the Prolog file into the selected factbase.
After loading the file the Control Center should list the loaded analyses.
Go to the Control Center and enable the analyses you want to run. You can do this by using the checkbox shown for each analysis in the analysis table of the Control Center. By default new analyses are disabled.
After enabling some analyses you can run them by using the green button in the top right corner of the Control Center. This will run all enabled analyses. You can also run analyses by using the context menu of the analysis table.
After running the enabled analyses the analysis table will show the number of results for each analysis.
The right table of the Control Center shows the analysis results for the analyses which are selected in the analysis table. From the analysis result table you can jump to source code corresponding to a result by double-clicking on a result. You can find further information about working with results in JTransformer here.