Eclipse Plug-ins
Producing a commercial-quality plug-in means going above and beyond the minimal requirements needed to integrate with Eclipse. It means attending to all those details that contribute to the “fit and polish” of a commercial offering. This comprehensive guide covers the entire process of plug-in development, including all the extra steps needed to achieve the highest quality results.

Building on two internationally best-selling previous editions, Eclipse Plug-ins, Third Edition, has been fully revised to reflect the powerful new capabilities of Eclipse 3.4. Leading Eclipse experts Eric Clayberg and Dan Rubel present detailed, practical coverage of every aspect of plug-in development, as well as specific, proven solutions for the challenges developers are most likely to encounter.

All code examples, relevant API listings, diagrams, and screen captures have been thoroughly updated to reflect both the Eclipse 3.4 API and the latest Java syntax. In addition, Clayberg and Rubel have completely revamped their popular Favorites View case study, reworking much of its content and recreating its code from scratch. The authors carefully cover new functionality added to existing Eclipse features, such as views and editors, and fully explain brand-new features such as Commands, GEF, and PDE Build.

This extensively revised edition
  • Thoroughly covers Eclipse’s new preferences
  • Illuminates the powerful new Eclipse Command Framework, which replaces Eclipse’s older Action Framework
  • Presents extensive new discussions of using commands with views and editors
  • Introduces Mylyn, the new task-focused interface that reduces information overload and simplifies multi-tasking
  • Contains an all-new chapter on using the Graphical Editing Framework (GEF) to build dynamic, interactive graphical user interface elements
  • Walks you step by step through the entire PDE Build process
  • Shows how to create update sites with p2, which replaces Eclipse’s old Update Manager
This book is designed for every experienced developer interested in extending the Eclipse platform, the Rational Software Development Platform, or any other platform that supports Eclipse plug-ins.
1100508839
Eclipse Plug-ins
Producing a commercial-quality plug-in means going above and beyond the minimal requirements needed to integrate with Eclipse. It means attending to all those details that contribute to the “fit and polish” of a commercial offering. This comprehensive guide covers the entire process of plug-in development, including all the extra steps needed to achieve the highest quality results.

Building on two internationally best-selling previous editions, Eclipse Plug-ins, Third Edition, has been fully revised to reflect the powerful new capabilities of Eclipse 3.4. Leading Eclipse experts Eric Clayberg and Dan Rubel present detailed, practical coverage of every aspect of plug-in development, as well as specific, proven solutions for the challenges developers are most likely to encounter.

All code examples, relevant API listings, diagrams, and screen captures have been thoroughly updated to reflect both the Eclipse 3.4 API and the latest Java syntax. In addition, Clayberg and Rubel have completely revamped their popular Favorites View case study, reworking much of its content and recreating its code from scratch. The authors carefully cover new functionality added to existing Eclipse features, such as views and editors, and fully explain brand-new features such as Commands, GEF, and PDE Build.

This extensively revised edition
  • Thoroughly covers Eclipse’s new preferences
  • Illuminates the powerful new Eclipse Command Framework, which replaces Eclipse’s older Action Framework
  • Presents extensive new discussions of using commands with views and editors
  • Introduces Mylyn, the new task-focused interface that reduces information overload and simplifies multi-tasking
  • Contains an all-new chapter on using the Graphical Editing Framework (GEF) to build dynamic, interactive graphical user interface elements
  • Walks you step by step through the entire PDE Build process
  • Shows how to create update sites with p2, which replaces Eclipse’s old Update Manager
This book is designed for every experienced developer interested in extending the Eclipse platform, the Rational Software Development Platform, or any other platform that supports Eclipse plug-ins.
44.99 In Stock
Eclipse Plug-ins

Eclipse Plug-ins

by Eric Clayberg, Dan Rubel
Eclipse Plug-ins

Eclipse Plug-ins

by Eric Clayberg, Dan Rubel

eBook

$44.99  $47.99 Save 6% Current price is $44.99, Original price is $47.99. You Save 6%.

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

Producing a commercial-quality plug-in means going above and beyond the minimal requirements needed to integrate with Eclipse. It means attending to all those details that contribute to the “fit and polish” of a commercial offering. This comprehensive guide covers the entire process of plug-in development, including all the extra steps needed to achieve the highest quality results.

