SlideShare a Scribd company logo
1 of 79
Combining
Graphics and Text
       in
 Modeling Tools
                    Jan Köhnlein
GMF
Graphical
GMF
          Graphical




 Xtext
Textual
GMF
             Graphical


Just two different views
   on the same thing


    Xtext
   Textual
Synchronization
Xtext
Xtext

              Textual Model


        Serializer
                     Parser
                              Node Model



               Ecore Model
                Instance
Xtext
        XtextResource

                     Textual Model


               Serializer
                            Parser
                                     Node Model



                      Ecore Model
                       Instance
Xtext
        XtextResource

                     Textual Model


               Serializer
                            Parser
                                     Node Model



                      Ecore Model
                       Instance




                getContents()
Xtext                load(), save()



        XtextResource

                     Textual Model


               Serializer
                            Parser
                                      Node Model



                      Ecore Model
                       Instance




                getContents()
Xtext                load(), save()



        XtextResource

                     Textual Model


               Serializer
                            Parser
                                          Node Model



                      Ecore Model
                       Instance         FragmentProvider




                getContents()         getURIFragment()
                                      getEObject()
ResourceSet


XtextResource                 DiagramResource
diagram
                                         change

                ResourceSet


XtextResource                 DiagramResource
ResourceSet


XtextResource                 DiagramResource
reparse()
w/ errors

                    ResourceSet


    XtextResource                 DiagramResource
ResourceSet


XtextResource                 DiagramResource
ResourceSet


XtextResource                 DiagramResource




                Canonical
                EditPolicy
ResourceSet


XtextResource                 DiagramResource




                Canonical
                EditPolicy
ResourceSet


XtextResource                 DiagramResource




                Canonical
                EditPolicy
Fi e l
                    od a
                 M xtu
                  le l
                    Te
 ResourceSet                         ResourceSet


XtextResource              XtextResource    DiagramResource
Fi e l
                    od a
                 M xtu
                  le l
                    Te
 ResourceSet                         ResourceSet


XtextResource              XtextResource    DiagramResource
Fi e l
                    od a
                 M xtu
                  le l
                    Te
 ResourceSet                         ResourceSet


XtextResource              XtextResource    DiagramResource
Fi e l
                      od a
                   M xtu
                    le l
                      Te
 ResourceSet                           ResourceSet


XtextResource   save()       XtextResource    DiagramResource
Fi e l
                     od a
                  M xtu
                   le l
                     Te
 ResourceSet                          ResourceSet


XtextResource   reload()    XtextResource    DiagramResource
Fi e l
                     od a
                  M xtu
                   le l
                     Te
 ResourceSet                          ResourceSet


XtextResource   reload()    XtextResource    DiagramResource
Fi e l
                    od a
                 M xtu
                  le l
                    Te
 ResourceSet                         ResourceSet


XtextResource              XtextResource    DiagramResource
Demo Time
Create a Diagram
Save Diagram
Open Textual Model
Edit Textual Model
Save Textual Model
Edit Diagram
Reorder Objects
Diagram With Unsaved Changes
Try to Edit Text
Other Way Around...
Navigation
Popup Editor
Alignment
grammar org.xtext.cg2009.Entities
  with org.eclipse.xtext.common.Terminals

generate entities "http://www.xtext.org/cg2009/Entities"

Model :
	 {Model} (entities += Entity)*;
	
Entity returns Entity:
	 'entity' (name=ID)? ('extends' superType=[Entity])? '{'
	 	 (properties+=Property)*
	 '}';
	
Property:
	 SimpleProperty | ReferenceProperty;
	
SimpleProperty:
	 'property' (name=ID)? ':' type=('String'|'Number'|'Bool');
	
ReferenceProperty :
	 (name=ID)? 'refs' ('one' | many?='many')? type=[Entity];
grammar org.xtext.cg2009.Entities
  with org.eclipse.xtext.common.Terminals

               Avoid empty
generate entities "http://www.xtext.org/cg2009/Entities"
                 models
Model :
	 {Model} (entities += Entity)*;
	
Entity returns Entity:
	 'entity' (name=ID)? ('extends' superType=[Entity])? '{'
	 	 (properties+=Property)*
	 '}';
	
