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 – adding the clock


To add the clock to the Eclipse 4 application, a new part will be added which has a ClockWidget as its only content.

  1. To use the ClockWidget in a different plug-in, the package needs to be exported. Open the MANIFEST.MF from the com.packtpub.e4.clock.ui project, and on the Runtime tab, click on Add to add the com.packtpub.e4.clock.ui package to the list of Exported Packages.

  2. Create a new class called ClockPart in the com.packtpub.e4.application.parts package.

  3. Add a create method with a @PostConstruct annotation that takes a Composite parent argument.

  4. In the body of the create method, instantiate a new ClockWidget instance with arguments parent, SWT.NONE, and new RGB(255,0,0). This will require that the com.packtpub.e4.clock.ui package is imported into the com.packtpub.e4.application plug-in. A quick-fix should offer this automatically, but it can be added by opening the MANIFEST.MF, going to the Dependencies tab, and adding the com.packtpub.e4.clock.ui package...