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 – propagating selection


When the user selects an item in a viewer component, any registered selection listeners will be notified. In order to forward changes to the E4 selection service, a listener needs to be created to forward the selection to the ESelectionService.

  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.workbench.modeling as well as org.eclipse.e4.core.di.annotations.

  2. In order to forward selection changes to the E4 selection service, it must be injected into the view. Add a field ESelectionService selectionService annotated with @Inject and @Optional. When the part is created, the field will be filled with a selection service instance or null as appropriate:

    @Inject
    @Optional
    private ESelectionService selectionService...