Building on two internationally best-selling previous editions, Eclipse Plug-ins, Third Edition, has been fully revised to reflect the powerful new capabilities of Eclipse 3.4. Leading Eclipse experts Eric Clayberg and Dan Rubel present detailed, practical coverage of every aspect of plug-in development, as well as specific, proven solutions for the challenges developers are most likely to encounter.

All code examples, relevant API listings, diagrams, and screen captures have been thoroughly updated to reflect both the Eclipse 3.4 API and the latest Java syntax. In addition, Clayberg and Rubel have completely revamped their popular Favorites View case study, reworking much of its content and recreating its code from scratch. The authors carefully cover new functionality added to existing Eclipse features, such as views and editors, and fully explain brand-new features such as Commands, GEF, and PDE Build.

This extensively revised edition
  • Thoroughly covers Eclipse’s new preferences
  • Illuminates the powerful new Eclipse Command Framework, which replaces Eclipse’s older Action Framework
  • Presents extensive new discussions of using commands with views and editors
  • Introduces Mylyn, the new task-focused interface that reduces information overload and simplifies multi-tasking
  • Contains an all-new chapter on using the Graphical Editing Framework (GEF) to build dynamic, interactive graphical user interface elements
  • Walks you step by step through the entire PDE Build process
  • Shows how to create update sites with p2, which replaces Eclipse’s old Update Manager
This book is designed for every experienced developer interested in extending the Eclipse platform, the Rational Software Development Platform, or any other platform that supports Eclipse plug-ins.

Product Details

ISBN-13: 9780321619501
Publisher: Pearson Education
Publication date: 12/11/2008
Series: Eclipse Series
Sold by: Barnes & Noble
Format: eBook
Pages: 928
File size: 20 MB
Note: This product may take a few minutes to download.

About the Author

Eric Clayberg is Senior VP for Product Development for Instantiations, Inc., an Advanced IBM Business Partner that serves on the Eclipse Foundation and contributes extensively to the Eclipse initiative. He has more than seventeen years of commercial software development experience, including twelve years with Java and nine with Eclipse. He is primary architect and product manager for many award-winning Java and Smalltalk products, including WindowBuilder Pro, CodePro, and VA Assist. He has a B.S. from MIT, an MBA from Harvard, and has cofounded two successful software companies–ObjectShare and Instantiations.

Dan Rubel,
CTO for Instantiations, Inc., is an entrepreneur and an expert in the design and application of object-oriented technologies with more than fifteen years of commercial software development experience, including thirteen years of experience with Java and nine years with Eclipse. He is the primary architect and product manager for several successful products, including RCP Developer, WindowTester, jFactor, and jKit.  He has a B.S. from Bucknell and is a cofounder of Instantiations.

Table of Contents

Foreword by Skip McGaughey     xxxiii
Foreword by Simon Archer      xxxv
Preface      xxxvii

Chapter 1: Using Eclipse Tools      1

1.1 Getting Started    1
1.2 The Eclipse Workbench    3
1.3 Setting Up Your Environment    14
1.4 Creating a Project     19
1.5 Navigating     26
1.6 Searching     28
1.7 Writing Code     35
1.8 Team Development Using CVS     49
1.9 Running Applications     55
1.10 Introduction to Debugging     59
1.11 Introduction to Testing     63
1.12 Introduction to Mylyn     65
1.13 Summary     69

Chapter 2: A Simple Plug-in Example      71
2.1 The Favorites Plug-in     71
2.2 Creating a Plug-in Project     72
2.3 Reviewing the Generated Code     77
2.4 Building a Product     86
2.5 Installing and Running the Product     92
2.6 Debugging the Product    94
2.7 PDE Views     96
2.8 Writing Plug-in Tests     99
2.9 Book Samples     105
2.10 Summary     106

Chapter 3: Eclipse Infrastructure     107
3.1 Structural Overview    107
3.2 Plug-in Directory or JAR file    110
3.3 Plug-in Manifest     113
3.4 Activator or Plug-in Class     120
3.5 Plug-in Model     126
3.6 Logging    128
3.7 Eclipse Plug-ins     132
3.8 Summary     133

