Book Image

Eclipse 4 Plug-in Development by Example : Beginner's Guide

By : Dr Alex Blewitt
Book Image

Eclipse 4 Plug-in Development by Example : Beginner's Guide

By: Dr Alex Blewitt

Overview of this book

<p>As a highly extensible platform, Eclipse is used by everyone from independent software developers to NASA. Key to this is Eclipse’s plug-in ecosystem, which allows applications to be developed in a modular architecture and extended through its use of plug-ins and features.<br /><br />"Eclipse 4 Plug-in Development by Example Beginner's Guide" takes the reader through the full journey of plug-in development, starting with an introduction to Eclipse plug-ins, continued through packaging and culminating in automated testing and deployment. The example code provides simple snippets which can be developed and extended to get you going quickly.</p> <p>This book covers basics of plug-in development, creating user interfaces with both SWT and JFace, and interacting with the user and execution of long-running tasks in the background.</p> <p>Example-based tasks such as creating and working with preferences and advanced tasks such as well as working with Eclipse’s files and resources. A specific chapter on the differences between Eclipse 3.x and Eclipse 4.x presents a detailed view of the changes needed by applications and plug-ins upgrading to the new model. Finally, the book concludes on how to package plug-ins into update sites, and build and test them automatically.</p>
Table of Contents (19 chapters)
Eclipse 4 Plug-in Development by Example Beginner's Guide
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – setting up step filtering


Step filtering allows for uninteresting packages and classes to be ignored during step debugging.

  1. Run the test Eclipse application in debug mode.

  2. Ensure a breakpoint is set at the start of the SampleHandler class's execute() method.

  3. Click on the Hello World icon, and the debugger should open at the first line as before.

  4. Click on Step Into five or six times. At each point, the code will jump into the next method in the expression; first through various methods in HandlerUtil and then into ExecutionEvent.
  5. Click on Resume to continue.
  6. Open Preferences, and then navigate to Java | Debug | Step Filtering.

  7. Check the Use Step Filters option.

  8. Click on Add Package and enter org.eclipse.ui, followed by clicking on OK.

  9. Click on the Hello World icon again.

  10. Click on Step Into as before. This time, the debugger goes straight to getApplicationContext() in the Execution Event class.
  11. Click on the Resume icon to continue.
  12. To make debugging more efficient by skipping accessors, go back into the Step Filters preference and select the Filter Simple Getters from the Step Filters preference's page.

  13. Click on the Hello World icon again.

  14. Click on Step Into as before.
  15. Instead of going into the getApplicationContext() method, execution will drop through to the ExpressionContext class's getVariable() method instead.

What just happened?

The Step Filters preferences allows uninteresting packages to be skipped, at least from the point of debugging. Typically, JVM internal classes (such as those beginning with sun or sunw) are not helpful when debugging and can easily be ignored. This also avoids debugging through the class loader, as it loads classes on demand.

Typically, it makes sense to enable all the default packages in the Step Filters dialog, as it's pretty rare to need to debug any of the JVM libraries (internal or public interfaces). This means when stepping through the code, if a common method such as List.toString() is called, debugging won't step through the internal implementation.

It also makes sense to filter out simple setters and getters (those that just set a variable, or those that just return a variable). If the method is more complex (like the getVariable() method discussed previously), it will still stop in the debugger.

Constructors and static initializers can also be specifically filtered.