Graphical Editing Framework
| Company type | Open source software project |
|---|---|
| Industry | Software development |
| Founded | 2002 |
Area served | Software developers using Eclipse platform |
| Products | Graphical Editing Framework (GEF), Draw2d, Zest |
| Parent | Eclipse Foundation |
| Website | https://www.eclipse.org/gef/ |
The Graphical Editing Framework (GEF) is a project under the Eclipse umbrella that provides a set of frameworks and components designed for creating graphical applications.
History
Initially developed within IBM's etools package (com.ibm.etools.gef), GEF was contributed to the Eclipse platform in 2002 as version 2.0.0. This initial release included two main parts: Draw2d, a 2D visualization library built on the SWT, and GEF (MVC), a model-view-controller framework intended for constructing graphical editors within Eclipse Rich Client Platform (RCP) environments. The first official Eclipse release featuring GEF was version 2.1.0, launched in March 2003. By June 2004, version 3.0.0 introduced enhancements such as rules and guides. The graph visualization toolkit Zest was integrated in 2007 with GEF version 3.4.0. Since its early days in 2004, the API has preserved backward compatibility.
Beginning in 2010, alongside ongoing support for GEF 3.x, a substantial redesign effort named GEF4 commenced. This new iteration adopts a modular architecture, replaces SWT with JavaFX for rendering purposes, and extends usability beyond Eclipse RCP contexts. Components of GEF4 were first released as version 0.1.0 in June 2015, coinciding with GEF 3.10.0 (Mars). The full 1.0.0 release was scheduled to coincide with GEF 4.0.0 (Neon) in June 2016.
GEF 3.x
GEF version 3.x facilitates the creation of graphical editors and views within Eclipse RCP through three principal components:
- Draw2d – an SWT-based toolkit for two-dimensional visualization
- GEF (MVC) – a model-view-controller framework tailored for graphical editor development in Eclipse RCP
- Zest – a toolkit specialized in visualizing graph structures
These elements enable direct development of graphical applications and serve as foundational technology for the Graphical Modeling Framework (GMF), which combines them with the EMF to produce data models alongside their corresponding graphical editors.
Architecture
A typical editor implemented using GEF (MVC) comprises:
- A diagram editor equipped with a tool palette
- Figures that visually represent elements from the data model
- EditParts that act as intermediaries linking figures to their respective model elements
- Request objects capturing user interactions
- EditPolicy objects responsible for handling requests and generating commands
- Command objects that execute modifications on the model while supporting undo and redo operations
Design pattern usage
The design of GEF heavily relies on established design patterns, which developers should thoroughly understand:
- Model-View-Controller: Segregates the application into three layers—model, view, and controller.
- Model: Can be EMF-generated, custom-built by users, or derived from legacy systems.
- Controller: EditParts function as controllers by associating model elements with their figures; they interpret requests and produce commands to update the model.
- View: Each model element is depicted by a figure created using Draw2d, typically employing geometric shapes.
- Factory: Responsible for instantiating models from palettes, EditParts, and figures.
- Observer: EditParts observe changes occurring within both Model and View components.
- Command: Facilitates undo and redo capabilities.
- Strategy: Allows EditParts to dynamically add or remove EditPolicies.
- Chain of responsibility: Determines which EditPolicy will process a given Request.
Request and response mechanism
When users interact, their actions produce requests that are influenced by the currently active EditPart and the selected tool from the palette. These requests travel through a sequence of EditPolicies, with each policy determining whether it can process the request or should forward it further. The EditPolicy that takes responsibility generates a Command, which is then sent back to the initiating tool. Upon execution, this Command modifies the underlying model accordingly (Response).