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

Time for action – responding to selection changes


When the selection is changed in the E4 selection service, parts can be notified that a new selection is available through injection. Although an @Inject field could be used, there would be no trigger that could be used to update the view. Instead, a method with an injected parameter will be used to trigger the update.

  1. Add the required packages to the bundle's package imports, by right-clicking on the com.packtpub.e4.clock.ui project and navigating to Plug-in Tools | Open Manifest to open the bundle's manifest. On the Dependencies tab, click on Add under the Imported Packages section and enter org.eclipse.e4.ui.services.

  2. In the TimeZoneTableView class, create a method called setTimeZone. The method name isn't specifically important, but the method needs to be annotated with @Inject and @Optional, and the argument needs to be annotated with @Named(IServiceConstants.ACTIVE_SELECTION). It should look like:

    @Inject
    @Optional
    public void setTimeZone...