Table of Contents


foreword xvii
preface xxi
acknowledgments xxiii
about this book xxv
about the title xxix
about the cover illustration xxx

Part 1 Using Eclipse 1

1  Overview   3
1.1 Where Eclipse came from 4
A bit of background 5
The Eclipse organization 5
Open source software 6
1.2 What is Eclipse? 7
The Eclipse architecture 8
Language and platform neutrality 10
1.3 What?s next 11
1.4 Summary 11

2  Getting started with the Eclipse Workbench   13
2.1 Obtaining Eclipse 14
2.2 Eclipse overview 15
Projects and folders 15
The Eclipse Workbench 16
2.3 The Java quick tour 20
Creating a Java project 20
Creating a Java class 22
Running the Java program 25
Debugging the Java program 27
Java scrapbook pages 30
2.4 Preferences and other settings 31
Javadoc comments 32
Format style 33
Code generation templates 33
Classpaths and classpath variables 35
Exporting and importing preferences 36
2.5 Summary 37

3  The Java development cycle: test, code, repeat   39
3.1 Java development tools methodology 40
Testing is job 1 41
A sample application and working sets 41
3.2 The JUnit unit testing framework 43
Method stubs and unit tests 44
Creating test cases 49
How much testing is enough? 54
Implementing the public methods 58
3.3 Further adventures in debugging 62
Setting breakpoint properties 64
Finding and fixing a bug 66
3.4 Logging with log4j 68
Loggers, appenders, and pattern layouts 69
Configuring log4j 73
Using log4j with Eclipse 75
3.5 Summary 77

4  Working with source code in Eclipse   79
4.1 Importing an external project 80
4.2 Extending the persistence component 83
Creating a factory method 84
Creating the unit test class 84
Working with the astronomy classes 85
The Star test case 88
Creating a test suite 89
Implementing the ObjectManager class 90
4.3 Refactoring 95
Renaming a class 96
Extracting an interface 99
Future refactoring 101
4.4 Summary 102

5  Building with Ant 103
5.1 The need for an official build process 104
Creating the build directory structure 105
5.2 Make: A retrospective 109
5.3 The new Java standard: Ant 112
A very brief introduction to XML 113
A simple Ant example 115
Projects 118
Targets 119
Tasks 119
Properties 126
File sets and path structures 128
Additional Ant capabilities 131
5.4 A sample Ant build 131
Creating the build file, build.xml 132
Performing a build 136
Debugging the build 138
5.5 Summary 140

6  Source control with CVS   143
6.1 The need for source control 144
6.2 Using CVS with Eclipse 146
Sharing a project with CVS 146
Working with CVS 153
Versions and branches 170
6.3 Summary 174

7  Web development tools   177
7.1 Developing for the Web 178
The web, HTML, servlets, and JSP 178
JSP overview 179
Servlet overview 181
7.2 Tomcat and the Sysdeo Tomcat plug-in 181
Installing and testing Tomcat 182
Installing and setting up the Sysdeo Tomcat plug-in 183
Creating and testing a JSP using Eclipse 185
Creating and testing a servlet in Eclipse 187
Placing a Tomcat project under CVS control 190
7.3 Building a web application 191
The web application directory structure 191
Web application design and testing 192
Programming with servlets and JSPs 197
7.4 Wrapping up the sample application 210
7.5 Summary 215


Part 2  Extending Eclipse   217

8  Introduction to Eclipse plug-ins   219
8.1 Plug-ins and extension points 220
Anatomy of a plug-in 220
The plug-in lifecycle 221
Creating a simple plug-in by hand 222
8.2 The Plug-in Development Environment (PDE) 223
Preparing your Workbench 224
Importing the SDK plug-ins 224
Using the Plug-in Project Wizard 226
8.3 The ?Hello, World? plug-in example 228
The Plug-in Manifest Editor 230
The Run-time Workbench 231
Plug-in class (AbstractUIPlugin) 233
Actions, menus, and toolbars (IWorkbenchWindowActionDelegate) 237
Plug-ins and classpaths 241
8.4 The log4j library plug-in example 242
Attaching source 244
Including the source zip in the plug-in package 244
8.5 Deploying a plug-in 246
8.6 Summary 247

9  Working with plug-ins in Eclipse   249
9.1 The log4j integration plug-in example 250
Project overview 252
Preparing the project 253
9.2 Editors (TextEditor) 254
Preparing the editor class 255
Defining the editor extension 255
Adding an icon 259
Adding color 261
Token manager 268
Content assist (IContentAssistProcessor) 271
Putting it all together 275
9.3 Views (ViewPart) 279
Adding the view 280
Modifying perspective defaults 281
View class 282
Table framework 289
Label providers (LabelProvider) 296
Models 298
Receiver thread 300
9.4 Preferences (FieldEditorPreferencePage) 301
Main preference page 302
Editor preference page 303
9.5 Plugin class 304
9.6 Summary 305

A  Java perspective menu reference   307

B  CVS installation procedures   323
B.1 Installing CVS on UNIX and Linux 324
Creating the CVS repository 325
Setting up SSH remote access 326
Setting up pserver remote access 327
B.2 Installing CVS on Mac OS X 328
B.3 Installing CVSNT on Windows 329
B.4 Installing Cygwin CVS and SSH on Windows 330
B.5 Troubleshooting the CVS installation 332
B.6 Backing up the CVS repository 332

C  Plug-in extension points   333

D  Introduction to SWT   343
D.1 What is the Standard Widget Toolkit? 344
D.2 SWT architecture 345
Widget creation 346
Resource disposal 346
D.3 SWT and events 347
D.4 SWT and threads 348
D.5 Building and running SWT programs 350
D.6 Using SWT 353
The BasicFramework class 353
The MainApp class 356
Trying the example 359

E  Introduction to JFace   361
E.1 Architecture 362
E.2 Building a JFace application 363
JFaceExample class 364
ExitAction class 366

index 369