Jump to: navigation, search

EDT:Debug Extensibility

Revision as of 12:07, 22 February 2012 by Jspadea.us.ibm.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

If you are extending the EGL language or Java generator, you may find you need to also extend the Java-based debugger to improve the user experience. For example if you are adding a new Java class to represent an EGL type in the generated application, it will probably not look very nice in the Variables view (by default it will be displayed in the Java way, which might not match how it should be represented to an EGL user).

This document will cover the ways in which the debugger can be extended.

Variable adapters

If you wish to control how a Java variable is displayed in the Variables view, you will need to contribute a variable adapter to the EDT Java debug framework. This is done with Eclipse extension points. In your plug-in's manifest editor, add an extension for org.eclipse.edt.debug.core.variableAdapters. A reference implementation can be found in org.eclipse.edt.debug.core's plugin.xml file (see the corresponding class org.eclipse.edt.debug.internal.core.java.variables.EDTVariableAdapter).

Your contributed class will need to implement org.eclipse.edt.debug.core.java.IVariableAdapter. Take a look at its source, as well as other relevant classes & interfaces, for Javadocs.

The basic idea behind a variable adapter is, given a Java variable (IJavaVariable), you first determine if it's a type you wish to adapt. If so, you then must return an IEGLJavaVariable that will correctly structure the Java variable. If the Java variable is not a type to be handled by your adapter, simply return null and the next registered adapter will be given a chance to adapt it. Note: first adapter to return a non-null variable wins, and order is not guaranteed!