The Eclipse Graphical Editing Framework Gef Pdf Writer
Eclipse is probably best known as a Java IDE, but it is more: it is an IDE framework, a tools framework, an open source project, a community, an eco-system, and a.
Editor's note: The following article, originally written by Randy Hudson in July 2003, was updated in March 2007 by Chris Aniszczyk. This article walks through the steps for using the Graphical Editing Framework (GEF).
Rather than finishing each step in its entirety, we'll use a subset of your application's model and get that working first. For example, we might initially ignore connections or focus on just a subset of the types of graphical elements in your application. Next, learn what other technologies are available to add graphical editing to your applications. In the past, stand-alone GEF used to be the only option for graphical editing in Eclipse, but this has changed as Eclipse has evolved. Overview of GEF GEF assumes you have a model you would like to display and edit graphically. To do this, GEF provides viewers (of the type EditPartViewer) that can be used anywhere in the Eclipse workbench. Like JFace viewers, GEF viewers are adapters on an SWT Control.
But the similarity stops there. GEF viewers are based on a Model-View-Controller (MVC) architecture. The controllers bridge the view and model (see Figure 1).
Each controller, or EditPart as they are called here, is responsible for mapping the model to its view and for making changes to the model. The EditPart also observes the model and updates the view to reflect changes in the model's state. EditParts are the objects with which the user interacts.
EditParts are covered in detail later. Model-View-Controller GEF provides two viewer types: graphical and tree-based. Each hosts a different type of view. The graphical viewer uses figures that paint on an SWT Canvas. Figures are defined in the Draw2D plug-in, which is included as part of GEF.
The TreeViewer uses an SWT Tree and TreeItems for its view. Step 1: Bring your own model GEF knows nothing about a model. Any model type should work, as long as it meets the properties described below. What's in a model? Everything is in the model. The model is the only thing persisted and restored.
Your application should store all important data in the model. During the course of editing, undo, and redo, the model is the only thing that endures.
Figures and EditParts will be garbage collected and recreated over time. When the user interacts with EditParts, the model is not manipulated directly by the EditParts. Instead, a Command is created that encapsulates the change. Commands can be used to validate the user's interaction, and to provide undo and redo support. Strictly speaking, Commands are also conceptually part of the model. They are not the model per se, but the means by which the model is edited. Commands are used to perform all of the user's undoable changes.
Ideally, commands should only know about the model. They should avoid referencing an EditPart or figure.
Similarly, a command should avoid invoking the user interface (such as a pop-up dialog) whenever possible. A tale of two models A straightforward GEF application is an editor for drawing diagrams. (Here, diagram means just a picture, not class diagram.) A diagram can be modeled as some shapes.
A shape might have properties for location, color, etc., and may be a group structure of multiple shapes. There are no surprises here, and the previous requirement is easily maintained. A simple model. Another common GEF application is a UML editor, such as a class diagram editor. One important piece of information in the diagram is the (x, y) location where a class appears.
You might assume that the model must describe a class as having an x and y property. Most developers want to avoid polluting their models with attributes that don't make sense. In such applications, the term business model can be used to refer to the base model in which the important semantic details are stored. While diagram-specific information is stored in the view model (which means a view of something in the business model; an object may be viewed multiple times in one diagram). Sometimes the split is even reflected in the workspace, where different resources might be used to persist the diagram and business model separately.
There may even be several diagrams for the same business model (see Figure 3). A common term for view models is notational models. A model split into business and view models. If your use cases have you using the Eclipse Modeling Framework for your model, it is highly recommend that you use GMF instead of GEF directly.
Read Chris Aniszczyk's 'Learn Eclipse GMF in 15 minutes' for more information (see ). Zest Zest is a lightweight visualization toolkit (see Figure 6) that provides a JFace-like wrapping on top of traditional GEF editors. Zest has been modeled after JFace, and all the Zest views conform to the same standards and conventions as existing Eclipse views (think label and content providers).
This means that the providers, actions, and listeners used within existing applications can be leveraged within Zest. Also, Zest has reusable layouts that can be applied to your visualizations with ease. Sample Zest Visualizations. Related topics • Visit to learn more about the Graphical Editing Framework. • New to GEF and want a simple yet concrete example? Check out the shapes example article by Bo Majewski: ' at Eclipse.org. • Check out the GEF schema editor article ' at Eclipse.org.
• Read the for (almost-)definitive documentation on GEF. • Check out the for tutorials and articles that can be useful for the EMF novice. • The EMF team has a good introductory tutorial titled '.' • If you need the definitive source on EMF, the book is a great reference. • For a quick overview of GMF, read '.'
• Frederic Plante wrote an article titled ',' detailing the advanced features of the GMF runtime. • The offers tutorials and plenty of information about advanced GMF features.
• Learn about at Eclipse.org. • Download and get started with Eclipse now.
• For an introduction to the Eclipse platform, see '.' • Check out the latest at IBM.
• Check out the '.' • Browse all the on developerWorks. • Expand your Eclipse skills by checking out IBM developerWorks'. • Innovate your next open source development project with, available for download or on DVD.
Editor's note: The following article, originally written by Randy Hudson in July 2003, was updated in March 2007 by Chris Aniszczyk. This article walks through the steps for using the Graphical Editing Framework (GEF). Rather than finishing each step in its entirety, we'll use a subset of your application's model and get that working first.
For example, we might initially ignore connections or focus on just a subset of the types of graphical elements in your application. Next, learn what other technologies are available to add graphical editing to your applications. In the past, stand-alone GEF used to be the only option for graphical editing in Eclipse, but this has changed as Eclipse has evolved.
Overview of GEF GEF assumes you have a model you would like to display and edit graphically. To do this, GEF provides viewers (of the type EditPartViewer) that can be used anywhere in the Eclipse workbench. Like JFace viewers, GEF viewers are adapters on an SWT Control.
But the similarity stops there. GEF viewers are based on a Model-View-Controller (MVC) architecture. The controllers bridge the view and model (see Figure 1). Each controller, or EditPart as they are called here, is responsible for mapping the model to its view and for making changes to the model. The EditPart also observes the model and updates the view to reflect changes in the model's state. EditParts are the objects with which the user interacts. EditParts are covered in detail later.
Microsoft Expression Studio 4 Ultimate Serial. Model-View-Controller GEF provides two viewer types: graphical and tree-based. Each hosts a different type of view. The graphical viewer uses figures that paint on an SWT Canvas. Figures are defined in the Draw2D plug-in, which is included as part of GEF. The TreeViewer uses an SWT Tree and TreeItems for its view.
Step 1: Bring your own model GEF knows nothing about a model. Any model type should work, as long as it meets the properties described below. What's in a model? Everything is in the model. The model is the only thing persisted and restored. Your application should store all important data in the model.
During the course of editing, undo, and redo, the model is the only thing that endures. Figures and EditParts will be garbage collected and recreated over time. When the user interacts with EditParts, the model is not manipulated directly by the EditParts. Instead, a Command is created that encapsulates the change.
Commands can be used to validate the user's interaction, and to provide undo and redo support. Strictly speaking, Commands are also conceptually part of the model. They are not the model per se, but the means by which the model is edited. Commands are used to perform all of the user's undoable changes. Ideally, commands should only know about the model. They should avoid referencing an EditPart or figure. Similarly, a command should avoid invoking the user interface (such as a pop-up dialog) whenever possible.
A tale of two models A straightforward GEF application is an editor for drawing diagrams. (Here, diagram means just a picture, not class diagram.) A diagram can be modeled as some shapes. A shape might have properties for location, color, etc., and may be a group structure of multiple shapes. There are no surprises here, and the previous requirement is easily maintained. A simple model. Another common GEF application is a UML editor, such as a class diagram editor.
One important piece of information in the diagram is the (x, y) location where a class appears. You might assume that the model must describe a class as having an x and y property.
Most developers want to avoid polluting their models with attributes that don't make sense. In such applications, the term business model can be used to refer to the base model in which the important semantic details are stored. While diagram-specific information is stored in the view model (which means a view of something in the business model; an object may be viewed multiple times in one diagram).
Sometimes the split is even reflected in the workspace, where different resources might be used to persist the diagram and business model separately. There may even be several diagrams for the same business model (see Figure 3). A common term for view models is notational models. A model split into business and view models. If your use cases have you using the Eclipse Modeling Framework for your model, it is highly recommend that you use GMF instead of GEF directly. Read Chris Aniszczyk's 'Learn Eclipse GMF in 15 minutes' for more information (see ).
Zest Zest is a lightweight visualization toolkit (see Figure 6) that provides a JFace-like wrapping on top of traditional GEF editors. Zest has been modeled after JFace, and all the Zest views conform to the same standards and conventions as existing Eclipse views (think label and content providers).
This means that the providers, actions, and listeners used within existing applications can be leveraged within Zest. Also, Zest has reusable layouts that can be applied to your visualizations with ease. Sample Zest Visualizations. Related topics • Visit to learn more about the Graphical Editing Framework. • New to GEF and want a simple yet concrete example?
Check out the shapes example article by Bo Majewski: ' at Eclipse.org. • Check out the GEF schema editor article ' at Eclipse.org.
• Read the for (almost-)definitive documentation on GEF. • Check out the for tutorials and articles that can be useful for the EMF novice. • The EMF team has a good introductory tutorial titled '.' • If you need the definitive source on EMF, the book is a great reference. • For a quick overview of GMF, read '.' • Frederic Plante wrote an article titled ',' detailing the advanced features of the GMF runtime.
• The offers tutorials and plenty of information about advanced GMF features. • Learn about at Eclipse.org. • Download and get started with Eclipse now. • For an introduction to the Eclipse platform, see '.'
• Check out the latest at IBM. • Check out the '.' • Browse all the on developerWorks. • Expand your Eclipse skills by checking out IBM developerWorks'. • Innovate your next open source development project with, available for download or on DVD. Super Mario Bros All-stars 25th Anniversary Collection Iso there.