Preface

Welcome to Eclipse, today’s premiere Java™ Integrated development environment (IDE). Eclipse is an extraordinary tool, and it fills a long-standing need among Java developers—no longer do you have to suffer through pages of errors scrolling off the screen while using command-line Java compilers. Now you’ve got an IDE that will handle the details for you, letting you get on with writing code. If you’ve never used Eclipse before, your productivity is about to take a giant jump.

We’re going to push the Eclipse envelope in this book, working from the basics up through the advanced. This book has been designed to open up Eclipse and to be more accessible than any other. It’s a programmer-to-programmer book, written to bring you up to speed in Eclipse without wasting time.

If you’re a programmer, this book is written to give you exactly what you want to see—the good stuff, and only the good stuff. There’s as much Eclipse crammed into this book as you need to master the topic, and mastering Eclipse is our goal.

What’s Inside

From cover to cover, this book is pure Eclipse, covering hundreds of skills and techniques. We start from the most basic Java development and work up to creating your own plug-in editors for the Eclipse environment. Here are a few of the topics in this book:

  • Using Eclipse to develop Java code

  • Working with JAR files

  • Setting launch configurations

  • Selecting Java runtimes

  • Creating Javadoc

  • Refactoring

  • Extracting Interfaces

  • Viewing type hierarchies

  • Customizing Eclipse

  • Testing code with JUnit

  • Debugging

  • Setting breakpoint hit counts

  • Using hot code replacement

  • Sharing projects with CVS

  • Comparing code with local history

  • Using Ant to build Eclipse projects

  • GUI programming from applets to Swing

  • Using the Standard Widget Toolkit (SWT)

  • SWT buttons, text, labels, lists, layouts, and events

  • SWT menus, toolbars, sliders, trees, and dialogs

  • Developing web applications

  • Writing servlet code in place

  • Using the Sysdeo Tomcat plug-in

  • Debugging and deploying web projects

  • Developing Struts applications with Eclipse

  • Using the Easy Struts plug-in

  • Developing Eclipse plug-ins

  • The Plug-in Development Environment (PDE)

  • Plug-in manifests

  • Extension points

  • Using the Run-time Workbench

  • Creating a standard plug-in

  • Creating an action set

  • Creating plug-in menus

  • Creating a multipage editor plug-in

  • Creating a plug-in wizard

  • Creating an Eclipse view supported with a plug-in

We’re going to see all these topics and many more in the upcoming pages. Here’s an overview of each chapter:

Chapter 1

This chapter is all about the basics, including all the details on the Eclipse Workbench and an introduction to the Java Development Tools (JDT).

Chapter 2

Using the JDT, we’re going to create Java projects, create code automatically, implement syntax checking, and start developing significant Java applications.

Chapter 3

An IDE wouldn’t be much use without a debugger. Eclipse and the JDT give you all the power of a true debugger, including breakpoints, expression evaluators, being able to change values on the fly, and more.

Chapter 4

One of the valuable aspects of Eclipse is that it lets you develop in teams, something that any commercial developer can appreciate, since significant development is usually done in teams. Using Concurrent Versions System (CVS), team members do all of their work in their own workbenches, but they can share and register their work using a CVS repository.

Chapter 5

Ant is a powerful Java build tool, and we’ll see in this chapter that you can do things with Ant in Eclipse that Eclipse can’t do alone, such as copy and move files.

Chapter 6

This chapter starts our work using Eclipse to handle GUI development with Swing. We’ll also take a look at a Swing plug-in for Eclipse here—using this plug-in, for example, you can drag and drop Swing controls.

Chapter 7

In this chapter and the next, we’ll be covering the Standard Widget Toolkit (SWT)—the GUI toolkit for Java developers that provides a portable API and tight integration with the underlying native GUI platform. SWT—a 100% Java alternative to the AWT and Swing—is another reason Eclipse has become so popular, and we’re going to spend two chapters on it.

Chapter 8

This chapter completes our coverage of the SWT, including dialogs, toolbars, sliders, trees, menus, and more.

Chapter 9

This chapter gets us started with web development, creating both servlets and JSP using Eclipse and the Tomcat server. We’ll also take a look at a Tomcat Eclipse plug-in.

Chapter 10

We continue our web work in this chapter with applications constructed using the Struts framework. We’ll also see how to use a Struts plug-in.

Chapter 11

In this chapter, we’re going to start creating Eclipse plug-ins to extend Eclipse. We’ll use the Plug-in Development Environment (PDE) and other tools in this chapter to create working plug-ins.

Chapter 12

Here, we’re going to get the details on some more advanced aspects of plug-in creation—editors, creating wizards, and how to support Eclipse views.

Chapter 13

In this chapter, we’re going to take a look at Eclipse Version 3.0. This will give you a glimpse at the exciting things on the Eclipse horizon.

Conventions Used in This Book

There are some conventions we’ll use that you should know about. When we’ve added a new piece of code and are discussing it, it’ll appear in bold face, and when there’s more code to come, you’ll see three dots. Here’s what that looks like:

Listener listener = new Listener( ) {
    public void handleEvent(Event event) {
        ToolItem item = (ToolItem)event.widget;
            String string = item.getText( );
            .
            .
            .
    }
};

We’ll also use the standard convention for selecting menu items in this book; for example, to create a new project in Eclipse, you use the File New Project menu item.

The following typographical conventions are used in this book:

Plain text

Indicates menu titles, menu options, menu buttons, and keyboard accelerators.

Italic

Indicates new terms, example URLs, example email addresses, filenames, file extensions, pathnames, directories, and Unix utilities.

Constant width

Indicates commands, options, switches, variables, types, classes, namespaces, methods, modules, properties, parameters, values, objects, events, event handlers, and XML tags.

Constant width italic

Indicates text that should be replaced with user-supplied values.

Tip

This icon signifies a tip, suggestion, or general note.

Warning

This icon indicates a warning or caution.

What You’ll Need

All the software you’ll need in this book can be downloaded from the Internet for free. You’ll need Eclipse—this book was written using Eclipse 2.1.1—and we’ll discuss where to get Eclipse in Chapter 1. Other software packages that we’ll be downloading throughout the book include the Tomcat web server and various CVS servers (which will allow you to share Eclipse projects with others).

Eclipse is built to be extendible, and hundreds of Eclipse plug-ins are available for free downloading. Plug-ins let you add functionality to Eclipse—new built-in editors, code generators, software launchers, and more—and we’ll take a look at a number of the most popular plug-ins in this book. And in Chapter 11 and Chapter 12, we’ll develop our own Eclipse plug-ins.

Using Code Examples

All the code in this book is available for download from http://www.oreilly.com/catalog/eclipse. See the file readme.txt in the download for installation instructions.

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: "Eclipse, by Steve Holzner. Copyright 2004 O’Reilly Media, Inc., 0-596-00641-1.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

We’d Like to Hear from You

Please address comments and questions concerning this book to the publisher:

O’Reilly & Associates, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
(800) 998-9938 (in the United States or Canada)
(707) 829-0515 (international or local)
(707) 829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://www.oreilly.com/catalog/eclipse

To comment or ask technical questions about this book, send email to:

For more information about our books, conferences, Resource Centers, and the O’Reilly Network, see our web site at:

http://www.oreilly.com

Get Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.