Debugging the module with Eclipse

In order to have the Eclipse Java debugger run the Module Java code and step through it, the Modelio Modeler application has to be run in the Eclipse IDE.

Therefore, to have the process working smoothly, special attention must be paid to the configuration of Eclipse.

  • As Modelio is based on RCP, you have to deploy the Plug-ins Development Environment (PDE) as plug-in in Eclipse. This is mandatory to set the debug environment. See the PDE project page for more information.
  • A debug configuration has to be defined in Eclipse in order to have the Modelio application run in the Eclipse debugger and to be able to debug the Module Java code.Creation of the debug configuration is a three steps procedure:
    1. Creating a JRE configuration because Modelio provides its own JRE
    2. Creating a target configuration because Modelio is an RCP application
    3. Creating a debug configuration based on the JRE and target configurations.

When the Eclipse IDE has been properly configured, the overall debugging procedure is as follows:

  1. Generate and package the Module in Eclipse using the ant build file.
  2. Launch Modelio in the Eclipse debugger.
  3. Open a Modelio test project in which the Module is deployed (deploy it if it is the first time).
  4. In the Eclipse debugger, set up breakpoints in the Module code where useful.
  5. Launch the Module commands to be debugged.

For bug fixing simply do the following:

  1. Edit and fix the code directly in Eclipse.
  2. Re-compile in Eclipse.
  3. Re-run Modelio, re-open the test project.
  4. Test and check the fix.
  5. When done, repackage the module using the ant build file.

Creating the JRE configuration

Because Modelio provides its own copy of a standard JRE, it is recommended to use it when debugging Modelio module. Note that it can work with the system standard JRE but sometimes it fails.

  • Open the preferences window (Window –> Preferences)
  • Select Java / Installed JREs, then Add… button
  • Then select Standard JVM, then Next> button
  • On the new dialog, select Directory… and enter the path of Modelio JRE directory (/opt/Modelio/jre for instance on GNU/Linux). All the required fields will be automatically filled in by Eclipse.
  • Select Finish button, select the new JRE definition as the active one.

Creating the target configuration

Modelio is RCP based so a specific target configuration is required to debug Modelio module. This target configuration will then be used in the debug configuration. The procedure is as follows:

  • Open the preferences window (Window –> Preferences)
  • Select Plug-in Development / Target Plateform (if this entry is not available, it means that PDE should be installed), then Add… button
  • Then select Nothing: start with an empty target definition, then Next> button
  • On the new dialog, fill in the name with Modelio for example. Then in the Locations tab, select Add… button, then Directory, then select the root directory where Modelio is installed (/opt/Modelio for instance on GNU/Linux). Then Eclipse automatically adds all the Modelio plug-ins as shown in the following illustration (don’t pay attention to get the same exact number of plug-ins, this may change from Modelio version to Modelio version)
  • Select Finish button, select the new target definition as the active one.
  • Click an Apply button then OK button and we are done with the target configuration for Modelio.

Creating the debug configuration

Now that the target configuration is defined and activated, prior to run Modelio within Eclipse we should create a debug configuration.

  • Select the menu Run –> Debug Configurations…
  • Create a new Eclipse Application
  • fill in the Name field with something like Modelio_debug
  • check that the Runtime JRE field is set to Modelio JRE prepared in §8.1
  • fill in the Bootstrap entries field with the installation directory of Modelio
  • select the Arguments tab
  • fill in the Other field in Working directory frame with the installation directory of Modelio
  • Click on Apply button

Launching Modelio under Eclipse debugger

To debug your module, follow this process: * Run Modelio from the Debug menu of Eclipse (using the launcher created in §8.3)

* Open a database with the module deployed, * Use the module (run its commands, apply its stereotypes, etc.)

When Eclipse runs the configuration, it launches an application from a different working directory (remember, we had to change the location).

The direct consequence is that Eclipse cannot retrieve the source path for our project at first launch when hitting a breakpoint. This is illustrated in the figure below:

The solution consists in configuring the edit path and adding a source path.

Select a java project source and check the JUnitModule

Note

To be sure that the module Java code is generated with all the options that allow comfortable debugging, the code should be compile with Eclipse compiler, not with javac invoked from the module ant build file. If it happens that debugger doesn’t stop at the expected lines, a full recompilation from Eclipse is recommended. To do this:

  • Stop any debugging session
  • Ensure the menu option Project –> Build automatically is ticked
  • Clean the module Java project. Project –> Clean…
  • Wait until Eclipse has recompiled all the source code
  • Then, trigger the packaging of the module (cf §7.10)

edit_target_definition_select.png (78.5 KB) admin admin, 19 June 2013 18:39

window_preferences_installed_jre.png (63.5 KB) admin admin, 19 June 2013 18:39

window_preference_installed_jres_active.png (73.7 KB) admin admin, 19 June 2013 18:39

debug_configuration_parametres.png (139 KB) admin admin, 19 June 2013 18:39

debug_configuration_arguments.png (114 KB) admin admin, 19 June 2013 18:39

edit_source_lookup_path.png (3.07 KB) admin admin, 19 June 2013 18:39

jre_definition_add.png (80.3 KB) admin admin, 19 June 2013 18:39

debug_configuration_new.png (94.6 KB) admin admin, 19 June 2013 18:39

launching_modelio.png (10.4 KB) admin admin, 19 June 2013 18:39

configuring_edit_path.png (10 KB) admin admin, 19 June 2013 18:39

edit_target_definition.png (44.6 KB) admin admin, 19 June 2013 18:39

window_preference_targetplatform_add.png (83.8 KB) admin admin, 19 June 2013 18:39