Chapter 4: The Standard Widget Toolkit      135
4.1 SWT History and Goals    135
4.2 SWT Widgets    138
4.3 Layout Management     178
4.4 Resource Management     188
4.5 GUI Builders     190
4.6 Summary     191

Chapter 5: JFace Viewers     193
5.1 List-Oriented Viewers     193
5.2 Text Viewers     211
5.3 Summary     214

Chapter 6: Commands and Actions     215
6.1 Commands     216
6.2 Menu and Toolbar Contributions     220
6.3 Handlers    236
6.4 Key Bindings     238
6.5 IAction versus IActionDelegate     240
6.6 Workbench Window Actions    242
6.7 Object Actions     257
6.8 View Actions     270
6.9 Editor Actions     277
6.10 Actions and Key Bindings     284
6.11 RFRS Considerations     286
6.12 Summary     287

Chapter 7: Views      289
7.1 View Declaration     291
7.2 View Part     293
7.3 View Commands     313
7.4 Linking the View     336
7.5 Saving View State    340
7.6 Testing     345
7.7 Image Caching     346
7.8 Auto-sizing Table Columns     348
7.9 RFRS Considerations     348
7.10 Summary     352

Chapter 8: Editors      353
8.1 Editor Declaration     354
8.2 Editor Part     358
8.3 Editing     372
8.4 Editor Lifecycle     378
8.5 Editor Commands     381
8.6 Linking the Editor     400
8.7 RFRS Considerations     401
8.8 Summary     405

Chapter 9: Resource Change Tracking      407
9.1 IResourceChangeListener     407
9.2 Processing Change Events     411
9.3 Batching Change Events     414
9.4 Progress Monitor     415
9.5 Delayed Changed Events    420
9.6 Summary     421

Chapter 10: Perspectives     423
10.1 Creating a Perspective     423
10.2 Enhancing an Existing Perspective     430
10.3 RFRS Considerations    438
10.4 Summary     439

Ch apter 11: Dialogs and Wizards      441
11.1 Dialogs     441
11.2 Wizards     464
11.3 RFRS Considerations     482
11.4 Summary     484

Chapter 12: Preference Pages     485
12.1 Creating a Preference Page     485
12.2 Preference Page APIs     487
12.3 Preference APIs     501
12.4 RFRS Considerations     508
12.5 Summary     509

Chapter 13: Properties      511
13.1 Creating Properties     511
13.2 Displaying Properties in the Properties Dialog     515
13.3 Displaying Properties in the Properties View     524
13.4 Property Pages Reused as Preference Pages    529
13.5 RFRS Considerations   530
13.6 Summary     531

Chapter 14: Builders, Markers, and Natures      533
14.1 Builders     535
14.2 Markers     548
14.3 Natures     561
14.4 RFRS Considerations     572
14.5 Summary     575

Chapter 15: Implementing Help      577
15.1 Using Help    577
15.2 Implementing Help     580
15.3 Context-Sensitive Help (F1)     591
15.4 Accessing Help Programmatically     599
15.5 Cheat Sheets     601
15.6 RFRS Considerations     611
15.7 Summary     614

Chapter 16: Internationalization     617
16.1 Externalizing the Plug-in Manifest     618
16.2 Externalizing Plug-in Strings     620
16.3 Using Fragments     629
16.4 Manual Testing     636
16.5 Summary     636

Chapter 17: Creating New Extension Points      637
17.1 The Extension Point Mechanism      637
17.2 Defining an Extension Point     639
17.3 Code Behind an Extension Point    649
17.4 Extension Point Documentation    656
17.5 Using the Extension Point    657
17.6 RFRS Considerations    659
17.7 Summary     660

Chapter 18: Features, Branding, and Updates     661
18.1 Feature Projects     662
18.2 Branding     673
18.3 Update Sites     679
18.4 RFRS Considerations     689
18.5 Summary     691

Chapter 19: Building a Product      693
19.1 A Brief Introduction to Ant      693
19.2 Building with PDE      711
19.3 Debugging the PDE Build process     726
19.4 Summary     729

