Tải bản đầy đủ (.pdf) (602 trang)

professional eclipse 3, for java developers, 2005

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (8.76 MB, 602 trang )

Professional Eclipse 3 for Java

Developers
Berthold Daum
01_020059_ffirs.qxd 10/8/04 10:55 AM Page iii
01_020059_ffirs.qxd 10/8/04 10:55 AM Page vi
Professional Eclipse 3 for Java

Developers
01_020059_ffirs.qxd 10/8/04 10:55 AM Page i
01_020059_ffirs.qxd 10/8/04 10:55 AM Page ii
Professional Eclipse 3 for Java

Developers
Berthold Daum
01_020059_ffirs.qxd 10/8/04 10:55 AM Page iii
Copyright © 2004 by dpunkt.verlag GmbH, Heidelberg, Germany.
Title of the German original: Java-Entwicklung mit Eclipse 3
ISBN: 3-89864-281-X
Translation copyright © 2005 John Wiley & Sons Ltd,
The Atrium, Southern Gate, Chichester,
West Sussex PO19 8SQ, England
Telephone (+44) 1243 779777
Email (for orders and customer service enquiries):
Visit our Home Page on www.wileyeurope.com or www.wiley.com
All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system or
transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or
otherwise, except under the terms of the Copyright, Designs and Patents Act 1988 or under the terms of
a licence issued by the Copyright Licensing Agency Ltd, 90 Tottenham Court Road, London W1T 4LP,
UK, without the permission in writing of the Publisher, with the exception of any material supplied


specifically for the purpose of being entered and executed on a computer system for exclusive use by the
purchaser of the publication.Requests to the Publisher should be addressed to the Permissions
Department, John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex PO19 8SQ,
England, or emailed to , or faxed to (+44) 1243 770620.
This publication is designed to provide accurate and authoritative information in regard to the subject
matter covered. It is sold on the understanding that the Publisher is not engaged in rendering profes-
sional services. If professional advice or other expert assistance is required, the services of a competent
professional should be sought.
Other Wiley Editorial Offices
John Wiley & Sons Inc., 111 River Street, Hoboken, NJ 07030, USA
Jossey-Bass, 989 Market Street, San Francisco, CA 94103-1741, USA
Wiley-VCH Verlag GmbH, Boschstr. 12, D-69469 Weinheim, Germany
John Wiley & Sons Australia Ltd, 33 Park Road, Milton, Queensland 4064, Australia
John Wiley & Sons (Asia) Pte Ltd, 2 Clementi Loop #02-01, Jin Xing Distripark, Singapore 129809
John Wiley & Sons Canada Ltd, 22 Worcester Road, Etobicoke, Ontario, Canada M9W 1L1
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may
not be available in electronic books.
British Library Cataloguing in Publication Data
A catalogue record for this book is available from the British Library
ISBN: 0-470-02005-9
Typeset in Indianapolis, IN USA
Printed and bound by Malloy printing in Ann Arbor, MI USA
This book is printed on acid-free paper responsibly manufactured from sustainable forestry
in which at least two trees are planted for each one used for paper production.
01_020059_ffirs.qxd 10/8/04 10:55 AM Page iv
Credits
Author
Berthold Daum
Executive Editor
Gaynor Redvers-Mutton

Production Editors
Felicia Robinson
Juliet Booker
Book Producer
Ryan Publishing Group, Inc.
Copy Editor
Linda Recktenwald
Compositor
Gina Rexrode
Illustrator
Nathan Clement
Vice President & Executive Group Publisher
Richard Swadley
Vice President & Publishing Director
Sarah Stevens
Vice President and Publisher
Joseph B. Wikert
Editorial Manager
Kathryn Malm
01_020059_ffirs.qxd 10/8/04 10:55 AM Page v
01_020059_ffirs.qxd 10/8/04 10:55 AM Page vi
About the Author
Berthold Daum has a Ph.D. in Mathematics and is a professional Java and XML developer who has
been using Eclipse since it was first developed. Mr. Daum specializes in innovative electronic business
technology and electronic content production; his clients include SAP Integrated Services AG and
Software AG. His experience in software training and ability to anticipate the needs of professional
developers has been demonstrated in his previous books, including Eclipse 2 for Java Developers (Wiley)
and Modeling Business Objects with XML Schema (Morgan-Kaufmann).
Mr. Daum studied photography in Melbourne and has both exhibited and published his images of
Australia's natural beauty.

