ModelPediaModelPediaModel Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Centro de Informática – CIn/UFPeORCAS Group
Eclipse GMFEclipse GMF
Fábio M. Pereira
Ramon Rabello
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 2
AgendaAgenda GMF – What is it? EMF – Overview GEF – Overview GMF – Models
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 3
GMF – What is it?GMF – What is it? It provides a generative component and runtime
infrastructure for developing graphical editors based on EMF (Eclipse Modeling Framework) and GEF (Graphical Editing Framework)
It enables to produce graphical editors for Eclipse– For example, a UML modeling tool, workflow editor, etc. – Basically, a graphical editing surface for any domain
model in EMF
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 4
GMF – What is it?GMF – What is it?
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
ScenarioScenario
20/04/23 GEF - Graphical Modeling Framework 5
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
ComponentsComponents
20/04/23 GEF - Graphical Modeling Framework 6
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
GMF RuntimeGMF Runtime Its features provide a consistent look and feel with
other GMF-based graphical editors Its editors can be created manually from the ground
up and/or be generated from the great tooling currently being developed as part GMF's SDK
It manages diagram persistence, allowing clients to focus on their business logic
Its extensible nature allows GMF Runtime clients to be fully open editors that in turn can be extended by third-parties
20/04/23 GEF - Graphical Modeling Framework 7
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
GMF RuntimeGMF Runtime It is already integrated with various new EMFT
components such as validation and OCL should you need such support
It defines an extensible notation meta-model to enable the isolation of notation from semantic concerns
Its features are well designed, coded, tested, and deployed
Future community enhancements to the runtime will easily be integrated with your editor
20/04/23 GEF - Graphical Modeling Framework 8
ModelPediaModelPediaModel Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Centro de Informática – CIn/UFPeORCAS Group
EMF EMF OverviewOverview
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 10
EMF – Eclipse Modeling EMF – Eclipse Modeling FrameworkFramework The EMF project is a modeling framework
and code generation facility for building tools and other applications based on a structured data model
The key concepts underlying the framework are: meta-data, code generation, and default serialization
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 11
EMF BenefitsEMF Benefits Increase productivity Model change notification Persistence support including default XMI and
schema-based XML serialization A framework for model validation A very efficient reflective API for manipulating EMF
objects generically Most important of all, EMF provides the foundation
for interoperability with other EMF-based tools and applications
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 12
Developing an Eclipse plug-in using Developing an Eclipse plug-in using EMFEMF 1: Designing the model
– The first step is to design the data model for the application - that is, the structure of the data we want to be able to view and edit, and the relationships between data items
– You may find a UML tool useful, or a piece of paper 2: Defining the model
– The next step is to define the model to EMF so that code can be generated
3: Generating the model– Now that the model has been defined, we can proceed to generate
the model implementation 4: Generating an editor 5: Trying out the generated plug-ins
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 13
Defining an EMF ModelDefining an EMF Model Our model definition can be provided to the EMF
code generator in a number of ways:– UML: if you have a modeling tool that works with EMF,
you can simply draw the class diagram (*.uml)– XMI: we could describe the model directly in an XMI
document (*.ecore)– Export the XMI document from the Rational Rose
modeling tool (*.mdl)– Annotate Java interfaces with model properties (*.java)– Use XML Schema to describe the form of a serialization
of the model (*.xsd; *.wsdl)
ModelPediaModelPediaModel Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Centro de Informática – CIn/UFPeORCAS Group
GEFGEFGraphical Editing Graphical Editing
FrameworkFramework
OverviewOverview
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 15
GEF – Graphical Editing GEF – Graphical Editing FrameworkFramework It allows to easily develop graphical
representations for existing models– It is possible to develop feature rich graphical
editors using GEF
All graphical visualization is done via the Draw2D framework, which is a standard 2D drawing framework based on SWT from eclipse.org
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 16
GEF – Graphical Editing GEF – Graphical Editing FrameworkFramework Its editing possibilities allow you to build
graphical editors for nearly every model– With these editors, it is possible to do simple
modifications to your model, like changing element properties or complex operations like changing the structure of your model in different ways at the same time
– All these modifications to your model can be handled in a graphical editor using very common functions like drag and drop, copy and paste, and actions invoked from menus or toolbars
ModelPediaModelPediaModel Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Centro de Informática – CIn/UFPeORCAS Group
ModelsModels
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
20/04/23 GEF - Graphical Modeling Framework 18
GMF Generated Diagram EditorGMF Generated Diagram Editor
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
GMF Generation OverviewGMF Generation Overview
20/04/23 GEF - Graphical Modeling Framework 19
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Develop Graphical DefinitionDevelop Graphical Definition
20/04/23 GEF - Graphical Modeling Framework 20
It is used to define the figures, nodes, links, etc. that you will display on
your diagram
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Develop Tooling DefinitionDevelop Tooling Definition
20/04/23 GEF - Graphical Modeling Framework 21
It is used to specify the palette, creation tools, actions, etc. for your graphical elements
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Mapping DefinitionMapping Definition
20/04/23 GEF - Graphical Modeling Framework 22
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Develop Mapping DefinitionDevelop Mapping Definition
20/04/23 GEF - Graphical Modeling Framework 23
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Create Generator ModelCreate Generator Model
20/04/23 GEF - Graphical Modeling Framework 24
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
Generate Diagram Plug-in and Run Generate Diagram Plug-in and Run DiagramDiagram
20/04/23 GEF - Graphical Modeling Framework 25
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
ValidationValidation Validation Rules are written in
OCL They are defined in GMF Map
model– State has ‘States should have
unique names’ validation rule– Rules for source and target of a
Transition ‘StopState cannot be a source for
a transition’ for StopState ‘StartState cannot be a target for a
transition’ for Transition
20/04/23 GEF - Graphical Modeling Framework 26
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
ConclusionsConclusions Creating graphical editors for domain models
is fairly straightforward Using GMF is an iterative process GMF code can be customized It allows M2M transformations
20/04/23 GEF - Graphical Modeling Framework 27
Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia
Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites
ReferencesReferences Eclipse GMF website http://www.eclipse.org/gmf
Eclipse Modeling Framework (EMF) website http://www.eclipse.org/emf
Graphical Modeling Framework (GEF) website http://ww.eclipse.org/gef
Using GMF and M2M for Model-Driven Development (Fesenko, T.; Dvorak, R.; Kolb B.; Voelter, M.)
Introducing the GMF Runtime. http://www.eclipse.org/articles/Article-Introducing-GMF/article.html
From Front End To Code - MDSD in Practice. http://www.eclipse.org/articles/Article-FromFrontendToCode-MDSDInPractice/article.html
20/04/23 GEF - Graphical Modeling Framework 28