Chapter 13. Commands and Tools

In the prior chapter, we constructed a GEF Editor and added the ability to select graphical elements in the editor. Now we explore adding commands to manipulate those selected elements, where each command encapsulates a single change to the model. EditParts use a collection of EditPolicy instances to specify what commands can be performed on which graphical elements. After a command is executed, it is placed on the command stack so that the user can choose to undo or redo the command at a later time.

13.1 Listening for Model Changes

We do not manipulate the graphical elements directly but rather modify the model and have the EditParts listen for model changes and update the graph accordingly. If a person is removed ...

Get The Eclipse Graphical Editing Framework (GEF) 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.