01_020059_ffirs.qxd 10/8/04 10:55 AM Page vii
01_020059_ffirs.qxd 10/8/04 10:55 AM Page viii
Introduction
The first version of Eclipse was released in November 2001. Eclipse was announced by IBM as a $40 mil-
lion donation to the Open Source community. The first reactions to this gift, however, were mixed. While
many Java programmers hailed the release of Eclipse enthusiastically (when would one not be enthusi-
astic about a $40 million present?), Sun Microsystems was initially less than amused.
In the meantime, Eclipse has taken the Java world (and not only the Java world) by storm, despite the
fact that Sun Microsystems is still not onboard. Eclipse is now completely managed by eclipse.org, an
independent, nonprofit organization in which, however, IBM plays a major role. Despite the fact that the
membership fee is quite hefty ($250.00 per year) and commitment is asked in the form of staff members
working actively toward the development of Eclipse, the membership circle is not at all small: the
Eclipse consortium has about 150 member companies, and people from Ericsson, Genuitec LLC, IBM,
Hewlett Packard, Intel, MontaVista Software, QNX Software Systems Ltd., SAP AG, SAS, Serena
Software, and the University of Washington belong to the board (Microsoft, you guessed it, is not a
member).
So, the question is, what is Eclipse? Is it a Java IDE? Is it a new GUI for Java applications? Is it an
application platform or framework?
Eclipse.org refers to Eclipse as a platform for “everything and nothing in particular.” That we
can use Eclipse to develop Java programs (in fact, it is one of the finest Java IDEs) is just a special appli-
cation of this platform. But its real application domain reaches far beyond Java development. Because
of its plug-in architecture, Eclipse is as adaptable as a chameleon and can find a habitat in quite different
environments. The Eclipse Java IDE is, in fact, only an eminent example of an Eclipse plug-in. A large
number of other plug-ins have already been developed for Eclipse by various companies and developers
or are currently in development (see Appendix A for a small selection of such developments). For
example, there is a plug-in for a C++ IDE, while plug-ins for other programming languages such as RPG
and COBOL are in preparation. In this book, however, we will concentrate on Java development with
Eclipse.
Eclipse is more than a pure development environment. With its SWT and JFace libraries it provides an
alternative to Sun’s Java libraries, AWT and Swing. SWT and JFace allow the creation of Java applica-

tions that closely match native applications (i.e., applications written in C or C++) in both “look and
feel” and in responsiveness. In contrast, applications implemented on the basis of Swing often lack
responsiveness and sometimes differ—despite the possibility to switch skins—from the “look and feel”
of a native application. Such applications are notoriously hard to sell, because end users expect applica-
tions that fulfill the standards of the host platform. SWT and JFace could therefore be a breakthrough for
Java applications on the desktop. No wonder, therefore, that there is a heated debate for and against
SWT/JFace in the respective discussion forums (for example,
www.javalobby.com) and that the
SWT was voted as the “most innovative Java component.”
Finally, Eclipse provides a large framework for implementing Java applications. Besides the GUI libraries
SWT and JFace, we find higher-level components such as editors, viewers, resource management, task
and problem management, a help system, and various assistants and wizards. Eclipse uses all these
01_020059_ffirs.qxd 10/8/04 10:55 AM Page ix
x
Introduction
components to implement features such as the Java IDE or the workbench, but they can also be used
for your own applications. In particular, the Rich Client Platform that was introduced with Eclipse 3
provides a generic framework for a wide class of applications. The Eclipse license model allows users
to embed these components into their own applications, to modify them, and to deploy them as part of
their own applications—all without paying a cent in license fees. The complete Eclipse code is available
as source code, can be browsed online, and can be used within you own projects.
The Eclipse Culture
Of course, Eclipse was not just “invented”: it has a history. The author of this book, who has used Visual
Age for Java for years, can detect many of the Visual Age construction elements within Eclipse. In fact,
the same company that stood behind the development of Visual Age is also responsible for the develop-
ment of Eclipse. This company is OTI (
www.oti.com). As long ago as 1988, OTI developed a collabora-
tive development environment for Smalltalk called ENVY, which was later licensed to IBM under the
name Visual Age. What followed was the development of Visual Age for Java, but this was still imple-
mented in Smalltalk. Now, OTI has started the next generation of development tools with Eclipse. Of

