Eclipse in Action
A Guide for Java Developers

David Gallardo, Ed Burnette and Robert McGovern

2003 | 416 pages | B&W
ISBN: 9781930110960

$44.95 Softbound print + PDF eBook
$35.99 eBook edition (PDF only)

"Wastes no time getting to the meat of development with Junit, Log4j, testing, debugging, and Ant integration. Not to mention a chapter on CVS integration. The book has everything that a developer needs during the development life cycle..."
-- Utah PHP Users Group

"...A better-than-complete user manual, since it presents a broader view of the field and contains personal comments about the tool. Each task is explained using a description, a list of the steps to implement it, and adequate screen shots. I used this book as an Eclipse beginner, and I was very satisfied with the clarity of the presentation; I was able to quickly learn how to use Eclipse. ... a great book about a great tool."
-- ACM Computing Reviews



Covers Eclipse 2.1 Features:
  • Hyperlinked Java code
  • Flexible project layout with linking
  • Better ant support
  • Improved watchpoints and breakpoints
  • Stack trace hyperlinks
  • New refactorings
  • Customizable code generation (templates)
  • Better Junit integration
  • Dynamically computed PDE build classpath
  • Plugin export wizard

Eclipse is a new open-source, Java-based, extensible development platform designed for nothing in particular but everything in general. Because of its roots, it is currently most popular as a Java integrated development environment (IDE). Eclipse ships with plugins for writing and debugging Java code. Additional plugins for more advanced Java development, such as JSP/servlets, are available from third parties.

This book provides a thorough guide to using Eclipse features and plugins effectively in the context of real-world Java development. Realistic examples demonstrate how to use Eclipse effectively to build, test and debug applications using the tools provided by Eclipse and other third-party open source plugins. The reader will learn how to use plugin tools for using Eclipse in a team environment, including using Ant for more sophisticated build processes and CVS for source control. Plugin-ins for building web applications, using J2EE technologies, such as JSP/Servlets and EJB, are also discussed.

Complementing this coverage of Eclipse in the context of development is a reference providing a comprehensive guide to Eclipse. Because Eclipse and its plugins provide a remarkable array of features, it is often hard to learn what features are available and how they can be invoked. This reference lays things out clearly: feature-by-feature, menu-by-menu.

What's inside:


David Gallardo is an independent software consultant and author specializing in software internationalization, Java web applications, and database development. He has been a professional software engineer for over fifteen years and has experience with many operating systems, programming languages, and network protocols. He is also the author of "Java Oracle Database Development." He lives in El Paso, Texas.

Ed Burnette is a Principal Systems Developer at SAS, where he has worked on such diverse projects as compilers, debuggers, device drivers, performance tuning, and UNIX ports. He also helped write several commercial computer games. Currently, Ed uses Eclipse in the development of OLAP servers, mid-tier providers, and clients written in a mixture of C, Java, and C#. He lives near Research Triangle Park, North Carolina.

Robert McGovern is a software developer for an international high voltage power supply company doing embedded development. He has a degree in Artificial Intelligence and is a member of the IEEE and the ACM. His personal interest is in Java & Ruby and he has been involved in computers and programming since the days of the Sinclair ZX Spectrum. Robert lives in West Sussex, England.

From the Back Cover

I heartily recommend it... I'm a little envious that readers will come up to speed so much faster than I did.
-- Bob Foster, Eclipse evangelist From the Foreword

This is a focused guide to Eclipse-based Java programming. Extensible and elegantly built around a small core, Eclipse is the platform-independent IDE created by IBM and then released as open source. Eclipse has broad support from both large companies and the open source community.

Eclipse in Action carefully presents both the big picture and the facts you must know to master the proverbial 80% of what you do. It covers how to use the open source tools that are integrated with Eclipse, including JUnit, Ant and CVS, as well as web development plug-ins. The book?s authors are Eclipse early adopters toughened by intense use of the tool since its release.

This book encourages readers to learn through action. It is accessible to novice and intermediate Java developers who may not necessarily have experience with other IDEs. For more advanced developers it discusses how to build plug-ins to extend Eclipse's functionality.

