Book Image

Eclipse Plug-in Development Beginner's Guide - Second Edition

By : Alex Blewitt
Book Image

Eclipse Plug-in Development Beginner's Guide - Second Edition

By: Alex Blewitt

Overview of this book

Eclipse is used by everyone from indie devs to NASA engineers. Its popularity is underpinned by its impressive plug-in ecosystem, which allows it to be extended to meet the needs of whoever is using it. This book shows you how to take full advantage of the Eclipse IDE by building your own useful plug-ins from start to finish. Taking you through the complete process of plug-in development, from packaging to automated testing and deployment, this book is a direct route to quicker, cleaner Java development. It may be for beginners, but we're confident that you'll develop new skills quickly. Pretty soon you'll feel like an expert, in complete control of your IDE. Don't let Eclipse define you - extend it with the plug-ins you need today for smarter, happier, and more effective development.
Table of Contents (24 chapters)
Eclipse Plug-in Development Beginner's Guide Second Edition
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

This book provides a general introduction to developing plug-ins for the Eclipse platform. No prior experience, other than Java, is necessary to be able to follow the examples presented in this book. By the end of the book, you should be able to create an Eclipse plug-in from scratch, as well as be able to create an automated build of those plug-ins.

What this book covers

Chapter 1, Creating Your First Plug-in, provides an overview of how to download Eclipse, set it up for plug-in development, create a sample plug-in, launch and debug it.

Chapter 2, Creating Views with SWT, provides an overview of how to build views with SWT, along with other custom SWT components such as system trays and resource management.

Chapter 3, Creating JFace Viewers, will show how to create views with JFace using TreeViewers and TableViewers, along with integration with the properties view and user interaction.

Chapter 4, Interacting with the User, interacts with the user, as well as the Jobs and Progress APIs, using commands, handlers, and menus.

Chapter 5, Storing Preferences and Settings, shows how to store preference information persistently, as well as displaying information via the Preferences pages.

Chapter 6, Working with Resources, tells how to load and create Resources in the workbench, as well as how to create a builder and nature for automated processing.

Chapter 7, Creating Eclipse 4 Applications, discusses the key differences between the Eclipse 3.x and Eclipse 4.x models, along with commands, handlers and menu items.

Chapter 8, Migrating to Eclipse 4.x, teaches how to efficiently migrate views created for Eclipse 3.x to the new Eclipse 4.x model.

Chapter 9, Styling Eclipse 4 Applications, discusses how to style the UI with CSS, and create widgets that can adjust to CSS styles.

Chapter 10, Creating Features, Update Sites, Applications, and Products, takes the plug-ins created so far in this book, aggregates them into features, publishes to update sites, and teaches you how applications and products are used to create standalone entities.

Chapter 11, Automated Testing of Plug-ins, teaches how to write automated tests that exercise Eclipse plug-ins, including both UI and non-UI components.

Chapter 12, Automated Builds with Tycho, shows how to build Eclipse plug-ins, features, update sites, applications, and products automatically with Maven Tycho.

Chapter 13, Contributing to Eclipse, discusses how to use Git to check out Eclipse code bases, how to report bugs with Bugzilla, and how to upload patches into Gerrit.

Appendix A, Using OSGi Services to Dynamically Wire Applications, looks at OSGi services as an alternative means of providing dependent services in an Eclipse or OSGi application.

Appendix B, Pop Quiz Answers, covers all the answers enlisted in the pop quiz sections in the book.

What you need for this book

To run the exercises for this book, you will need a computer with an up-to-date operating system running Windows, Linux, or Mac OS X. Java also needs to be installed; JDK 1.8 is the current released version although the instructions should work for a newer version of Java.

This book has been tested with the Eclipse SDK (Classic/Standard) for Mars (4.5) and Neon (4.6). Newer versions of Eclipse may also work. Care should be taken to not install the Eclipse for RCP and RAP developers, as this will cause the applications created in Chapter 7, Understanding the Eclipse 4 Model and RCP Applications and Chapter 8, Migrating Views to the Eclipse 4 Model.

The first chapter explains how to get started with Eclipse, including how to obtain and install both Eclipse and Java.

Who this book is for

This book is aimed at Java developers who are interested in learning how to create plug-ins, products and applications for the Eclipse platform.

This book will also be useful to those who already have some experience in building Eclipse plug-ins and want to know how to create automated builds using Maven Tycho, which has become the de facto standard for building Eclipse plug-ins.

Finally, those Eclipse developers who are familiar with the Eclipse 3.x model but are interested in learning about the changes that the Eclipse 4.x model brings will find the information presented in Chapter 8 a useful summary of what opportunities the new model provides.

Sections

In this book, you will find several headings that appear frequently (Time for action, What just happened?, Pop quiz, and Have a go hero).

To give clear instructions on how to complete a procedure or task, we use these sections as follows:

Time for action – heading

  1. Action 1

  2. Action 2

  3. Action 3

Instructions often need some extra explanation to ensure they make sense, so they are followed with these sections:

What just happened?

This section explains the working of the tasks or instructions that you have just completed.

You will also find some other learning aids in the book, for example:

Pop quiz – heading

These are short multiple-choice questions intended to help you test your own understanding.

Have a go hero – heading

These are practical challenges that give you ideas to experiment with what you have learned.

Conventions

You will also find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Running java -version should give output like this."

A block of code is set as follows:

public class Utility {
  public static boolean breakpoint() {
    System.out.println("Breakpoint");
    return false;
  }
}

Any command-line input or output is written as follows:

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Choose a workspace, which is the location in which projects are to be stored, and click on OK:"

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/alblue/com.packtpub.e4. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/EclipsePluginDevelopmentBeginnersGuideSecondEdition_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.