course, we find many of the design elements of Visual Age in Eclipse. The difference is, however, that
Eclipse is implemented in Java and that it features a much more open architecture than Visual Age.
Eclipse was licensed by IBM and than donated to the Open Source community. This was not done without
self-interest: Eclipse basically is nothing more than the community edition of IBM’s WebSphere Studio
Application Developer (WSAD). The core platform and the core plug-ins are all the same. The main differ-
ence is that Eclipse 3.0 consists of about 90 plug-ins, while WSAD features about 500–700 plug-ins, thus
offering greatly extended functionality, such as plug-ins for developing web and database applications.
About This Book
It is practically impossible to write a single book about Eclipse. The sheer complexity of Eclipse would
require quite a few books. I have tried to emphasize those topics where Eclipse makes significant contri-
butions to the Java world. In particular, these are the new GUI libraries (SWT and JFace) and the use of
Eclipse as a platform and framework for desktop applications. What had to be excluded from this book
are WebSphere-specific topics such as J2EE and servlet development. Developing desktop applications is
currently one of the strong points of Eclipse.
This book is not an introduction to Java programming. We assume that readers have a good knowledge
of Java and of object-oriented programming concepts. Most of the examples used in this book are not
trivial. Two examples come from the multimedia area. Here, readers have the possibility of “getting their
feet wet” with cutting-edge Java technology such as speech processing and MP3 (all in pure Java!). In the
third example, we do something useful and implement a spell checker plug-in for Eclipse. I am sick and
tired of bad orthography in Java comments! The last example is a board game implemented on the basis
of the Rich Client Platform, just to burn some of the programmer’s spare time gained by productivity
enhancements of the Eclipse IDE.
This book, therefore, addresses Java programmers—from the student to the professional—who want to
implement their own desktop applications with the help (or on the basis) of Eclipse. You will learn all
the techniques that are required to create applications of professional quality.
01_020059_ffirs.qxd 10/8/04 10:55 AM Page x
xi
Introduction
How This Book Is Organized
The novice to Eclipse—or even an experienced Java programmer—is at first overwhelmed by the sheer

number of functions. But the functions visible to the user are only the tip of the iceberg. If we start to
explore the inner workings of Eclipse, its API, we can get lost easily. Currently the Eclipse download has
a size of 83 MB.
Faced with this huge amount of information, this book uses a pragmatic approach. Following the motto
that “perception works from the outside to the inside,” I first investigate how Eclipse presents itself to
the end user. The benefit is twofold: first, each programmer is an end user of the Eclipse Java IDE;
second, the various components of the Eclipse workbench, such as editors, views, menus, dialogs, and
much more, can also be used in personal applications. Experienced programmers, however, may find an
introduction into the Java IDE trivial and superfluous. Nevertheless, it is useful to get well acquainted
with the Eclipse user interface, because many of the concepts and details can be later utilized when
designing you own applications.
In Chapters 1 through 7 of this book I first introduce practical work with Eclipse, in particular with the
Java development environment. Eclipse presents itself as a very powerful Java IDE that continues the
positive traditions of Visual Age for Java but also introduces new concepts such as code completion,
strong refactoring facilities, assistants that make intelligent proposals for fixing program errors, and a
local history that allows a return to previous code versions.
In these chapters I also discuss the organization of the workbench, the resources of the Eclipse
workspace such as projects, folders, and files, how these resources are related to the native file system,
and the tools for navigation. I explain what perspectives are and how they can be used effectively. The
Eclipse Java debugger and the integration of JUnit into Eclipse are discussed, and a short introduction
about Eclipse’s support for working in a team is given.
The examples used in this part are still all based on AWT and Swing.
However, this will quickly change in the second part of the book, Chapters 8 through 10. Here, I intro-
duce the secrets of the SWT and JFace libraries. For SWT, event processing is discussed, along with the
various GUI elements such as text fields, tables, buttons, and trees; the various layout options; graphics
operations and how Java2D can coexist with the SWT; and printer output. I also explain the specialties of
thread and resource management in the context of the SWT and the integration of SWT widgets with
Swing facilities.
In the case of the JFace library, I present the higher user interface levels such as windows, dialogs,
viewers, actions, menus, text processing, wizards, and preferences. As an example, an MP3 player that

