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
.
- Create a
private
methodcreateToolBar
in theSampleView
class. Add a call to the bottom of thecreatePartControl
method to ensure that it is called at view creation time. - Inside the
createToolBar
method, create an instance of anMDirectToolItem
object using theMMenuFactory.INSTANCE.createDirectToolItem()
expression. It may be necessary to follow the quick-fix to addorg.eclipse.e4.ui.model.workbench ...
Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.