Chapter 20: GEF: Graphical Editing Framework      731
20.1 GEF Architecture     731
20.2 GEF Model     732
20.3 GEF Controller     733
20.4 GEF Figures     743
20.5 GEF in an Eclipse View    754
20.6 GEF in an Eclipse Editor     758
20.7 Palette     775
20.8 Summary     778

Chapter 21: Advanced Topics     779
21.1 Advanced Search–Reference Projects     780
21.2 Accessing Internal Code     781
21.3 Adapters     784
21.4 Opening a Browser or Creating an Email     788
21.5 Types Specified in an Extension Point     793
21.6 Modifying Eclipse to Find Part Identifiers     797
21.7 Label Decorators     802
21.8 Background Tasks–Jobs API     808
21.9 Plug-in ClassLoaders     811
21.10 Early Startup     816
21.11 Rich Client Platform     817
21.12 Conclusion     818

Appendix A: Eclipse Plug-ins and Resources     819
A.1 Plug-ins      819

Appendix B:  Ready for Rational Software    831

Index 833

Preface

PrefacePreface

When we were first exposed to Eclipse back in late 1999, we were struck by the magnitude of the problem IBM was trying to solve. IBM wanted to unify all its development environments on a single code base. At the time, the company was using a mix of technology composed of a hodgepodge of C/C++, Java, and Smalltalk.Preface

Many of IBM’s most important tools, including the award-winning Visual-Age for Java IDE, were actually written in Smalltalk—a wonderful language for building sophisticated tools, but one that was rapidly losing market share to languages like Java. While IBM had one of the world’s largest collections of Smalltalk developers, there wasn’t a great deal of industry support for it outside of IBM, and there were very few independent software vendors (ISVs) qualified to create Smalltalk-based add-ons.

Meanwhile, Java was winning the hearts and minds of developers world-wide with its promise of easy portability across a wide range of platforms, while providing the rich application programming interface (API) needed to build the latest generation of Web-based business applications. More important, Java was an object-oriented (OO) language, which meant that IBM could leverage the large body of highly skilled object-oriented developers it had built up over the years of creating Smalltalk-based tools. In fact, IBM took its premiere Object Technology International (OTI) group, which had been responsible for creating IBM’s VisualAge Smalltalk and VisualAge Java environments (VisualAge Smalltalk was the first of the VisualAge brand family and VisualAge Java was built using it), and tasked the group with creating ahighly extensible integrated development environment (IDE) construction set based in Java. Eclipse was the happy result.

OTI was able to apply its highly evolved OO skills to produce an IDE unmatched in power, flexibility, and extensibility. The group was able to replicate most of the features that had made Smalltalk-based IDEs so popular the decade before, while simultaneously pushing the state of the art in IDE development ahead by an order of magnitude.

The Java world had never seen anything as powerful or as compelling as Eclipse, and it now stands, with Microsoft’s .NET, as one of the world’s premier development environments. That alone makes Eclipse a perfect platform for developers wishing to get their tools out to as wide an audience as possible. The fact that Eclipse is completely free and open source is icing on the cake. An open, extensible IDE base that is available for free to anyone with a computer is a powerful motivator to the prospective tool developer.

It certainly was to us. At Instantiations and earlier at ObjectShare, we had spent the better part of a decade as entrepreneurs focused on building add-on tools for various IDEs. We had started with building add-ons for Digitalk’s Smalltalk/V, migrated to developing tools for IBM’s VisualAge Smalltalk, and eventually ended up creating tools for IBM’s VisualAge Java (including our award-winning VA Assist product and our jFactor product, one of the world’s first Java refactoring tools). Every one of these environments provided a means to extend the IDE, but they were generally not well-documented and certainly not standardized in any way. Small market shares (relative to tools such as VisualBasic) and an eclectic user base also afflicted these environments and, by extension, us.

