Home Tutorials Training Consulting Products Books Company Donate Contact us

NOW Hiring

Quick links


Using the model spy in Eclipse. This tutorial gives an description how to use the model spy in Eclipse RCP applications.

1. Using the application model spy

The following assume that you installed the e4 spies.

1.1. Analyzing the application model with the model spy

The application model of an Eclipse application is available at runtime. The application can access the model and change it via a defined API.

To analyzing and modify the runtime model, you can use a test tool from the e4 tools project which allows modifying the application model interactively. This tool is called Model Spy (used to be called: Live model editor) and can be integrated into your RCP application. Most changes are directly applied, e.g., if you change the orientation of a part sash container, your user interface is updated automatically.

In the model spy, you can select a part in the application model, right click on it and select Show Control to get the part highlighted.

1.2. Model spy and the Eclipse IDE

If installed you can also use the model spy to see the application model of the running Eclipse IDE itself. You can open it via the Alt+Shift+F9 shortcut.

If you modify the Eclipse IDE model, you should be careful as this might put the running Eclipse IDE into a bad state. To fix such issues, start the Eclipse IDE from the command line with the -clearPersistedState parameter.

2. Optional Exercise: Using the model spy

To test the application model dynamics, integrate the model spy and its dependencies into the run configuration of your application.

The spies are debug tools and not not intended to be used in a productive application. So it might happen that this exercise does not work, or that you see additional exceptions in your log file, caused by the tool.

2.1. Add the spies to your target platform

Ensure you have the e4 spies installed.

If you are using a target platform, add the model spies plug-ins to your target platform. Otherwise the spies cannot be integrated into your RCP application.

The update site for the e4 spies is:

Adding model spy to target platform

2.2. Add menu top level menu entry to your window

Add a main menu to your window. This can be done via the Main Menu property on the window application model. Ensure the id for this menu menu is set to org.eclipse.ui.main.menu.

2.3. Adding the model spy to your runtime configuration

Open the run configuration of your product via the Run ▸ Run Configurations…​ menu entry and add the org.eclipse.e4.tools.model.spy plug-in and its dependencies to it.

Adding the live editor to a run configuration

If you use the filter you have to remove it before the Add Required Plug-ins becomes active again.

Adding the live editor to a run configuration

Press the Validate button to ensure that all dependencies are included.

2.4. Use the model spy

After you have added the new plug-ins to your run configuration press the Run button in the run configuration you just added.

Do not start the application now via the product. Starting via the product resets your changes in the runtime configuration.

Use the generated menu entry to display the model spy.

Use the model spy to change the runtime application model. For example, add a part (with a label) or change the size of the window. All changes should become immediately visible (except changes for new menu entries, due to a bug).

2.5. Cleanup - remove model spy from your run configuration

After testing with the tool enabled, start your application again from your product configuration file to remove the model spy plug-in from your run configuration.

If you leave the model spy included in your run configuration, it might cause side effects. For example, in the past it created exceptions if key bindings were present in the application.

3. Learn more about Eclipse 4 RCP development

I hope you enjoyed this tutorial. You find this tutorial and much more information also in the Eclipse 4 RCP book.

4. About this website

5. Eclipse 4 resources

5.1. vogella GmbH training and consulting support


The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.

The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.

Copyright © 2012-2017 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.

See Licence.