can be deployed independently of the Eclipse platform is implemented completely with SWT and JFace.
An interesting detail in this example is how the SWT library is used in a multithreaded application.
In Chapters 11 through 16 I explain how to develop your own products on the basis of the Eclipse plat-
form: either as a plug-in to Eclipse or as a stand-alone application under the Rich Client Platform. Since
Eclipse consists more or less only of plug-ins, I first introduce the plug-in architecture of Eclipse. The
requirements for a minimal platform are discussed, and I show how workspace resources are used in
Eclipse and how plug-ins are declared via a manifest. Then the various components of the Eclipse work-
bench such as editors, views, actions, dialogs, forms, wizards, preferences, perspectives, and the help
01_020059_ffirs.qxd 10/8/04 10:55 AM Page xi
xii
Introduction
system are introduced. All these components are available to the application programmer as building
blocks, a fact that can speed up application development considerably.
Then, I show how your own products can be packaged for deployment. Eclipse offers integrated support
for all tasks here, too: from the creation of a feature, to the creation of nation language fragment and the
definition of an update site, to the automated installation of updates. As an example, a universal and
fully functional plug-in for spell checking on Eclipse platforms is implemented.
Finally, I discuss the Rich Client Platform (RCP) that was introduced with Eclipse 3 and serves as a
generic platform for a wide range of applications. The board game Hex is implemented as an example of
such an RCP application.
In Appendix A some more interesting third-party plug-ins are listed. In Appendix B I discuss the migra-
tion to another version of the Eclipse platform. Appendix C contains download addresses for the third-
party software and the source code used in the examples.
Acknowledgements
Books are always teamwork, even if only the author’s name appears below the title. This is also the case
with this book, and here is the place to acknowledge the contribution of all the other team members.
Special thanks go to the publisher John Wiley & Sons and Wrox, in particular to Gaynor Redvers-Mutton
who acted as the publishing editor. Thanks go also to the publisher of the original German edition,
dpunkt verlag, and the responsible editor there, René Schönfeldt.
Thanks also to Tim Ryan’s group who handled the production of this book, especially Linda

Recktenwald for copyediting, Gina Rexrode for composition, and Nathan Clement for his technical
illustrations.
Many important tips that found their way into this book came from the (anonymous) reviewers but also
from developers and employees of OTI who had looked at the first manuscript version. Many thanks!
And of course, without the development of Eclipse this book would not have been written, and Eclipse
is indeed a tool that I wouldn’t want to miss. Thanks again!
Berthold Daum
June 2004

01_020059_ffirs.qxd 10/8/04 10:55 AM Page xii
Contents
Introduction ix
Chapter 1: Introduction to Eclipse 1
Installing Eclipse 1
The First Application: Hello World 5
Perspectives 5
Projects 7
Create a New Class 7
Launch 9
The Most Important Preferences for Java Development 10
Workbench Preferences 11
Installed JREs 12
Compiler Preferences 14
Formatting Code 15
Templates 16
Tasks and Problems 18
Problems, Problems 19
General Tasks 21
Bookmarks 22
The Scrapbook 22

Summary 24
Chapter 2: Effective Programming with Eclipse 25
Little Helpers 25
System Information 25
Help and Hover 26
Java Information Views 27
Automatic Code Completion 28
The Correction Assistant 33
Convenience Functions of the Java Editor 35
Source Code Navigation 36
Refactoring Code 38
Modifying Types 38
Refactoring Code 39
Undo and Redo 42
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xiii
xiv
Contents
Local History 43
Comparing Resources 43
Replacing with an Older Version 43
Restore Deleted Resource 43
Summary 44
Chapter 3: The Art of (Visual) Composition 45
Installation 45
Invocation 46
Preferences 46
Composition 46
Beans and Bean Properties 48
Generic Beans 48
Properties 48

Layouts 49
Event Processing 49
Summary 50
Chapter 4: Organizing Your Code 51
The Workbench 51
Resources 52
Resource Types 52
Where Resources Are Stored 52
Synchronizing Resources 53
Navigation 53
Associations 54
Packages 55
Folders and Packages 55
Navigation 56
Hierarchy 56
The Outline View 57
Representation 58
Context Functions 59
Searching 60
The Search Function 60
Find and Replace 62
Marking Name Occurrences 63
Arranging Editors and Views 63
Docked Windows 63
Stacked Windows 64
Desktop Windows 64
FastView 64
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xiv
xv
Contents

