DEPRECATED, REFER TO THIS DOCUMENT.

JEB2 Developer Tutorial

5- Development Tips

Links:

This tutorial aggregates a collection of tips that can help you during plugin development.

Logging

Creating Loggers

It is quite simple to create a new logger in JEB2:

private static final ILogger logger = GlobalLog.getLogger(MyClass.class);

Using Loggers

There are several level of logs (error, warning, info…) and the logger methods use 2 parameters:

logger.info(“Hello %s”, “World”);

Enabling Debug and Trace levels

By default, debug and trace logs are not displayed. You can activate them by ticking the Development mode in the Options menu:

Plugin5-03.png

Debugging

If you are familiar with Eclipse and development tools in general, you know how handing debugging is: the program can be stopped and paused, current variables can be examined, etc. It is especially handy when troubleshooting a corner-case problem in your plugin.

JEB can be debugged using a method which called the remote debug. What you should do is:

On JEB side, launch the following command from JEB base directory:

java -Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=y -jar bin/plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar

Note: on macOS, also add the -XstartOnFirstThread flag to the above command line.

Note: your version of the Equinox launcher package might differ. Adjust as necessary.

JEB is not started yet: it is waiting for a debugger connection on port 8001

Go to Eclipse:

Plugin5-04.png

JEB should be launched and you may be able to stop when putting breakpoints in code.

In practice, the true entry-point of a plugin is its no-argument constructor. You may decide to place a breakpoint there. You may also choose to stop in the canIdentify method, or anywhere else .

Launching several instances

JEB provides a fully customizable workspace area. Panels can be adjusted, stacked, minimized, expanded, etc. That data is persisted into a workspace folder.

Plugin5-01.png

You may have a need to to launch several instances of JEB, for instance because you have long processing on a first instance, and would like to continue investigating another task. If you try to launch a second instance, you are likely to see this error message:

Plugin5-02.png

This indicates a workspace conflict.

It is possible to launch a second (or more) instances of the JEB client by appending the “-data @none” parameters to the command line. Here, @none indicates that no workspace data shall be used or saved. (You may decide to persist that secondary workspace by providing a folder instead of @none.)

If you wish to modify your startup scripts to never record workspace layout data, and therefore have the ability to conveniently start as many instances of JEB as you’d like, here are the modifications to do:

$JAVA -jar $SCRIPTDIR/bin/cl/jeb.jar $@

to

$JAVA -data @none -jar $SCRIPTDIR/bin/cl/jeb.jar $@

%JAVA% -jar "%~dp0bin\cl\jeb.jar" %*

to

%JAVA% -data @none -jar "%~dp0bin\cl\jeb.jar" %*

Next up in Part 6: Releasing a Plugin

JEB © PNF Software, Inc.