Introduction
"The only thing better than writing a book is finishing writing a book."
The author
"There ain't no rules here. We're trying to accomplish something."
Thomas Edison
At the time I started writing this book, only two Eclipse books were available. Both books are (still) fantastic, mention many of the foundation features of Eclipse, and discuss how you can develop Java within this all-encompassing environment. However, the number of plug-ins available to the Eclipse community was growing, and continues to grow, at an impressive rate.
My goal from the beginning was to present Java developers with a slightly different view of Eclipse than just another IDE with cool features. The number of plug-ins available at the time of this writing (and I wrote this introduction last) was almost 500. Considering that the WebSphere Application Developer (WSAD) environment, IBM's Eclipse-based IDE, contains over 500 plug-ins, it would seem that the open-source IDE arena is catching up fast to the commercial arena. With that many open-source plug-ins, I felt that a useful Eclipse book would not only discuss the IDE at a feature level, including how to extend it using the Plug-in Development Environment (PDE), but would include a strong subset of free/almost-free plug-ins to allow developers the opportunity to develop industrial-strength applications at minimal cost, without having to worry about creating their own plug-ins.
Who Should Read This Book
This book is not for Java novices. You must understand Java syntax, object-oriented technologies, UML, design patterns, test-driven development, and framework concepts. An understanding of Tomcat, JBoss, and Java frameworks will also be a big help, but an in-depth knowledge is not necessary. The examples in this book will walk you through almost everything you need. However, Web servers and the concepts associated with enterprise technologies will not get a lot of attention. If you need to get information about various open-source projects and Java technologies, Appendix E, "Recommended Resources," will get you started on your quest for knowledge.
How This Book Is Organized
In addition to where you can get Eclipse and how to install it, you will be given enough information to use it productively and to extend it to make it an even better tool. This book is divided up into three sections:
The Eclipse Development EnvironmentThis section will cover most of the features that make Eclipse an environment worth using. Even though there are plug-ins to support languages such as C and COBOL, I will only discuss the Java support and the various ways you can develop Java applications using Eclipse. Support for the JUnit testing framework will be discussed, but additional testing frameworks, specifically Cactus, are discussed later in the book. If you only use Eclipse as a Java development environment, you will not be disappointed.
Developing Applications Using Plug-InsThis is the part of the book I expect most developers to use the most often. Java exists in a world where enterprise applications must be written in a minimum of time and with a minimum of fuss. The plug-ins examined are not all that are available, but they give a nice sampling of the kinds of extensions available to the Java development environment supported by Eclipse. You will get a chance to examine testing frameworks such as Cactus, as well as plug-ins covering UML, Struts, J2EE development, and GUI building.
Extending EclipseThe Eclipse plug-in architecture is last because it is the most interesting part of the tool, although it will be used the least by most developers. Although not difficult to use, the plug-in architecture is not trivial. I hope the plug-in examples inspire more developers to write additional views and editors for the myriad file types and technologies that continue to appear unabated by the lack of problems to solve.
Downloading and Installing Eclipse
Before you install Eclipse, make sure you have a Java Runtime Environment (JRE) or a full Java Development Environment (JDK) installed on your machine. Also, the Java environment should be 1.4.1 or better. To download Eclipse, you start your journey at http://www.eclipse.org. Here are the steps to follow:
On the Eclipse home page, look to the navigation menu on the left and click Downloads.
The Downloads page will take you to the list of locations that carry the Eclipse installation files. You can select the North America Main Eclipse Download Site or any of the volunteer mirror sites. When you click one of the site links, you will be taken to the Eclipse Project Downloads page.
The various available Eclipse downloads are listed here. At the time of this writing, the final release of Eclipse 3.0 is available. You should click the link that reads Latest Release and has a 3.0 build name.
The Build page for Eclipse 3.0 lists the various Eclipse releases for all the supported platforms as well the source code for Eclipse. Click either the HTTP or FTP link that appears in the third column on the same line as the platform on which you expect to run Eclipse. The status column for your platform must have a green check mark next to it. A red X next to a platform name means the build is not ready.
After you click the HTTP or FTP link, your browser should ask you for a location to save the file. If you do not intend to save the zip file after you install Eclipse, just save the file to your Desktop or some other location where you can remove it when you are finished. When the download completes, you are ready to install Eclipse on your machine.
The Eclipse zip file contains all the Eclipse files needed to run the IDE. If you already have Java installed, all you need to do is extract the contents of the Eclipse zip file into a selected directory. For example, extract the Eclipse zip file into c:\tools.
After you complete these steps, you are ready to go. On the Windows platform, navigate to the eclipse directory and run eclipse.exe. The splash screen will appear for a few moments and then the Workspace Launcher will open asking for the directory Eclipse should use as its default location for your project files. Click OK. If the Eclipse workbench opens up on the Welcome page, your installation was a success.
All the examples were run and tested on the Windows platform. The information is mostly platform independent, but there may be some instances where features are implemented differently. If you're using Unix or a Mac the information in the book should apply but be sure to check the Eclipse Release page for your OS and hardware platform for specifics on the differences. For Mac users there is a great article on Eclipse for the Mac at http://developer.apple.com/tools/eclipse.html. For Linux, I recommend a Linux support forum such as http://www.linuxforum.com that covers each of the three Linux variants supported by Eclipse.
If you decide to download the code examples, you will find that all the code has a code marker next to string literals ("//$NON-NLS-1$"). This is used by the Eclipse incremental compiler to flag strings that do not need to be externalized. One of the many features of Eclipse is the ability of the Java nature to create a separate properties file for use in internationalization. I have removed these flags from the book text, but I've left them in the code in case you, like me, decide to let the compiler be as picky as it can.
Conventions Used in This Book
This book uses several conventions to help you prioritize and reference the information it contains.
Various typefaces are used to make code and input easily distinguishable from regular text:
Program code appears in a special monospace font.
Placeholderswords or characters used temporarily to represent the real words or characters you type in codeare typeset in italic monospace.
Material that you are instructed to type appears in bold monospace.
In addition, the following special elements provide information beyond the basic instructions:
Headline Sidebars - Sidebars contain special tips, warnings, and extra facts that are related to the text where they are found. They often emphasize important topics, so you might find them very helpful.
Shop Talk - In most of the chapters, I use Shop Talks to share my personal experiences as they relate to the chapter subject. These elements often contain opinions or preferences; the rest of the book is confined strictly to the facts. My particular opinions or preferences might not always apply to your situation, so keep that in mind when you read a Shop Talk.
Source Code for This Book
The associated source code files described in this book are available on the Sams website at http://www.samspublishing.com. Enter this book's ISBN (without the hyphens) in the Search box and click Search. When the book's title is displayed, click the title to go to a page where you can download the code.
© Copyright Pearson Education. All rights reserved.