Property:
	 SimpleProperty | ReferenceProperty;
	
SimpleProperty:
	 'property' (name=ID)? ':' type=('String'|'Number'|'Bool');
	
ReferenceProperty :
	 (name=ID)? 'refs' ('one' | many?='many')? type=[Entity];
grammar org.xtext.cg2009.Entities
  with org.eclipse.xtext.common.Terminals

               Avoid empty
generate entities "http://www.xtext.org/cg2009/Entities"
                 models
Model :
	 {Model} (entities += Entity)*;
	
Entity returns Entity:
	 'entity' (name=ID)? ('extends' superType=[Entity])? '{'
	 	 (properties+=Property)*
	 '}';
	
Property:
                         Cover mandatory
	 SimpleProperty | ReferenceProperty;
	                          properties in
SimpleProperty:
                             validation
	 'property' (name=ID)? ':' type=('String'|'Number'|'Bool');
	
ReferenceProperty :
	 (name=ID)? 'refs' ('one' | many?='many')? type=[Entity];
grammar org.xtext.cg2009.Entities
  with org.eclipse.xtext.common.Terminals

               Avoid empty
generate entities "http://www.xtext.org/cg2009/Entities"
                                              Carefully select
                 models
Model :                                     containment or cross
	 {Model} (entities += Entity)*;                 references
	
Entity returns Entity:
	 'entity' (name=ID)? ('extends' superType=[Entity])? '{'
	 	 (properties+=Property)*
	 '}';
	
Property:
                         Cover mandatory
	 SimpleProperty | ReferenceProperty;
	                          properties in
SimpleProperty:
                             validation
	 'property' (name=ID)? ':' type=('String'|'Number'|'Bool');
	
ReferenceProperty :
	 (name=ID)? 'refs' ('one' | many?='many')? type=[Entity];
Xtext
Xtext
        Implement a
         Formatter
Xtext
        Implement a
         Formatter


             Implement a
          FragmentProvider
Xtext
           Implement a
            Formatter


                 Implement a
              FragmentProvider



        Implement a
        JavaValidator
GMF
GMF

 Initialize
mandatory
properties
GMF

         Initialize
        mandatory
        properties



Avoid Phantom
    Nodes
Add a
transaction on
                                 GMF
     load



                    Initialize
                   mandatory
                   properties



           Avoid Phantom
               Nodes
Glue Code
• Prevent conflicting modifications
• Navigate
 • diagram ➜ text
 • text ➜ diagram
    (needs index)
• Popup editor
• Shipped as an Xtext example
Thanks for your
  attention!

               More information at
                  www.itemis.de
                  www.xtext.org
              koehnlein.blogspot.com

More Related Content

Viewers also liked

Upgrade your presentations
Upgrade your presentationsUpgrade your presentations
Upgrade your presentations
keekee92
 
In cloud galleries comparison
In cloud galleries comparisonIn cloud galleries comparison
In cloud galleries comparison
AdryMorci
 
Introduction to technical writing
Introduction to technical writingIntroduction to technical writing
Introduction to technical writing
Adam Tablante
 

Viewers also liked (16)

Upgrade your presentations
Upgrade your presentationsUpgrade your presentations
Upgrade your presentations
 
GNU Image Manipulation Program
GNU Image Manipulation ProgramGNU Image Manipulation Program
GNU Image Manipulation Program
 
Introducing R
Introducing RIntroducing R
Introducing R
 
In cloud galleries comparison
In cloud galleries comparisonIn cloud galleries comparison
In cloud galleries comparison
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Unit1 module4 em
Unit1 module4 emUnit1 module4 em
Unit1 module4 em
 
Introduction to technical writing
Introduction to technical writingIntroduction to technical writing
Introduction to technical writing
 
Animate pp1
Animate pp1Animate pp1
Animate pp1
 
Mail merge
Mail mergeMail merge
Mail merge
 
Creating mail merge
Creating mail mergeCreating mail merge
Creating mail merge
 
Contextualized online search and research skills
Contextualized online search and research skillsContextualized online search and research skills
Contextualized online search and research skills
 
How to hack computers how to h joel tope
How to hack computers  how to h   joel topeHow to hack computers  how to h   joel tope
How to hack computers how to h joel tope
 