Opening and Closing Windows 65
Maximizing Windows 65
Minimizing Views 65
Managing Perspectives 65
Defining New Perspectives 65
Configuring Perspectives 66
Importing Files 67
Project Properties 69
The Java Browsing Perspective 71
Summary 72
Chapter 5: Project One: Duke Speaks 73
Setting Up the Project 73
A Short Excursion into Speech Synthesis 74
Extending the FreeTTS System 75
Animation Events 75
The Animator 77
Embedding into FreeTTS 81
Connection with the Java Audio System 83
The User Interface 84
The Animated Face 85
The Control Panel 87
The Model 87
The Presentation 91
The Complete Application 106
Exporting the application 109
Bibliography 110
Summary 110
Chapter 6: Project Development 113
Debugging 113
The Debug Configuration 113

The Debug Perspective 114
Controlling Program Execution 115
Managing Breakpoints 117
The Java Console 118
Remote Debugging 119
JUnit 120
Setting Up JUnit 120
Creating a Test Suite 122
Running a Test Suite 124
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xv
xvi
Contents
Documentation 125
Try It Out: Javadoc Options 126
Try It Out: Command-Line Options 126
Summary 128
Chapter 7: Advanced Topics of Project Development 129
Developing in a Team 129
Setting Up a Repository 130
Projects in the Repository 132
Version Management 133
Working in a Team 133
Other Functions 135
External Tools 135
Refresh 135
Environment 135
Associations 135
Summary 136
Chapter 8: The SWT Library 137
SWT Function Group Overview 138

SWT—Pros and Cons 139
Advantages of SWT 140
Disadvantages of SWT 140
The SWT Package 141
Events 141
Listeners 141
Adapters 142
Events 142
Overview of Listeners, Adapters, and Events 143
Widgets 145
The Widget Class 146
The Control Class 146
Visual Overview 146
Displays, Shells, and Monitors 146
Dialogs 152
Composites, Groups, and Canvas 155
Buttons 156
Sliders and Scales 158
ProgressBar 159
Scrollable and ScrollBar 159
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xvi
xvii
Contents
Text Fields and Labels 159
Tables, Lists, and Combos 161
Trees 166
Sashes 167
Tabbed Folders 168
Toolbars 169
Moveable Tool Groups (CoolBar) 170

Menus 170
Custom Widgets 174
The Browser Widget 177
Layouts 177
Visual Overview 178
The FillLayout Class 178
The RowLayout Class 179
The GridLayout Class 180
The FormLayout Class 182
The StackLayout class 184
Graphics 185
The Graphics Context 185
Colors 186
Fonts 187
Images 189
The Cursor 190
Widgets That Swing 191
Embedded Contents 192
Events 192
Output to a Printer 196
Data Transfer 198
The Clipboard 198
Drag and Drop 199
Resource Management 200
Windows32 Support (OLE) 201
SWT on the Pocket PC 202
Accessibility 202
Summary 203
Chapter 9: JFace 205
Resource Management 205

The FontRegistry Class 205
The ImageRegistry Class 206
The JFaceColors Class 206
The JFaceResources Class 206
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xvii
xviii
Contents
Dialogs and Windows 206
Some Dialog Subclasses 207
Implementing Your Own Dialog Classes 210
Making Dialogs Persistent 213
Viewers 214
The Viewer Event Model 215
The Viewer Hierarchy 215
Cell Editors 217
Data Transfer 218
Text Processing 218
Text Processing Base Classes 218
The ProjectionViewer 226
Comfortable Text Fields and Combos 226
Actions and Menus 226
The IAction Interface 226
The Managers 227
Wizards 228
The Wizard Class 228
The WizardPage Class 229
The WizardSelectionPage Class 230
The WizardDialog Class 230
Preferences 230
The PreferenceStore and PreferenceConverter Classes 231

The PreferencePage Class 232
Field Editors 232
Preference Page Trees 233
Summary 235
Chapter 10: Project Two: Jukebox 237
Design Goals and How to Achieve Them 237
Installing the Project 238
The Player Module 241
Layout 241
Threads 242
The Player.java Class 243
BasicPlayerListener 260
The Playlist Domain Model 261
The Interface 261
Implementing IPlayList 268
Accessing Features 270
Managing Entries 271
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xviii
xix
Contents
Content Provider 273
Playlist Switch 273
Selections 274
The Description Window 275
The DescriptionWindow Class 276
The Playlist Viewer 278
The PlaylistWindow Class 278
The PlaylistViewer Class 281
Nested Grid Layout 289
Toolbar 290

