Eclipse GMF

28
ModelPedia ModelPedia Model Driven Engineering Graphical User Interfaces for Web 2.0 Centro de Informática – CIn/UF ORCAS Gro Eclipse Eclipse GMF GMF Fábio M. Pereira Ramon Rabello

description

Eclipse GMF. Fábio M. Pereira Ramon Rabello. Agenda. GMF – What is it? EMF – Overview GEF – Overview GMF – Models. GMF – What is it?. - PowerPoint PPT Presentation

Transcript of Eclipse GMF

Page 1: Eclipse GMF

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

Page 2: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/04/23 GEF - Graphical Modeling Framework 2

AgendaAgenda GMF – What is it? EMF – Overview GEF – Overview GMF – Models

Page 3: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/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

Page 4: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/04/23 GEF - Graphical Modeling Framework 4

GMF – What is it?GMF – What is it?

Page 5: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

ScenarioScenario

22/04/23 GEF - Graphical Modeling Framework 5

Page 6: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

ComponentsComponents

22/04/23 GEF - Graphical Modeling Framework 6

Page 7: Eclipse GMF

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

22/04/23 GEF - Graphical Modeling Framework 7

Page 8: Eclipse GMF

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

22/04/23 GEF - Graphical Modeling Framework 8

Page 9: Eclipse GMF

ModelPediaModelPediaModel Driven Engineering Graphical User Interfaces for Web 2.0 Sites

Centro de Informática – CIn/UFPeORCAS Group

EMF EMF OverviewOverview

Page 10: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/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

Page 11: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/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

Page 12: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/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

Page 13: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/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)

Page 14: Eclipse GMF

ModelPediaModelPediaModel Driven Engineering Graphical User Interfaces for Web 2.0 Sites

Centro de Informática – CIn/UFPeORCAS Group

GEFGEFGraphical Editing Graphical Editing

FrameworkFramework

OverviewOverview

Page 15: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/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

Page 16: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/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

Page 17: Eclipse GMF

ModelPediaModelPediaModel Driven Engineering Graphical User Interfaces for Web 2.0 Sites

Centro de Informática – CIn/UFPeORCAS Group

ModelsModels

Page 18: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

22/04/23 GEF - Graphical Modeling Framework 18

GMF Generated Diagram EditorGMF Generated Diagram Editor

Page 19: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

GMF Generation OverviewGMF Generation Overview

22/04/23 GEF - Graphical Modeling Framework 19

Page 20: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

Develop Graphical DefinitionDevelop Graphical Definition

22/04/23 GEF - Graphical Modeling Framework 20

It is used to define the figures, nodes, links, etc. that you will display on

your diagram

Page 21: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

Develop Tooling DefinitionDevelop Tooling Definition

22/04/23 GEF - Graphical Modeling Framework 21

It is used to specify the palette, creation tools, actions, etc. for your graphical elements

Page 22: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

Mapping DefinitionMapping Definition

22/04/23 GEF - Graphical Modeling Framework 22

Page 23: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

Develop Mapping DefinitionDevelop Mapping Definition

22/04/23 GEF - Graphical Modeling Framework 23

Page 24: Eclipse GMF

Centro de Informática – CIn/UFPeORCAS GroupModelPediaModelPedia

Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites

Create Generator ModelCreate Generator Model

22/04/23 GEF - Graphical Modeling Framework 24

Page 25: Eclipse GMF

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

22/04/23 GEF - Graphical Modeling Framework 25

Page 26: Eclipse GMF

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

22/04/23 GEF - Graphical Modeling Framework 26

Page 27: Eclipse GMF

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

22/04/23 GEF - Graphical Modeling Framework 27

Page 28: Eclipse GMF

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

22/04/23 GEF - Graphical Modeling Framework 28