Eclipse Rich Client Platform: Designing, Coding, and Packaging Java™ Applications

Book description

Build Powerful, Cross-Platform Rich Client Applications

Eclipse is more than a state-of-the-art IDE: its Rich Client Platform (RCP) plug-ins form an outstanding foundation for any desktop application, from chat applications to enterprise software front-ends. In Eclipse Rich Client Platform, two leaders of the Eclipse RCP project show exactly how to leverage Eclipse for rapid, efficient, cross-platform desktop development.

In addition to explaining the power of Eclipse as a desktop application development platform, the authors walk step-by-step through developing a fully featured, branded RCP application. They introduce a wide range of techniques, including developing pluggable and dynamically extensible systems, using third-party code libraries, and packaging applications for diverse environments. You'll build, refine, and refactor a complete prototype; customize the user interface; add Help and Update features; and build, brand, and ship the finished software.

  • For every Java developer, regardless of previous Eclipse experience

  • Thoroughly covers Eclipse 3.1's new RCP features and its extensive new tools for designing, coding, and packaging RCP applications

  • Presents techniques for branding and customizing the look and feel of RCP applications

  • Shows how to overcome the challenges and "rough edges" of RCP development

  • Discusses the similarities and differences between RCP and conventional plug-in development

  • Includes an overview of OSGi, the base execution framework for Eclipse

  • If you want to develop and deploy world-class Java applications with rich, native GUIs, and use Eclipse RCP—get this book.

    CD-ROM contains the Eclipse 3.1 SDK, Eclipse 3.1 RCP SDK, and Eclipse 3.1 RCP Delta Pack appropriate for Windows, Linux, and Mac OS X. It also contains all the code samples developed in the book.

    © Copyright Pearson Education. All rights reserved.

    Table of contents

    1. Copyright
      1. Dedication
    2. The Eclipse Series
    3. Foreword by John Weigand
    4. Foreword by Jeff Norris
    5. Acknowledgments
    6. Preface
      1. About this Book
      2. Audience
      3. Sample Code
      4. Conventions
      5. Feedback
    7. I. Introduction
      1. 1. Eclipse as a Rich Client Platform
        1. 1.1. Eclipse
        2. 1.2. The Eclipse Rich Client Platform
        3. 1.3. Eclipse RCP Over the Years
        4. 1.4. Uses of RCP
          1. 1.4.1. IBM Workplace Client Technology™
          2. 1.4.2. NASA and Eclipse RCP
        5. 1.5. Summary
      2. 2. Eclipse RCP Concepts
        1. 2.1. A Community of Plug-ins
        2. 2.2. Inside Plug-ins
        3. 2.3. Putting a System Together
        4. 2.4. OSGi Framework
        5. 2.5. The Runtime
          1. 2.5.1. Applications
          2. 2.5.2. Products
          3. 2.5.3. Extension Registry
        6. 2.6. SWT
        7. 2.7. JFace
        8. 2.8. UI Workbench
          1. 2.8.1. Contribution-Based Extensibility
          2. 2.8.2. Perspectives, Views, and Editors
        9. 2.9. Summary
    8. II. RCP by Example
      1. 3. Tutorial Introduction
        1. 3.1. What Is Hyperbola?
        2. 3.2. The Evolution of Hyperbola
        3. 3.3. Development Environment Installation
        4. 3.4. Target Setup
        5. 3.5. Checkpoint
        6. 3.6. Sample Code
          1. 3.6.1. Moving from Chapter to Chapter
          2. 3.6.2. Comparing
        7. 3.7. Learning by Example
        8. 3.8. Summary
      2. 4. The Hyperbola Application
        1. 4.1. Hyperbola Hello World
        2. 4.2. Tour of the Code
          1. 4.2.1. Application
          2. 4.2.2. WorkbenchAdvisor
          3. 4.2.3. Perspective
          4. 4.2.4. WorkbenchWindowAdvisor
          5. 4.2.5. ActionBarAdvisor
          6. 4.2.6. Summary
        3. 4.3. Running and Debugging
          1. 4.3.1. Debugging
          2. 4.3.2. Launch Configurations
        4. 4.4. Summary
      3. 5. Starting the Hyperbola Prototype
        1. 5.1. Continuing from the Shell
          1. 5.1.1. Saving Window Location and Size
        2. 5.2. Adding a Contacts View
          1. 5.2.1. Adding the Contacts View to a Perspective
        3. 5.3. The Chat Model
        4. 5.4. Filling in the Contacts View
          1. 5.4.1. The ContactsView
          2. 5.4.2. Content Providers Overview
            1. 5.4.2.1. Adding the IWorkbenchAdapters
          3. 5.4.3. The Label Provider
        5. 5.5. Adding Images
        6. 5.6. Summary
        7. 5.7. Pointers
      4. 6. Adding Actions
        1. 6.1. Adding to the Menus and Toolbar
          1. 6.1.1. Create Top-level Menu
          2. 6.1.2. Menu Managers
          3. 6.1.3. The Add Contact Action
          4. 6.1.4. Adding the “Add Contact” Action
          5. 6.1.5. Customizable Toolbars
        2. 6.2. Adding to the Status Line
          1. 6.2.1. Status Line—A Shared Resource
        3. 6.3. System Tray Integration
          1. 6.3.1. Obtaining a Display
          2. 6.3.2. Creating the Tray Item
        4. 6.4. Summary
        5. 6.5. Pointers
      5. 7. Adding a Chat Editor
        1. 7.1. Views and Editors
        2. 7.2. Defining the Chat Editor
          1. 7.2.1. Editor Input
          2. 7.2.2. The Chat Action
        3. 7.3. Checkpoint
        4. 7.4. Summary
        5. 7.5. Pointers
      6. 8. Branding Hyperbola
        1. 8.1. Defining the Hyperbola Product
        2. 8.2. Window Images
        3. 8.3. Customizing the Launcher
        4. 8.4. Splash Screen
        5. 8.5. About Information
          1. 8.5.1. Product About Information
          2. 8.5.2. Plug-in About Information
        6. 8.6. Summary
      7. 9. Packaging Hyperbola
        1. 9.1. Exporting Hyperbola
        2. 9.2. Exporting for Other Platforms
        3. 9.3. Summary
        4. 9.4. Pointers
      8. 10. Messaging Support
        1. 10.1. Integrating a Third-Party Library
          1. 10.1.1. Bundling Smack
          2. 10.1.2. Testing the Bundling
        2. 10.2. Refactoring the Model
          1. 10.2.1. Introduction to Smack
          2. 10.2.2. Design Objectives
          3. 10.2.3. Deleting Prototype Classes
          4. 10.2.4. Adding Chats
        3. 10.3. Updating the UI
          1. 10.3.1. The Content Provider
          2. 10.3.2. The Label Provider
        4. 10.4. Chatting with Eliza
        5. 10.5. Summary
      9. 11. Adding a Login Dialog
        1. 11.1. Adding the Login Dialog
          1. 11.1.1. Branding the Dialog
        2. 11.2. Remembering Login Settings
          1. 11.2.1. The Basics
          2. 11.2.2. Using Preferences
        3. 11.3. Adding Auto-login Preferences
          1. 11.3.1. Creating a Preference Page
          2. 11.3.2. Adding the Action
          3. 11.3.3. Accessing Preferences
          4. 11.3.4. Default Preference Values
          5. 11.3.5. Preferences on the Login Dialog
        4. 11.4. Summary
      10. 12. Adding Key Bindings
        1. 12.1. Defining Commands
        2. 12.2. Checkpoint
        3. 12.3. Adding Key Bindings for Workbench Actions
        4. 12.4. Key Configurations
        5. 12.5. Keys Preference Page
        6. 12.6. Summary
      11. 13. Adding Help
        1. 13.1. Adding to the Target Platform
          1. 13.1.1. Getting Plug-ins
          2. 13.1.2. Adding Plug-ins
        2. 13.2. Getting the Help Plug-ins
        3. 13.3. Configuring the Help Plug-ins
        4. 13.4. Add the Help Action
        5. 13.5. Adding Help Content
        6. 13.6. Help Content Structure
        7. 13.7. Infopops or F1 Help
        8. 13.8. Exporting Plug-ins with Help
        9. 13.9. Summary
        10. 13.10. Pointers
      12. 14. Adding Update
        1. 14.1. Getting Update Plug-ins
        2. 14.2. Configuring the Update Plug-ins
        3. 14.3. Defining Features
        4. 14.4. Branding Features
        5. 14.5. Adding Update Actions
          1. 14.5.1. Updating Hyperbola
          2. 14.5.2. Extending Hyperbola
          3. 14.5.3. Managing Extensions
        6. 14.6. Automatic Updates
        7. 14.7. Summary
    9. III. The Workbench
      1. 15. Workbench Advisors
        1. 15.1. What Is an Advisor?
          1. 15.1.1. Workbench Lifecycle
        2. 15.2. WorkbenchAdvisor
          1. 15.2.1. Lifecycle API
            1. 15.2.1.1. IWorkbenchConfigurer
            2. 15.2.1.2. Closing the Workbench
            3. 15.2.1.3. Workbench Preferences
          2. 15.2.2. Exceptions and Idleness API
          3. 15.2.3. Configuration API
        3. 15.3. WorkbenchWindowAdvisor
          1. 15.3.1. IWorkbenchWindowConfigurer
        4. 15.4. ActionBarAdvisor
          1. 15.4.1. IActionBarConfigurer
        5. 15.5. Workbench Overview
          1. 15.5.1. Workbench Extension Point Reference
          2. 15.5.2. Actions
          3. 15.5.3. Scalability
          4. 15.5.4. Contributions
          5. 15.5.5. Perspectives
          6. 15.5.6. Startup
        6. 15.6. Summary
      2. 16. Perspectives, Views, and Editors
        1. 16.1. Perspectives
          1. 16.1.1. Adding Perspectives
          2. 16.1.2. Adding the Debug Perspective and Console View
          3. 16.1.3. IPageLayout Reference
          4. 16.1.4. Perspective Bar
          5. 16.1.5. Perspective Menu
          6. 16.1.6. Programmatic Perspective Control
        2. 16.2. Views and Editors
          1. 16.2.1. Multiple Instances of the Same View
          2. 16.2.2. Sticky Views
          3. 16.2.3. Showing Contributed Views
          4. 16.2.4. View Registry
          5. 16.2.5. Connecting Parts Together
        3. 16.3. Multiple Workbench Windows
          1. 16.3.1. Window Navigation Menu
        4. 16.4. Drag and Drop with Editors
        5. 16.5. Summary
      3. 17. Actions
        1. 17.1. Overview
        2. 17.2. Declarative Actions in Hyperbola
          1. 17.2.1. Declarative Actions
          2. 17.2.2. Allowing Contributions
          3. 17.2.3. Declaring Actions
          4. 17.2.4. Context Menus
        3. 17.3. Standard Workbench Actions
        4. 17.4. Retargetable Actions
        5. 17.5. Consolidating Declarative Actions
        6. 17.6. Toolbar Action Tricks
          1. 17.6.1. Showing Images and Text
          2. 17.6.2. Adding Controls to the Toolbar
        7. 17.7. Adding Contributions to the Status Line
        8. 17.8. Reporting Progress
          1. 17.8.1. Non-modal Progress
          2. 17.8.2. Progress View
          3. 17.8.3. Customizing Progress
          4. 17.8.4. Writing a ProgressProvider
        9. 17.9. Summary
      4. 18. Customizing Workbench Windows
        1. 18.1. Customization Defined
        2. 18.2. Customizing a Workbench Window
          1. 18.2.1. Example: Hide and Show
          2. 18.2.2. FormLayout
          3. 18.2.3. Hiding the Toolbar
          4. 18.2.4. Adding the Toggle Actions
          5. 18.2.5. Quick Search Panel
          6. 18.2.6. Checkpoint
        3. 18.3. Custom Window Shapes
          1. 18.3.1. Creating the Shape
          2. 18.3.2. Creating the Window
          3. 18.3.3. Defining the Window Contents
        4. 18.4. Summary
      5. 19. Customizing the Presentation of Views and Editors
        1. 19.1. Presentations
        2. 19.2. Sample Presentations
          1. 19.2.1. The R21 Presentation
          2. 19.2.2. Example Presentations
        3. 19.3. Writing a Presentation
          1. 19.3.1. Widget Hierarchy
          2. 19.3.2. StackPresentation
        4. 19.4. Example Presentation
          1. 19.4.1. The Presentation Factory
          2. 19.4.2. The Stack Presentation
          3. 19.4.3. Size and Position
          4. 19.4.4. Adding, Selecting, and Removing Parts
          5. 19.4.5. Menus
        5. 19.5. Summary
    10. IV. Development Processes
      1. 20. Integrating Code Libraries
        1. 20.1. Plug-ins as JARs
        2. 20.2. Bundling by Injection
        3. 20.3. Bundling by Wrapping
        4. 20.4. Bundling by Reference
        5. 20.5. Troubleshooting Classloading Problems
          1. 20.5.1. Issues with Class.forName()
            1. 20.5.1.1. Built-in Buddy Policies
            2. 20.5.1.2. Buddy Classloading Considerations
            3. 20.5.1.3. Dynamic-ImportPackage vs. Buddy Classloading
          2. 20.5.2. Issues with Context Classloaders
          3. 20.5.3. Managing JRE Classes
          4. 20.5.4. Serialization
        6. 20.6. Summary
      2. 21. Installing and Updating Plug-ins
        1. 21.1. Update’s Roles
        2. 21.2. Features
          1. 21.2.1. Uses of Features
          2. 21.2.2. What Is a Feature?
        3. 21.3. Creating and Managing Update Sites
        4. 21.4. Example: Dynamic Content Handling
        5. 21.5. Summary
        6. 21.6. Pointers
      3. 22. Dynamic Plug-ins
        1. 22.1. Making Hyperbola Dynamic
        2. 22.2. Dynamic Challenges
        3. 22.3. Dynamic-awareness
          1. 22.3.1. Dynamic Extension Scenarios
            1. 22.3.1.1. Scenario 1: No Caching
            2. 22.3.1.2. Scenario 2: Extension Caching
            3. 22.3.1.3. Scenario 3: Object Caching
          2. 22.3.2. Object Handling
          3. 22.3.3. Bundle Listeners
        4. 22.4. Dynamic-enablement
          1. 22.4.1. Cleaning Up After Yourself
        5. 22.5. Summary
      4. 23. RCP Everywhere
        1. 23.1. Sample Code
        2. 23.2. The Scenario
          1. 23.2.1. About the Scenario
        3. 23.3. Product Configurations
          1. 23.3.1. Restructuring Hyperbola
          2. 23.3.2. Hyperbola Projects
          3. 23.3.3. Project Naming
          4. 23.3.4. Why So Many Projects?
        4. 23.4. Hyperbola Product Configurations
          1. 23.4.1. The JFace Configuration
          2. 23.4.2. The PDA Configuration
          3. 23.4.3. The Extension Configuration (IDE)
          4. 23.4.4. The Workbench Configuration
          5. 23.4.5. A Hyperbola Kiosk
        5. 23.5. Code Structure
          1. 23.5.1. Hyperbola Layering
          2. 23.5.2. Workbench Contributions
          3. 23.5.3. Actions
          4. 23.5.4. Key Bindings
          5. 23.5.5. Views and Editors
          6. 23.5.6. Wizards, Preferences, and Property Pages
          7. 23.5.7. Optional Dependencies
          8. 23.5.8. Icons and Images
        6. 23.6. Designing a Platform
          1. 23.6.1. Extension Points
          2. 23.6.2. Extension Factories
          3. 23.6.3. Named and Anonymous Extensions
        7. 23.7. RCP-friendly Plug-ins
        8. 23.8. Summary
      5. 24. Building Hyperbola
        1. 24.1. What Is PDE Build?
        2. 24.2. Plug-in build.properties
          1. 24.2.1. Control Properties
          2. 24.2.2. Using Custom Build Scripts
        3. 24.3. Feature build.properties
          1. 24.3.1. Identifying and Placing Root Files
          2. 24.3.2. The Launcher
          3. 24.3.3. config.ini
        4. 24.4. Setting Up a Hyperbola Builder
          1. 24.4.1. build.properties
            1. 24.4.1.1. Product and Packaging Control
            2. 24.4.1.2. Build Naming and Locating
            3. 24.4.1.3. Base Identification and Locating
            4. 24.4.1.4. CVS Access Control
            5. 24.4.1.5. Java Class Libraries and Compiler Control
          2. 24.4.2. customTargets.xml
            1. 24.4.2.1. allElements
            2. 24.4.2.2. assemble.<element.id>
        5. 24.5. Running the Builder
        6. 24.6. Building Products
        7. 24.7. Cross-platform Building
        8. 24.8. Tweaking the Build
          1. 24.8.1. Managing the Base
          2. 24.8.2. Fetching from CVS
          3. 24.8.3. Fetching the Maps
          4. 24.8.4. Auto-substitution of Version Numbers
          5. 24.8.5. Qualifying Version Numbers
          6. 24.8.6. Controlling the Output Names
        9. 24.9. Summary
      6. 25. The Last Mile
        1. 25.1. Archives
        2. 25.2. Native Installers
        3. 25.3. Java Web Start (JNLP)
          1. 25.3.1. How Java Web Start Works
          2. 25.3.2. Hyperbola and Java Web Start
          3. 25.3.3. JAR Signing
          4. 25.3.4. Exporting for Java Web Start
          5. 25.3.5. Building JNLP Manifests
          6. 25.3.6. Java Web Start and Update
        4. 25.4. Update Sites
        5. 25.5. Initializing the Install
        6. 25.6. Pre-initialized Configurations
        7. 25.7. Multi-user Install Scenarios
          1. 25.7.1. Shared Installs
          2. 25.7.2. Shared Configurations
          3. 25.7.3. Multiple Configurations
        8. 25.8. Summary
        9. 25.9. Pointers
    11. V. Reference
      1. 26. OSGi Essentials
        1. 26.1. OSGi and the Eclipse Runtime
        2. 26.2. The Shape of Plug-ins
        3. 26.3. Fragments
        4. 26.4. Version Numbering
        5. 26.5. Services
        6. 26.6. Singletons
        7. 26.7. Bundle Lifecycle
          1. 26.7.1. BundleActivator (Plugin Class)
          2. 26.7.2. The Downside of Activators
          3. 26.7.3. Uses for Activators
        8. 26.8. Early Activation
          1. 26.8.1. Early Activation Extensions
          2. 26.8.2. osgi.bundles
          3. 26.8.3. Start Levels
        9. 26.9. Auto-activation
        10. 26.10. Classloading
          1. 26.10.1. Class Lookup Algorithm
          2. 26.10.2. Declaring Imports and Exports
          3. 26.10.3. Importing versus Requiring
          4. 26.10.4. Optionality
          5. 26.10.5. Re-exporting
          6. 26.10.6. x-internal and x-friends
        11. 26.11. Data Areas
        12. 26.12. Putting It All Together
        13. 26.13. Summary
      2. 27. Eclipse.org Plug-ins
        1. 27.1. Where to Find Plug-ins
        2. 27.2. Eclipse Platform Plug-ins
        3. 27.3. Product Introduction
        4. 27.4. Resources
          1. 27.4.1. Overview of Resources Key Features
          2. 27.4.2. Getting Started with Resources
          3. 27.4.3. Resources in the Workbench
        5. 27.5. Text Editing
          1. 27.5.1. Text Plug-ins
          2. 27.5.2. Editing versus Editor
          3. 27.5.3. Text and StyledText
          4. 27.5.4. IDocument
          5. 27.5.5. TextViewers and TextEditors
          6. 27.5.6. What Is Missing?
        6. 27.6. Consoles
        7. 27.7. Variables
        8. 27.8. Outline and Property Views
        9. 27.9. Forms
        10. 27.10. Browser
        11. 27.11. Summary

    Product information

    • Title: Eclipse Rich Client Platform: Designing, Coding, and Packaging Java™ Applications
    • Author(s): Jeff McAffer, Jean-Michel Lemieux
    • Release date: October 2005
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 9780321334619