File-Selection Dialogs 292
Menu 293
The PlaylistLabelProvider Class 295
Returning a Warning Icon 296
Cell Text 297
The FileCellEditor Class 299
The Description Editor 300
The DescriptionCellEditor Class 300
The DescriptionEditorDialog Class 302
Code Scanner 303
Content Assistant 304
SourceViewer Configuration 307
SourceViewer 308
Deploying the Jukebox 311
Summary 311
Chapter 11: Developing Plug-ins for the Eclipse Platform 313
The Architecture of the Eclipse Platform 314
Extension Points 314
OSGi 314
A Minimal Platform 315
Rich Client Platform vs. IDE 315
Resource Management 315
User Interface 316
Help System 316
Team Support 316
Other Plug-in Groups 317
Architecture Summary 317
The Core Classes of the Eclipse Platform 318
The Platform Class 318
The Plugin Class 318

02_020059_ftoc.qxd 10/8/04 10:55 AM Page xix
xx
Contents
The Preferences Class 319
Path Specifications 319
Monitoring Long-Running Processes 320
The Eclipse Workspace 320
Resources 320
Markers 324
Reacting to Resource Changes 325
Managing Long-Running Processes 326
Configuring Plug-ins 327
The Plug-in Development Perspective 327
The Plug-in Manifest 329
The Most Important SDK Extension Points 332
The Schema Editor 341
Components of the Eclipse User Interface 344
Forms 344
The Eclipse Workbench 350
The Architecture of the Eclipse Workbench 351
Event Processing in the Eclipse Workbench 352
Editors 355
Views 362
Actions 367
Dialogs 372
Workbench Wizards 374
Preferences and Property Pages 377
Defining Perspectives 377
The Help System 379
Cheat Sheets 383

Summary 385
Chapter 12: Developing Your Own Eclipse-Based Products 387
Embedded Ant 388
Configuration 388
Editing Ant Scripts 389
Plug-ins and Fragments 390
Features 391
Creating and Editing Features 391
Deployment 393
Deploying a Feature 393
Deploying Complete Products 394
Customizing Products 394
Populating the Workspace 396
Creating Update Sites 398
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xx
xxi
Contents
Installing from an Update Site 399
Adding an Update Site 400
Installing Features 400
Updating Features 400
Managing the Configuration 400
Install Handlers 401
Internationalizing Products 401
Text Constants in Programs 402
Text Constants in Manifest Files 403
Help Texts and Cheat Sheets 404
Deploying National Language Resource Bundles 405
Patches 405
Summary 405

Chapter 13: Project Three: A Spell Checker as an Eclipse Plug-in 407
The Spell Checker Core Classes 408
The Engine 408
Overview 409
Setting Up the Project 410
The Plug-in Configuration 412
The Manifest plugin.xml 413
The Schema documentTokenizer.exsd 417
Imported Files 419
The Plugin Class 419
Dictionary URL 421
Initializing Preferences 422
The Manager 423
The Check Spelling Action 424
The SpellCheckingTarget Class 425
Factory Method 426
Selections 427
Document Management 428
Text Replacement 429
Disposal 430
The CheckSpellingActionDelegate Class 431
The Correction Window 439
The SpellCorrectionView Class 439
View Actions 449
Managing Images 450
Coordinating Core Classes with GUI Classes 452
The Manager 453
Selecting the Plug-in 454
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xxi
xxii

Contents
Running the Engine 457
Managing Engines 458
Creating Engines 459
Processing Bad Words 462
Operations 462
Analyzing Documents 463
Configuring the Spell Checker 463
Preferences 463
Domain Model 464
The GUI 466
Reading from the PreferenceStore 471
The Help System 473
The Help Table of Contents 473
Context-Sensitive Help 473
Active Help 474
Running the Help Action 476
A Plug-in for Java Properties 477
Setting Up the Project 477
The Manifest 478
Tokenizer Extension 478
Manifest 479
The Plugin Class 480
The Preferences 481
The Preference Page 482
The Java-Properties Tokenizer 483
The Help System 483
Internationalizing the Spell Checker 484
Text Constants in Java Code 484
Text Constants in Manifest Files 487

Creating a Language Fragment 487
Deploying the Spell Checker 490
Defining the Spell Checker Feature 490
Configuring Ant Scripts 492
Defining the Language Feature 495
Defining the Update Site 497
Installation 498
Summary 499
02_020059_ftoc.qxd 10/8/04 10:55 AM Page xxii

×