Unit1 module1 em
Unit1 module1 emUnit1 module1 em
Unit1 module1 em
 
Lesson 2 Online Safety, Security, Ethics and Etiquette
Lesson 2   Online Safety, Security, Ethics and EtiquetteLesson 2   Online Safety, Security, Ethics and Etiquette
Lesson 2 Online Safety, Security, Ethics and Etiquette
 
Online Platform :Empowerment of technologies ICT
Online Platform :Empowerment of technologies ICTOnline Platform :Empowerment of technologies ICT
Online Platform :Empowerment of technologies ICT
 
Its all about Infographics
Its all about InfographicsIts all about Infographics
Its all about Infographics
 

Similar to Combining Text and Graphics in Eclipse-based Modeling Tools

Ti1220 Lecture 7: Polymorphism
Ti1220 Lecture 7: PolymorphismTi1220 Lecture 7: Polymorphism
Ti1220 Lecture 7: Polymorphism
Eelco Visser
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
Kat Roque
 
Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012
Coen De Roover
 
Executing bpmn 2.0 with j bpm 3 or (at your option) any later version
Executing bpmn 2.0 with j bpm 3 or (at your option) any later versionExecuting bpmn 2.0 with j bpm 3 or (at your option) any later version
Executing bpmn 2.0 with j bpm 3 or (at your option) any later version
camunda services GmbH
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
brecke
 

Similar to Combining Text and Graphics in Eclipse-based Modeling Tools (20)

Xtext's new Formatter API
Xtext's new Formatter APIXtext's new Formatter API
Xtext's new Formatter API
 
Dynamic Python
Dynamic PythonDynamic Python
Dynamic Python
 
Ti1220 Lecture 7: Polymorphism
Ti1220 Lecture 7: PolymorphismTi1220 Lecture 7: Polymorphism
Ti1220 Lecture 7: Polymorphism
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
Avoiding JavaScript Pitfalls Through Tree Hugging
Avoiding JavaScript Pitfalls Through Tree HuggingAvoiding JavaScript Pitfalls Through Tree Hugging
Avoiding JavaScript Pitfalls Through Tree Hugging
 
Doc Parsers Api Cheatsheet 1 0
Doc Parsers Api Cheatsheet 1 0Doc Parsers Api Cheatsheet 1 0
Doc Parsers Api Cheatsheet 1 0
 
F Files - Learnings from 3 years of Neos Support
F Files - Learnings from 3 years of Neos SupportF Files - Learnings from 3 years of Neos Support
F Files - Learnings from 3 years of Neos Support
 
Modern C++
Modern C++Modern C++
Modern C++
 
Code Generation for Azure with .net
Code Generation for Azure with .netCode Generation for Azure with .net
Code Generation for Azure with .net
 
VelocityGraph Introduction
VelocityGraph IntroductionVelocityGraph Introduction
VelocityGraph Introduction
 
php&mysql with Ethical Hacking
php&mysql with Ethical Hackingphp&mysql with Ethical Hacking
php&mysql with Ethical Hacking
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012
 
HexRaysCodeXplorer: object oriented RE for fun and profit
HexRaysCodeXplorer: object oriented RE for fun and profitHexRaysCodeXplorer: object oriented RE for fun and profit
HexRaysCodeXplorer: object oriented RE for fun and profit
 
Executing bpmn 2.0 with j bpm 3 or (at your option) any later version
Executing bpmn 2.0 with j bpm 3 or (at your option) any later versionExecuting bpmn 2.0 with j bpm 3 or (at your option) any later version
Executing bpmn 2.0 with j bpm 3 or (at your option) any later version
 
OpenCog Developer Workshop
OpenCog Developer WorkshopOpenCog Developer Workshop
OpenCog Developer Workshop
 
Serializing EMF models with Xtext
Serializing EMF models with XtextSerializing EMF models with Xtext
Serializing EMF models with Xtext
 
Xbase - Implementing Domain-Specific Languages for Java
Xbase - Implementing Domain-Specific Languages for JavaXbase - Implementing Domain-Specific Languages for Java
Xbase - Implementing Domain-Specific Languages for Java
 
Extending the Xbase Typesystem
Extending the Xbase TypesystemExtending the Xbase Typesystem
Extending the Xbase Typesystem
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
 

