Time for action – upgrading the actions

The JFace Action class is used in pop-up menus using the Eclipse 2.x model, but in Eclipse 3.x and Eclipse 4.x, the separation between handlers (code that does the work) and commands (logical operations such as copy that may be processed by different handlers) allows for a more flexible system, as described in Chapter 4, Interacting with the User. The first step is to replace the actions with handlers.

  1. Open the SampleView class and go to the makeActions method, which creates anonymous inner subclasses of Action with an associated run method. To convert these, they will need to be static inner classes, so highlight the first new Action expression and navigate to the Refactor | Convert Anonymous Class to Nested… ...

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.