What's Inside

David Gallardo is a consultant and author with fifteen years of software development experience. He lives in El Paso, Texas. A twenty year veteran of SAS, Ed Burnette uses Eclipse to develop commercial software in C and Java. He lives near Research Triangle Park, North Carolina. Based in West Sussex, England, Robert McGovern is a developer who uses Eclipse extensively for open source projects in Java and Ruby.

Sample Chapters

Two sample chapters of Eclipse in Action are available in PDF format. You need Adobe's free Acrobat Reader software to view it. You may download Acrobat Reader here.

Download Chapter 2

Download Chapter 8


Imagine my surprise when the editors asked me to write this foreword. I'm not a guru, just a programmer who has used Eclipse every day for the last couple of years. The biggest difference between you and me is that when I started, there weren't any books like this, so I had to dig a lot of the material you find here out of the source code. A character-building exercise, to be sure, but I'd much rather have had the book!

This book will help you come up to speed fast on a great, free Java development tool. The chapters on JUnit, Ant, and Team (CVS) integration in particular address areas where newcomers often have questions and need a little boost to become productive. If you're not already using these tools, you should be. If you are, you'll find out how Eclipse makes it easier to use them. The nuts and bolts of programming - creating and maintaining projects, editing source code, and debugging - are not neglected, and the section on refactoring will introduce you to features that, if your previous tool didn't have them, you will soon wonder how you ever lived without.

Eclipse has its own GUI framework called the Standard Widget Toolkit (SWT), which is portable across all major platforms, runs fast, and looks native. You can use SWT to develop your own applications, the same way you might use AWT/Swing. A smaller framework named JFace, built on top of SWT, adds dialogs, wizards, models, and other essentials to the basic SWT widgets. These are discussed in useful but not excruciating detail in appendixes you can also use for reference.

The book will be even more helpful if you have ambitions to go beyond using Eclipse to extending it. I'm one of those people. For a long time there was no good introduction to plug-in writing, which made it tough to get started; but now there is. I hope you will give the chapters on extending Eclipse a fair chance to excite you with the possibilities.

I don't know about you, but I'm never quite satisfied with the development tools I use. No matter how great they are, something is always missing. I think most developers are like that. We tend to fall in love with our favorite editor or IDE, defend it staunchly in the newsgroups, and evangelize our friends relentlessly. Yet, in our fickle hearts, we realize its many blemishes and shortcomings. That's why most developers are latent tool-builders. As Henry Petroski observed in The Evolution of Useful Things, the mother of invention is not necessity, it is irritation.

But usually our tool-building urges remain dormant, because of the great effort required to duplicate the hundreds of things about our favorite tool that are perfectly fine in order to fix the handful of things we find wanting. An open source development tool like Eclipse, built from the ground up by extending a very small nucleus with plug-ins, allows us to give vent to our frustrations in the most productive way possible. By writing plug-ins, we can improve and extend an already rich IDE, keeping all that is good about it. Moreover, we can readily share our efforts with other users of the tool and take advantage of their efforts, by virtue of the common platform that underlies all.

I speak of irritation, but I wouldn't write a plug-in for a tool I didn't like much. Eclipse has a lot to like. I won't rattle off features; you will discover these for yourself in the pages of this book or on your own. I'll just mention one thing that strikes me as extraordinary, even unique: the excellent technical support provided in the Eclipse newsgroups by the actual people who wrote the code. I know of no commercial product whose support is nearly as good, and no other open source project whose developers are so committed to answering any and all questions thrown at them. In many cases, questions are answered with source code written and tested for the occasion. For a programmer, it doesn't get much better than that.

Taking advantage of these resources, people like you and me have written or are in the process of writing a wide spectrum of plug-ins, ranging from hacks to features to entire subsystems. One guy didn't like the way the toolbar icons were laid out, so he wrote a plug-in that arranged them as he preferred; it turned out quite a few people agreed with him. I wrote an XML editor because there wasn't a decent one available at the time. Others are fitting in new programming languages, graphical editors, GUI builders. Developers in large companies are using plug-ins to tailor Eclipse to corporate ways, like the source control system the VP standardized on that no other tools seem to support. Graduate students are using Eclipse as the platform for their thesis projects. The list goes on, and it is always incomplete.