More from Dr. Jan Köhnlein

A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
Dr. Jan Köhnlein
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
Dr. Jan Köhnlein
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
Dr. Jan Köhnlein
 

More from Dr. Jan Köhnlein (20)

The Eclipse Layout Kernel sirius con 2017
The Eclipse Layout Kernel   sirius con 2017The Eclipse Layout Kernel   sirius con 2017
The Eclipse Layout Kernel sirius con 2017
 
A New Approach Towards Web-based IDEs
A New Approach Towards Web-based IDEsA New Approach Towards Web-based IDEs
A New Approach Towards Web-based IDEs
 
Responsiveness
ResponsivenessResponsiveness
Responsiveness
 
Getting rid of backtracking
Getting rid of backtrackingGetting rid of backtracking
Getting rid of backtracking
 
Graphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagramGraphical Views For Xtext With FXDiagram
Graphical Views For Xtext With FXDiagram
 
XRobots
XRobotsXRobots
XRobots
 
Diagrams, Xtext and UX
Diagrams, Xtext and UXDiagrams, Xtext and UX
Diagrams, Xtext and UX
 
Scoping
ScopingScoping
Scoping
 
Xtext, diagrams and ux
Xtext, diagrams and uxXtext, diagrams and ux
Xtext, diagrams and ux
 
Diagram Editors - The FXed Generation
Diagram Editors - The FXed GenerationDiagram Editors - The FXed Generation
Diagram Editors - The FXed Generation
 
Code Generation With Xtend
Code Generation With XtendCode Generation With Xtend
Code Generation With Xtend
 
Graphical Views For Xtext
Graphical Views For XtextGraphical Views For Xtext
Graphical Views For Xtext
 
The Xtext Grammar Language
The Xtext Grammar LanguageThe Xtext Grammar Language
The Xtext Grammar Language
 
Eclipse Diagram Editors - An Endangered Species
Eclipse Diagram Editors - An Endangered SpeciesEclipse Diagram Editors - An Endangered Species
Eclipse Diagram Editors - An Endangered Species
 
Java DSLs with Xtext
Java DSLs with XtextJava DSLs with Xtext
Java DSLs with Xtext
 
DSLs for Java Developers
DSLs for Java DevelopersDSLs for Java Developers
DSLs for Java Developers
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
 
