You are previewing Eclipse 4 Plug-in Development by Example Beginner's Guide.
O'Reilly logo
Eclipse 4 Plug-in Development by Example Beginner's Guide

Book Description

This is a truly hands-on book for developing Eclipse plug-ins. A whole series of “Time for Action” sections gets you involved in practical examples that teach you everything from the very basics to more advanced activities.

  • Create plug-ins to extend the Eclipse runtime covering Eclipse 3.x and the changes required for Eclipse 4.x

  • Plug-ins from design to distribution — wide coverage of the entire process

  • No prior OSGi or Eclipse plug-in development experience necessary

  • In Detail

    As a highly extensible platform, Eclipse is used by everyone from independent software developers to NASA. Key to this is Eclipse’s plug-in ecosystem, which allows applications to be developed in a modular architecture and extended through its use of plug-ins and features.

    "Eclipse 4 Plug-in Development by Example Beginner's Guide" takes the reader through the full journey of plug-in development, starting with an introduction to Eclipse plug-ins, continued through packaging and culminating in automated testing and deployment. The example code provides simple snippets which can be developed and extended to get you going quickly.

    This book covers basics of plug-in development, creating user interfaces with both SWT and JFace, and interacting with the user and execution of long-running tasks in the background.

    Example-based tasks such as creating and working with preferences and advanced tasks such as well as working with Eclipse’s files and resources. A specific chapter on the differences between Eclipse 3.x and Eclipse 4.x presents a detailed view of the changes needed by applications and plug-ins upgrading to the new model. Finally, the book concludes on how to package plug-ins into update sites, and build and test them automatically.

    Table of Contents

    1. Eclipse 4 Plug-in Development by Example Beginner's Guide
      1. Table of Contents
      2. Eclipse 4 Plug-in Development by Example Beginner's Guide
      3. Credits
      4. About the Author
      5. Acknowledgement
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Time for action – heading
          1. What just happened?
          2. Pop quiz – heading
          3. Have a go hero – heading
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Creating Your First Plug-in
        1. Getting started
        2. Time for action – setting up the Eclipse SDK environment
          1. What just happened?
        3. Creating your first plug-in
        4. Time for action – creating a plug-in
          1. What just happened?
          2. Pop quiz – Eclipse workspaces and plug-ins
        5. Running plug-ins
        6. Time for action – launching Eclipse from within Eclipse
          1. What just happened?
          2. Pop quiz – launching Eclipse
          3. Have a go hero – modifying the plug-in
        7. Debugging a plug-in
        8. Time for action – debugging a plug-in
          1. What just happened?
        9. Time for action – updating code in debugger
          1. What just happened?
        10. Debugging with step filters
        11. Time for action – setting up step filtering
          1. What just happened?
        12. Using different breakpoint types
        13. Time for action – breaking at method entry and exit
          1. What just happened?
        14. Using conditional breakpoints
        15. Time for action – setting a conditional breakpoint
          1. What just happened?
        16. Using exceptional breakpoints
        17. Time for action – catching exceptions
          1. What just happened?
        18. Time for action – using watch variables and expressions
          1. What just happened?
          2. Pop quiz – debugging
          3. Have a go hero – working with breakpoints
        19. Summary
      10. 2. Creating Views with SWT
        1. Creating views and widgets
        2. Time for action – creating a view
          1. What just happened?
            1. MANIFEST.MF
            2. plugin.xml
        3. Time for action – drawing a custom view
          1. What just happened?
        4. Time for action – drawing a second hand
          1. What just happened?
        5. Time for action – animating the second hand
          1. What just happened?
        6. Time for action – running on the UI thread
          1. What just happened?
        7. Time for action – creating a reusable widget
          1. What just happened?
        8. Time for action – using layouts
          1. What just happened?
          2. Pop quiz – understanding views
          3. Have a go hero – drawing hours and minute hands
        9. Managing resources
        10. Time for action – getting colorful
          1. What just happened?
        11. Time for action – finding the leak
          1. What just happened?
        12. Time for action – plugging the leak
          1. What just happened?
          2. Pop quiz – understanding resources
          3. Have a go hero – extending the clock widget
        13. Interacting with the user
        14. Time for action – getting in focus
          1. What just happened?
        15. Time for action – responding to input
          1. What just happened?
          2. Pop quiz – understanding widgets
          3. Have a go hero – updating the clock widget
        16. Using other SWT widgets
        17. Time for action – adding items to the tray
          1. What just happened?
        18. Time for action – responding to the user
          1. What just happened?
        19. Time for action – modal and other effects
          1. What just happened?
        20. Time for action – groups and tab folders
          1. What just happened?
          2. Pop quiz – using SWT
          3. Have a go hero – enhancing the time zones
        21. Summary
      11. 3. Creating JFace Viewers
        1. Why JFace?
        2. Creating TreeViewers
        3. Time for action – creating a TreeViewer
          1. What just happened?
        4. Time for action – using Images in JFace
          1. What just happened?
        5. Time for action – styling label providers
          1. What just happened?
          2. Pop quiz – understanding JFace
          3. Have a go hero – adding images for regions
        6. Sorting and filtering
        7. Time for action – sorting items in a viewer
          1. What just happened?
        8. Time for action – filtering items in a viewer
          1. What just happened?
          2. Pop quiz – understanding sorting and filters
          3. Have a go hero – expanding and filtering
        9. Interaction and properties
        10. Time for action – adding a double-click listener
          1. What just happened?
        11. Time for action – showing properties
          1. What just happened?
          2. Pop quiz – understanding properties
        12. Tabular data
        13. Time for action – viewing time zones in tables
          1. What just happened?
        14. Time for action – syncing selection
          1. What just happened?
          2. Pop quiz – understanding tables
        15. Summary
      12. 4. Interacting with the User
        1. Creating actions, commands, and handlers
        2. Time for action – adding context menus
          1. What just happened?
        3. Time for action – creating commands and handlers
          1. What just happened?
        4. Time for action – binding commands to keys
          1. What just happened?
        5. Time for action – changing contexts
          1. What just happened?
        6. Time for action – enabling and disabling the menu's items
          1. What just happened?
        7. Time for action – reusing expressions
          1. What just happened?
        8. Time for action – contributing commands to pop-up menus
          1. What just happened?
          2. Have a go hero – using view menus and toolbars
          3. Pop quiz – understanding menus
        9. Jobs and progress
        10. Time for action – running operations in the background
          1. What just happened?
          2. Have a go hero – using a UI job
        11. Time for action – reporting progress
          1. What just happened?
        12. Time for action – dealing with cancellation
          1. What just happened?
        13. Time for action – using subtasks and subprogress monitors
          1. What just happened?
        14. Time for action – using null progress monitors and submonitors
          1. What just happened?
        15. Time for action – setting job properties
          1. What just happened?
          2. Have a go hero – displaying in the taskbar
          3. Pop quiz: understanding jobs
        16. Reporting errors
        17. Time for action – showing errors
          1. What just happened?
          2. Pop quiz – understanding errors
        18. Summary
      13. 5. Storing Preferences and Settings
        1. Storing preferences
        2. Time for action – persisting a value
          1. What just happened?
        3. Time for action – creating a preference page
          1. What just happened?
        4. Time for action – creating warning and error messages
          1. What just happened?
        5. Time for action – choosing from a list
          1. What just happened?
        6. Time for action – using a grid
          1. What just happened?
        7. Time for action – placing the preferences page
          1. What just happened?
        8. Time for action – using other field editors
          1. What just happened?
        9. Time for action – adding keywords
          1. What just happened?
        10. Time for action: using IEclipsePreferences
          1. What just happened?
          2. Have a go hero – translating into different languages
        11. Using IMemento and DialogSettings
        12. Time for action – adding a memento for the Time Zone View
          1. What just happened?
        13. Time for action – using DialogSettings
          1. What just happened?
          2. Pop quiz – understanding preferences
        14. Summary
      14. 6. Working with Resources
        1. Using the workspace and resources
        2. Time for action – creating an editor
          1. What just happened?
        3. Time for action – writing the markup parser
          1. What just happened?
        4. Time for action – building the builder
          1. What just happened?
        5. Time for action – iterating through resources
          1. What just happened?
        6. Time for action – creating resources
          1. What just happened?
        7. Time for action – implementing incremental builds
          1. What just happened?
        8. Time for action – handling deletion
          1. What just happened?
          2. Have a go hero – builder upgrades
        9. Using natures
        10. Time for action – creating a nature
          1. What just happened?
          2. Have a go hero – enabling for a selected object type
        11. Using markers
        12. Time for action – error markers if the file is empty
          1. What just happened?
        13. Time for action – registering a marker type
          1. What just happened?
          2. Have a go hero – working out when the file is really empty
          3. Pop quiz – understanding resources, builders, and markers
        14. Summary
      15. 7. Understanding the Eclipse 4 Model
        1. Working with the Eclipse 4 model
        2. Time for action – installing E4 tooling
          1. What just happened?
        3. Time for action – creating an E4 application
          1. What just happened?
        4. Time for action – creating a part
          1. What just happened?
        5. Time for action – styling the UI with CSS
          1. What just happened?
          2. Have a go hero – using the theme manager
        6. Using services and contexts
        7. Time for action – adding logging
          1. What just happened?
        8. Time for action – getting the window
          1. What just happened?
        9. Time for action – obtaining the selection
          1. What just happened?
        10. Time for action – dealing with events
          1. What just happened?
        11. Time for action – calculating values on demand
          1. What just happened?
        12. Time for action – using preferences
          1. What just happened?
        13. Time for action – interacting with the UI
          1. What just happened?
        14. Using Commands, Handlers, and MenuItems
        15. Time for action – wiring a menu to a command with a handler
          1. What just happened?
        16. Time for action – passing command parameters
          1. What just happened?
        17. Time for action – creating a direct menu and keybindings
          1. What just happened?
        18. Time for action – creating a pop-up menu and a view menu
          1. What just happened?
        19. Creating custom injectable classes
        20. Time for action – creating a simple service
          1. What just happened?
        21. Time for action – injecting subtypes
          1. What just happened?
          2. Have a go hero – using the tools bridge
          3. Pop quiz – understanding E4
        22. Summary
      16. 8. Creating Features, Update Sites, Applications, and Products
        1. Grouping plug-ins with features
        2. Time for action – creating a feature
          1. What just happened?
        3. Time for action – exporting a feature
          1. What just happened?
        4. Time for action – installing a feature
          1. What just happened?
        5. Time for action – categorizing the update site
          1. What just happened?
        6. Time for action – depending on other features
          1. What just happened?
        7. Time for action – branding features
          1. What just happened?
          2. Have a go hero – publishing the content remotely
        8. Building applications and products
        9. Time for action – creating a headless application
          1. What just happened?
        10. Time for action – creating a product
          1. What just happened?
          2. Have a go hero – creating a product based on features
          3. Pop Quiz – understanding features, applications, and products
        11. Summary
      17. 9. Automated Testing of Plug-ins
        1. Using JUnit for automated testing
        2. Time for action – writing a simple JUnit test case
          1. What just happened?
        3. Time for action – writing a plug-in test
          1. What just happened?
        4. Using SWTBot for user interface testing
        5. Time for action – writing an SWTBot test
          1. What just happened?
        6. Time for action – working with menus
          1. What just happened?
          2. Have a go hero – using resources
        7. Working with SWTBot
        8. Time for action – hiding the welcome screen
          1. What just happened?
        9. Time for action – avoiding SWTBot runtime errors
          1. What just happened?
        10. Working with views
        11. Time for action – showing views
          1. What just happened?
        12. Time for action – interrogating views
          1. What just happened?
        13. Interacting with the UI
        14. Time for action – getting values from the UI
          1. What just happened?
        15. Time for action – waiting for a condition
          1. What just happened?
          2. Have a go hero – driving the New Class wizard
          3. Pop quiz – understanding SWTBot
        16. Summary
      18. 10. Automated Builds with Tycho
        1. Using Maven to build Eclipse plug-ins with Tycho
        2. Time for action – installing Maven
          1. What just happened?
        3. Time for action – building with Tycho
          1. What just happened?
          2. Have a go hero – using target platforms
        4. Building features and update sites with Tycho
        5. Time for action – creating a parent project
          1. What just happened?
        6. Time for action – building a feature
          1. What just happened?
        7. Time for action – building an update site
          1. What just happened?
        8. Time for action – building a product
          1. What just happened?
          2. Have a go hero – depending on Maven components
        9. Testing and releasing
        10. Time for action – running automated tests
          1. What just happened?
        11. Time for action – changing the version numbers
          1. What just happened?
          2. Have a go hero – enabling builds for other plug-ins
        12. Signing update sites
        13. Time for action – creating a self-signed certificate
          1. What just happened?
        14. Time for action – signing the plug-ins
          1. What just happened?
        15. Time for action – serving an update site
          1. What just happened?
          2. Pop quiz – understanding automated builds and update sites
        16. Summary
      19. A. Pop Quiz Answers
        1. Chapter 1, Creating Your First Plug-in
          1. Pop quiz – Eclipse workspaces and plug-ins
          2. Pop quiz – launching Eclipse
          3. Pop quiz – debugging
        2. Chapter 2, Creating Views with SWT
          1. Pop quiz – understanding views
          2. Pop quiz – understanding resources
          3. Pop quiz – understanding widgets
          4. Pop quiz – using SWT
        3. Chapter 3, Creating JFace Viewers
          1. Pop quiz – understanding JFace
          2. Pop quiz – understanding sorting and filters
          3. Pop quiz – understanding properties
          4. Pop quiz – understanding tables
        4. Chapter 4, Interacting with the User
          1. Pop quiz – understanding menus
          2. Pop quiz – understanding jobs
          3. Pop quiz – understanding errors
        5. Chapter 5, Storing Preferences and Settings
          1. Pop quiz – understanding preferences
        6. Chapter 6, Working with Resources
          1. Pop quiz – understanding resources, builders, and markers
        7. Chapter 7, Understanding the Eclipse 4 Model
          1. Pop quiz – understanding E4
        8. Chapter 8, Creating Features, Update Sites, Applications, and Products
          1. Pop quiz – understanding features, applications, and products
        9. Chapter 9, Automated Testing of Plug-ins
          1. Pop quiz – understanding SWTBot
        10. Chapter 10, Automated Builds with Tycho
          1. Pop quiz – understanding automated builds and update sites
      20. Index