As an Advanced IBM Business Partner, we were fortunate to have built a long and trusted relationship with the folks at IBM responsible for the creation of Eclipse. That relationship meant that we were in a unique position to be briefed on the technology and to start using it on a daily basis nearly a year and half before the rest of the world even heard about it. When IBM finally announced Eclipse to the world in mid-2001, our team at Instantiations had built some of the first demo applications IBM had to show. Later that year when IBM released its first Eclipse-based commercial tool, WebSphere Studio Application Developer v4.0 (v4.0 so that it synchronized with its then current VisualAge for Java v4.0), our CodePro product became the very first commercial add-on available for it (and for Eclipse in general) on the same day.

Currently, the CodePro product adds hundreds of enhancements to Eclipse and any Eclipse-based IDE. Developing CodePro over the last several years has provided us with an opportunity to learn the details of Eclipse development at a level matched by very few others (with the obvious exception of the IBM and OTI developers, who eat, sleep, and breathe this stuff on a daily basis). CodePro has also served as a testbed for many of the ideas and techniques presented in this book, providing us with a unique perspective from which to write.

Goals of the Book

This book, originally titled Eclipse: Building Commercial-Quality Plug-ins, provides an in-depth description of the process involved in building commercial-quality extensions for the Eclipse and the IBM Software Development Platform (SDP)—IBM’s commercial version of Eclipse—development environments. To us, “commercial-quality” is synonymous with “commercial-grade” or “high-quality.” Producing a commercial-quality plug-in means going above and beyond the minimal requirements needed to integrate with Eclipse. It means attending to all those details that contribute to the “fit and polish” of a commercial offering.

In the world of Eclipse plug-ins, very few people take the time to really go the extra mile, and most plug-ins fall into the open source, amateur category. For folks interested in producing high-quality plug-ins (which would certainly be the case for any software company wanting to develop Eclipse-based products), there are many details to consider. Our book is meant to encompass the entire process of plug-in development, including all the extra things that need to be done to achieve high-quality results. This book has several complementary goals:


  • Provide a quick introduction to using Eclipse for new users
  • Provide a reference for experienced Eclipse users wishing to expand their knowledge and improve the quality of their Eclipse-based products
  • Provide a detailed tutorial on creating sophisticated Eclipse plug-ins suitable for new and experienced users

The first three chapters introduce the Eclipse development environment and outline the process of building a simple plug-in. The intention of these chapters is to help developers new to Eclipse quickly pull together a plug-in they can use to experiment with.

The first chapter, in particular, introduces the reader to the minimum set of Eclipse tools that he or she will need to build plug-ins. It is a fairly quick overview of the Eclipse IDE and relevant tools (one could write an entire book on that topic alone), and we would expect expert Eclipse users to skip that chapter entirely.

The second chapter introduces the example that we will use throughout most of the book and provides a very quick introduction to building a working plug-in from start to finish. The third chapter presents a high-level overview of the Eclipse architecture and the structure of plug-ins and extension points.

The fourth and fifth chapters cover the Standard Widget Toolkit (SWT) and JFace, which are the building blocks for all Eclipse user interfaces (UIs). These chapters can act as a stand-alone reference; they are intended to provide just enough detail to get you going. Both of these topics are rich enough to warrant entire books and several are currently available.

The subsequent chapters, comprising the bulk of this book, focus on describing each of the various aspects of plug-in development and providing the reader with in-depth knowledge of how to solve the various challenges involved. Each chapter focuses on a different aspect of the problem, and includes an overview, a detailed description, a discussion of challenges and solutions, diagrams, screenshots, cookbook-style code examples, relevant API listings, and a summary.

We have structured the book so that the most important material required for every plug-in project appears in the first half of it. Some of the packaging- and building-oriented material is placed at the end (for example, features and product builds). This organizational scheme left several topics that, while not critical to every plug-in, were important to the creation of commercial-quality plug-ins. These topics have been placed in the second half of the book in an order based on the importance of each and how it related to earlier material. Internationalization, for example, is one of those topics. It isn’t critical, and it isn’t even all that complicated when you get right down to it. It is, however, important to the book’s premise, so we felt it was a topic we needed to include. Since we aren’t assuming that the reader is an Eclipse expert (or even a plug-in developer), we have tried to take the reader through each of the important steps in as much detail as possible. While it is true that this is somewhat introductory, it is also an area that most plug-in developers totally ignore and have little or no experience with.