You can even make money extending Eclipse. Eclipse is free, but its license allows you to charge for your Eclipse-based extensions. (For complete licensing details, use the Legal Stuff link on the web page.) There are four ways to do this:

The only catch to all this generosity is you have to know how to take advantage of it. This book will get you off and running. I heartily recommend it. I've been writing Eclipse plug-ins since 2001, and this book taught me things I didn't know. The only negative thing I can think to say is that I'm a little envious that readers will come up to speed so much faster than I did.

Bob Foster


This book began with a single author, David Gallardo, and a single purpose: to introduce Java developers to Eclipse. Initial feedback from early reviewers made it apparent that there was also a lot of interest in developing plug-ins to extend Eclipse and in using Eclipse's graphics libraries in other projects. The March 2003 release of Eclipse 2.1, which the book targeted, was approaching quickly, so the call went out for help.

Ed Burnette, who was interested in the potential of technologies behind Eclipse and the applications they could power, was recruited to expand the coverage of Eclipse plug-ins. Robert McGovern, the technical editor (who seemingly needs no sleep), stepped up to the plate to produce two appendixes on SWT and JFace, using source material graciously provided by Steven Haines. The expanded team permitted us to cover both using and extending Eclipse more thoroughly than would otherwise have been possible.

In the spirit of agile development, the first sample application - a file-based persistence component - was begun with little up-front design. The first part of the book accurately depicts its evolution, warts and all. The source code for each stage of the application is available on this book's web site (, including a final version that corrects the flaws that appear when it is extended to support a database.

Although we introduce and demonstrate the tools and techniques for agile development, and we recommend this approach, this isn't an agile development primer. The material, like Eclipse itself, is equally applicable to other methodologies - or no methodology at all.

Eclipse includes a lot of information to cover. One of the big debates we had in creating the book was how to balance the information in the book with the online documentation. Where practical, we avoid duplicating information that is readily available in the online documentation (for example, we considered - but dropped - a list of all the SWT widgets). We feel that a concise guide is more useful (and readable!) than an 800-page behemoth any day.

We learned a lot while writing Eclipse in Action - about Eclipse, about ourselves, and about the effects of sleep deprivation. Overall, we had great fun doing it. We hope you'll find the book helpful in whatever projects you create, and that you have as much fun reading it as we did writing it!


The authors would like to acknowledge and thank all the people who helped make this book a reality: The staff at Manning who gave us this opportunity: Marjan Bace, Susan Capparelle, Dave Roberson, and in memoriam, Ted Kennedy. The production staff took our raw words, worked their magic, and transformed them into the book you now hold: Gil Schmidt, Tiffany Taylor, Denis Dalinnik, Syd Brown, Mary Piergies, Helen Trimes, Leslie Haimes, and Iain Shigeoka.

Our reviewers, Christophe Avare, Dan Dobrin, Bob Donovan, Bob Foster, Phil Hanna, Carl Hume, Michiel Konstapiel, Jason Kratz, James Poli, Eric Rizzo, and Cyril Sagan, provided invaluable guidance in focusing on the right topics and in getting the technical details right. We would also like to acknowledge the valuable contribution that Steve Haines made to our coverage of SWT and JFace.

The Eclipse community, particularly those members participating in the Eclipse newsgroups, provided valuable assistance and technical insight. The Straight Talking Java list provided us a more collegial environment to discuss matters technical and topical, a sort of virtual watercooler. We would also like to thank the Eclipse team for creating an incredible product.

David and Ed would like to thank Robert McGovern, who first came on board as a reviewer of the manuscript in its early stages and then did the technical editing of the code and text, before finally jumping in to help write the appendixes that were falling behind schedule. The many late nights he dedicated to the project and his excellent insights and comments are much appreciated, and resulted in a much better book than we could otherwise have hoped for.

