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 – creating toolbars


The first step is to add the toolbar icons, which are the informational icons in the top right. In the original implementation, these were direct Action elements inserted into a ToolBar, which is part of the Eclipse 3.x interface. To achieve this with Eclipse 4.x, models using MDirectToolItem will be created and added to an MToolBar.

  1. Create a private method createToolBar in the SampleView class. Add a call to the bottom of the createPartControl method to ensure that it is called at view creation time.

  2. Inside the createToolBar method, create an instance of an MDirectToolItem object using the MMenuFactory.INSTANCE.createDirectToolItem() expression. It may be necessary to follow the quick-fix to add org.eclipse.e4.ui.model.workbench to allow the automatic import to find the class. Assign it to a local variable one.

  3. Add a tooltip Action 1 tooltip by calling one.setTooltip().

  4. To show the informational icon, a platform URI must be created. This uses the fully qualified...