Sometimes a developer needs a quick solution, while at other times that same developer needs to gain in-depth knowledge about a particular aspect of development. The intent is to provide several different ways for the reader to absorb and use the information so that both needs can be addressed. Relevant APIs are included in several of the chapters so that the book can be used as a stand-alone reference during development without requiring the reader to look up those APIs in the IDE. Most API descriptions are copied or paraphrased from the Eclipse platform Javadoc.

As the originators of Eclipse and a major consumer of Eclipse-based technology, IBM is justifiably concerned that new plug-ins meet the same high-quality standards that IBM adheres to. To that end, IBM has established a rigorous Ready for Rational Software (RFRS) certification program meant to ensure the availability of high-quality add-ons to Eclipse and the IBM Software Development Platform. RFRS certification should be one of the ultimate goals for anyone wishing to build and market Eclipse plug-ins. Every chapter covers any relevant RFRS certification criteria and strategies.

The examples provided as part of the chapters describe building various aspects of a concrete Eclipse plug-in that you will see evolve over the course of the book. When used as a reference rather than read cover-to-cover, you will typically start to look in one chapter for issues that are covered in another. To facilitate this type of searching, every chapter contains numerous cross-references to related material that appears in other chapters.

Intended Audience

The audience for this book includes Java tool developers wishing to build products that integrate with Eclipse and other Eclipse-based products, relatively advanced Eclipse users wishing to customize their environments, or anyone who is curious about what makes Eclipse tick. You do not need to be an expert Eclipse user to make use of this book because we introduce most of what you need to know to use Eclipse in Chapter 1, Using Eclipse Tools. While we don’t assume any preexisting Eclipse knowledge, we do anticipate that the reader is a fairly seasoned developer with a good grasp of Java and at least a cursory knowledge of extensible markup language (XML).

Conventions Used in This Book

The following formatting conventions are used throughout the book.

  • Bold—the names of UI elements such as menus, button tabs, and window titles
  • Italic—emphasize new terms and Web site addresses
  • Courier—code examples, references to class and method names, and filenames
  • Courier Bold—emphasize code fragments
  • “Quoted text”—quotation marks surrounding text indicates words to be entered by the user
What’s New in the Third Edition

In this edition, we use the same Favorites view example as in the first and second editions, but have reworked much of the content and recreated the code from scratch. Some Eclipse concepts, such as views and editors, are similar but with additional functionality and capabilities; other areas, such as commands, GEF and PDE Build have been added. The following are some of the major changes in this third edition:

Eclipse Command Framework

The Eclipse command framework replaces the older Action framework. Throughout the book, use of the older Action framework has been replaced with new content describing how to accomplish the same thing with the new command framework. This is most obvious in Chapter 6 where the first half of the chapter is entirely devoted to the command framework. Chapter 7 and Chapter 8 also have lots of new material describing use of commands with views and editors.

Eclipse 3.4 and Java 5

All of the screen shots, text and code examples throughout the book have been updated to use the latest Eclipse 3.4 API and Java 5 syntax. Chapter 1 has been overhauled to include descriptions of new capabilities in Eclipse 3.4 including a new overview of using Mylyn and disc Chapter 2 cover cool PDE and SWT tools available in Eclipse 3.4.

New GEF Chapter

GEF, the Graphical Editing Framework from Eclipse.org, provides a toolkit for building dynamic interactive graphical user interface elements. Chapter 20 takes you step by step through the process of building a GEF-based view for graphically presenting the relationships between the favorites items and their underlying resources. We then go further, building a GEF-based editor with the ability to add, move, resize, and delete the graphical elements representing those favorites items.

Put PDE Build through its paces

Over the past several years, the PDE build process has been steadily maturing. The proprietary Ant scripts in Chapter 19 of earlier versions of our book have been completely replaced with step-by-step instructions for getting an Eclipse PDE Build process up and running to automate assembly of your product for distribution.

New “p2” update site creation description

“p2” debuts in Eclipse 3.4, replacing the older Update Manager. We take you through the process of using update sites and then building your own in Section 18.3, Update Sites.


© Copyright Pearson Education. All rights reserved.

From the B&N Reads Blog

Customer Reviews