David Gallardo would like to thank Ed Burnette for the expertise, careful eye, and insight Ed provided in his reviews and for the consistency and coherence Ed established in his own work; Tiffany Taylor for the fine job she did in pruning his prose; and Mary Piergies for keeping him on track. Most of all, David would like to thank his wife Eni for her patience.

Ed Burnette would like to thank his wife Lisa for keeping the house together and putting up with his late nights, Duane Ressler and Paul Kent for providing a constructive work environment that allows for exploration, and Clay Andres for inviting him along for the ride.

Robert McGovern would like to thank David and Ed for letting him join in the fun and games, Mary Piergies for leading him through, and the rest of the fantastic team at Manning. Special thanks to Joy, Kieran, Samuel, and finally to Roberta, his wife, for her understanding and encouragement.

about this book

This book has two parts, nine chapters, and five appendices. Part 1 is for those who want to develop Java code using Eclipse as an IDE:

Part 2 is for those wanting to extend Eclipse with new functionality:

The appendixes provide more detailed information that supports the rest of the book:

Who should read this book

Eclipse in Action is for Java programmers at all levels who would like to learn how to use and extend Eclipse or use Eclipse technologies in their own projects. Beginning and intermediate programmers will appreciate the advice on unit testing, logging, and debugging, and the clear, step-by-step instructions on using the Java tools provided within Eclipse. Advanced developers will relish the detailed plug-in examples. Even people who have been using Eclipse for some time will find numerous tricks and tips they didn't know before.

How to use this book

If you are new to Eclipse, you should begin with chapters 1?6. This section of the book will take you through the process of learning about Eclipse and commonly accepted best practices regarding tools and programming techniques. You may find appendixes D and E useful if you want to build a standalone program that uses the Eclipse GUI toolkits instead of Swing. When you feel confident about your Eclipse Java skills, you should move on to chapter 7, where you will learn how to do web development in Eclipse.

If you've used Eclipse before but you want to extend its functionality, then you should read chapters 8 and 9. There you will be taken through the process of developing, integrating, and running a plug-in. If the plug-in you are developing needs to interact with Eclipse's user interface, then you should examine appendixes D and E to understand a little about the technologies that make up the Eclipse UI. You will also find that appendix C is a handy reference that lists in one table all the places you can extend Eclipse.

Source code

This book contains extensive source code examples of normal Java programs, Eclipse plug-ins, and standalone SWT/JFace programs. All code examples can be found at the book's web site at

Typographical conventions

Look for the word on Google and you will see that most people use "plugin." Our publisher would have preferred us to have used the unhyphenated form of the word - a printed page looks more peaceful to the eye without the hyphens disturbing the flow of letters and words, and it's quicker to type. However, the hyphenated form is used in the product itself, and, in a tip-of-the-hat to the preferences of the creators of Eclipse, we have consistently used it in this book when referring to plug-ins in general. We do use "plugin" in a few cases, when referring to specific filenames and directories that don't include the hyphen - for example, the plugins directory in which Eclipse plug-ins are installed, and the plugin.xml manifest file.

Online resources

Several excellent resources are available:
about the cover illustration

The figure on the cover of Eclipse in Action is a "Iudio de los estados Mahomentanos," a Jewish trader from the Middle East. The illustration is taken from a Spanish compendium of regional dress customs first published in Madrid in 1799. The book's title page states:

Coleccion general de los Trages que usan actualmente todas las Nacionas del Mundo desubierto, dibujados y grabados con la mayor exactitud por R.M.V.A.R. Obra muy util y en special para los que tienen la del viajero universal

which we translate, as literally as possible, thus:

General collection of costumes currently used in the nations of the known world, designed and printed with great exactitude by R.M.V.A.R. This work is very useful especially for those who hold themselves to be universal travelers

Although nothing is known of the designers, engravers, and workers who colored this illustration by hand, the "exactitude" of their execution is evident in this drawing. The "Iudio de los estados Mahomentanos" is just one of many figures in this colorful collection. Their diversity speaks vividly of the uniqueness and individuality of the world's towns and regions just 200 years ago. This was a time when the dress codes of two regions separated by a few dozen miles identified people uniquely as belonging to one or the other. The collection brings to life a sense of isolation and distance of that period - and of every other historic period except our own hyperkinetic present.

