Skip to main content
Jump to: navigation, search

ETrice/Development/Tips and tricks

< ETrice‎ | Development
Revision as of 10:47, 31 July 2012 by (Talk | contribs) (Add Tracing to Your Plug-in)

General Eclipse HOWTOs

Add Tracing to Your Plug-in

Add a file .option on the top level of your plug-in project. To this file add a line


This setting can be toggled in the trace tab of your launch configuration (it's also possible to edit string values there).

Here is the source code that uses these settings to enable trace messages printed to system log or standard out:

	private static boolean traceData = false;
	static {
		if (Activator.getDefault().isDebugging()) {
			String value = Platform.getDebugOption(
			if (value!=null && value.equalsIgnoreCase(Boolean.toString(true)))
				traceData = true;

You may have to define an Activator class if it's not present yet. In the MANIFEST.MF make sure that the plug-in is activated when one of its classes is loaded. The Activator may be derived from AbstractUIPlugin and should in its minimal version look like this:

public class Activator extends AbstractUIPlugin implements BundleActivator {
	private static Activator instance = null;
	public static Activator getDefault() {
		return instance;
	public void start(BundleContext context) throws Exception {
		instance = this;
	public void stop(BundleContext context) throws Exception {
		instance = null;

Back to the top