A fresh look at graphical editing
A fresh look at graphical editingA fresh look at graphical editing
A fresh look at graphical editing
 
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Combining Text and Graphics in Eclipse-based Modeling Tools

  • 1. Combining Graphics and Text in Modeling Tools Jan Köhnlein
  • 2.
  • 4. GMF Graphical Xtext Textual
  • 5. GMF Graphical Just two different views on the same thing Xtext Textual
  • 8. Xtext Textual Model Serializer Parser Node Model Ecore Model Instance
  • 9. Xtext XtextResource Textual Model Serializer Parser Node Model Ecore Model Instance
  • 10. Xtext XtextResource Textual Model Serializer Parser Node Model Ecore Model Instance getContents()
  • 11. Xtext load(), save() XtextResource Textual Model Serializer Parser Node Model Ecore Model Instance getContents()
  • 12. Xtext load(), save() XtextResource Textual Model Serializer Parser Node Model Ecore Model Instance FragmentProvider getContents() getURIFragment() getEObject()
  • 13. ResourceSet XtextResource DiagramResource
  • 14. diagram change ResourceSet XtextResource DiagramResource
  • 15. ResourceSet XtextResource DiagramResource
  • 16. reparse() w/ errors ResourceSet XtextResource DiagramResource
  • 17. ResourceSet XtextResource DiagramResource
  • 18. ResourceSet XtextResource DiagramResource Canonical EditPolicy
  • 19. ResourceSet XtextResource DiagramResource Canonical EditPolicy
  • 20. ResourceSet XtextResource DiagramResource Canonical EditPolicy
  • 21. Fi e l od a M xtu le l Te ResourceSet ResourceSet XtextResource XtextResource DiagramResource
  • 22. Fi e l od a M xtu le l Te ResourceSet ResourceSet XtextResource XtextResource DiagramResource
  • 23. Fi e l od a M xtu le l Te ResourceSet ResourceSet XtextResource XtextResource DiagramResource
  • 24. Fi e l od a M xtu le l Te ResourceSet ResourceSet XtextResource save() XtextResource DiagramResource
  • 25. Fi e l od a M xtu le l Te ResourceSet ResourceSet XtextResource reload() XtextResource DiagramResource
  • 26. Fi e l od a M xtu le l Te ResourceSet ResourceSet XtextResource reload() XtextResource DiagramResource
  • 27. Fi e l od a M xtu le l Te ResourceSet ResourceSet XtextResource XtextResource DiagramResource
  • 29.
  • 31.
  • 32.
  • 34.
  • 35.
  • 37.
  • 38.
  • 40.
  • 41.
  • 43.
  • 44.
  • 46.
  • 47.
  • 49.
  • 50.
  • 52.
  • 53.
  • 54. Try to Edit Text
  • 55.
  • 56.
  • 58.
  • 59.
  • 61.
  • 62.
  • 64.
  • 66. grammar org.xtext.cg2009.Entities with org.eclipse.xtext.common.Terminals generate entities "http://www.xtext.org/cg2009/Entities" Model : {Model} (entities += Entity)*; Entity returns Entity: 'entity' (name=ID)? ('extends' superType=[Entity])? '{' (properties+=Property)* '}'; Property: SimpleProperty | ReferenceProperty; SimpleProperty: 'property' (name=ID)? ':' type=('String'|'Number'|'Bool'); ReferenceProperty : (name=ID)? 'refs' ('one' | many?='many')? type=[Entity];
  • 67. grammar org.xtext.cg2009.Entities with org.eclipse.xtext.common.Terminals Avoid empty generate entities "http://www.xtext.org/cg2009/Entities" models Model : {Model} (entities += Entity)*; Entity returns Entity: 'entity' (name=ID)? ('extends' superType=[Entity])? '{' (properties+=Property)* '}'; Property: SimpleProperty | ReferenceProperty; SimpleProperty: 'property' (name=ID)? ':' type=('String'|'Number'|'Bool'); ReferenceProperty : (name=ID)? 'refs' ('one' | many?='many')? type=[Entity];
  • 68. grammar org.xtext.cg2009.Entities with org.eclipse.xtext.common.Terminals Avoid empty generate entities "http://www.xtext.org/cg2009/Entities" models Model : {Model} (entities += Entity)*; Entity returns Entity: 'entity' (name=ID)? ('extends' superType=[Entity])? '{' (properties+=Property)* '}'; Property: Cover mandatory SimpleProperty | ReferenceProperty; properties in SimpleProperty: validation 'property' (name=ID)? ':' type=('String'|'Number'|'Bool'); ReferenceProperty : (name=ID)? 'refs' ('one' | many?='many')? type=[Entity];
  • 69. grammar org.xtext.cg2009.Entities with org.eclipse.xtext.common.Terminals Avoid empty generate entities "http://www.xtext.org/cg2009/Entities" Carefully select models Model : containment or cross {Model} (entities += Entity)*; references Entity returns Entity: 'entity' (name=ID)? ('extends' superType=[Entity])? '{' (properties+=Property)* '}'; Property: Cover mandatory SimpleProperty | ReferenceProperty; properties in SimpleProperty: validation 'property' (name=ID)? ':' type=('String'|'Number'|'Bool'); ReferenceProperty : (name=ID)? 'refs' ('one' | many?='many')? type=[Entity];
  • 70. Xtext
  • 71. Xtext Implement a Formatter
  • 72. Xtext Implement a Formatter Implement a FragmentProvider
  • 73. Xtext Implement a Formatter Implement a FragmentProvider Implement a JavaValidator
  • 74. GMF
  • 76. GMF Initialize mandatory properties Avoid Phantom Nodes
  • 77. Add a transaction on GMF load Initialize mandatory properties Avoid Phantom Nodes
  • 78. Glue Code • Prevent conflicting modifications • Navigate • diagram ➜ text • text ➜ diagram (needs index) • Popup editor • Shipped as an Xtext example
  • 79. Thanks for your attention! More information at www.itemis.de www.xtext.org koehnlein.blogspot.com

Editor's Notes