Dress codes have changed since then and the diversity by region, so rich at the time, has faded away. It is now often hard to tell the inhabitant of one continent from another. Perhaps, trying to view it optimistically, we have traded a cultural and visual diversity for a more varied personal life. Or a more varied and interesting intellectual and technical life.

In spite of the current downturn, we at Manning continue to celebrate the inventiveness, the initiative and, yes, the fun of the computer business with book covers based on the rich diversity of regional life of two centuries ago? brought back to life by the pictures from this collection.


"Very true to the essence of Manning's In Action series, this book is a very useful resource for specific training needs. This book is a must for Java developers who have never worked with the Eclipse IDE. It will enable them to start coding like experienced Eclipse users in no time. Then, when the basic features of the IDE no longer satisfy their needs, they will find the second part of the book and its appendixes very handy."
-- EclipseZone

"Wastes no time getting to the meat of development with Junit, Log4j, testing, debugging, and Ant integration. Not to mention a chapter on CVS integration. The book has everything that a developer needs during the development life cycle of their project...Part 2 of Eclipse In Action deals with extending Eclipse and creating Eclipse plugins (the foundation of Eclipse). These chapters give a great novice introduction into Eclipse plugin development ..."
-- Utah PHP Users Group

"...A better-than-complete user manual, since it presents a broader view of the field and contains personal comments about the tool. Each task is explained using a description, a list of the steps to implement it, and adequate screen shots. I used this book as an Eclipse beginner, and I was very satisfied with the clarity of the presentation; I was able to quickly learn how to use Eclipse. ... a great book about a great tool."
-- Computing Reviews, second review

"A detailed guide to the Eclipse integrated development environment (IDE) framework. ...designed to provide the fastest way of learning Eclipse as a Java IDE...

As a whole, the book contains very well-balanced material for studying the basic operations in Eclipse version 2.1, as well as advanced material to develop plug-ins. The code snippets are brief, and demonstrate main ideas. The screenshots are not superfluous, and complete the text. The chapters describing JUnit, Ant, and CVS not only organically represent Eclipse as a tool platform, but are also a gentle introduction to these tools...a perfect book for Java developers of all levels, as well as any developers who have experienced and survived the full lifecycle of software development."
-- Computing Reviews, first review

"Continuing a recent trend from Manning this seems to be another well edited book that is kept managable in size, yet still containing a large amount of information. The book doesn't waste a lot of time getting started, by chapter three you are already learning about using JUnit, Log4J and the debugger. In later chapters, the authors have you working with Ant and CVS after working up a nice little example that that they even spend some time refactoring using the built in features of Eclipse. ... So if you thought that such a little book [383 pages] wouldn't cover much more than what real newbie would need, you will be missing a good book."

"It will save you countless hours of frustration spent rummaging around newsgroups looking for answers...Even if you've already been using Eclipse for a while, Eclipse In Action can fill in the gaps in your knowledge while providing you the foundation to begin to explore Eclipse on the next level, that of plug-in developer."

"...written with Java developers in mind and leads you through the major functionality and extensibility of the IDE through in-depth feel like you're getting real-life experience by doing examples...easy and enjoyable to read...The technical information is dead on...I'd definitely recommend this book to anyone that wants to get the most out of Eclipse."

"This book seems to have pitched itself well, not pandering to the absolute Java newbie, not afraid to get down into the code and yet gentle enough that newer Java developers can follow easily...consider this book the User's Guide that would have been in the box if Eclipse came shrink-wrapped."

Source Code

Source code for Eclipse in Action is contained in a single ZIP file. Free unzip programs can be found at -- 142 KB
Source code for Eclipse in Action for Eclipse 2.1.x and 3.x -- 88 KB
Additional source code for Eclipse in Action for Eclipse 3.x only

Users of Eclipse 3 need both zips.