SlideShare a Scribd company logo
Graphical Views
For Xtext
Jan Köhnlein
2014, Kiel
Why Go Graphical?
I Like Diagrams
Are very suggestive
Simplify communication
Highlight relations between elements
Are made for humans!
Diagram Tools
Human-centric requirements
Good visuals
Usability
Customizable behavior
Limited amount of information
Multiple diagrams for single model (projection)
Integration with non-graphical tooling
Graphical Model Editing
Mapping Mismatch
TreeNode
*
children Diagram
Node Edge
edgesnodes * *
TreeNode A {
TreeNode B
}
Diagram {
Node A
Node B
Edge (A,B)

}
Editor Sync
Projection means
Changes have to be merged with other editors
Frameworks won’t help!
Solutions introduce further usability issues
IDE surprises
Loss of changes
The workarounds
for these problems…
…will not only require
a lot of effort…
…but will also cause major
usability quirks.
Graphical
EditorView
Graphical Model Views
K.I.S.S.
Uni-directional mapping from model to diagram
Read-only model access
Makes multiple views on the same model easy
Leave model modification and details to Xtext
Simplicity allows to focus on
Visuals
Usability
Custom behavior
1 - Graphviz
Graphviz
Simple but powerful
DSL for diagrams
“LATEX for diagrams”
Print-ready rendering
Excellent open-source
layout algorithms
Used in PlantUML
digraph MrsGrantsSecretCompartments {	
	 "idle2"->"active" [label="doorClosed"]	
	 "active"->"waitingForLight" [label="drawOpened"]	
	 "active"->"waitingForDraw" [label="lightOn"]	
	 "waitingForLight"->"unlockedPanel" [label="lightOn"]	
	 "waitingForDraw"->"unlockedPanel" [label="drawOpened"]	
	 "unlockedPanel"->"idle2" [label="panelClosed"]	
}
idle2
active
doorClosed
waitingForLight
drawOpened
waitingForDraw
lightOn
unlockedPanel
lightOn drawOpened
panelClosed
2 - Zest
Zest
Views based on GEF
JFace abstractions for diagrams
IContentProvider
ILabelProvider
Hooks to configure figures, nesting and filters
New layouts
Enhanced Usability (?)
Live Views for Xtext
Xtext -> Diagram
class ShowInViewHandler extends AbstractHandler {	
!
	 @Inject EObjectAtOffsetHelper eObjectAtOffsetHelper	
	 	
	 override Object execute(ExecutionEvent event) throws ExecutionException {	
	 	 ...	
	 	 val editor = EditorUtils.getActiveXtextEditor(event)	
	 	 if (editor != null) {	
	 	 	 val selection = editor.selectionProvider.selection as ITextSelection	
	 	 	 editor.document.readOnly[	
	 	 	 	 val selectedElement = eObjectAtOffsetHelper.resolveElementAt(it,	
	 	 	 	 	 	 selection.offset)	
	 	 	 	 if (selectedElement != null) {	
	 	 	 	 	 ... // open in view	
	 	 	 	 }	
	 	 	 	 null	
	 	 	 ]	
	 	 }	
	 	 ...
URIs vs EObjects
class EObjectHandle {	
	 	
	 URI uri	
	 EObject element	
	 	
	 new(EObject element) {	
	 	 this.element = element	
	 	 this.uri = EcoreUtil.getURI(element)	
	 }	
	 	
	 def getElement() { element }	
	 def getURI() { uri }	
	 	
	 override hashCode() {	
	 	 uri.hashCode	
	 }	
!
	 override equals(Object obj) {	
	 	 if(obj instanceof EObjectHandle)	
	 	 	 return obj.uri == uri	
	 	 else	
	 	 	 return false	
	 }	
}
Diagram -> Xtext
@Inject IURIEditorOpener editorOpener	
	 	
...	
selectionListener = [ event | 	
	 val selection = event.selection as IStructuredSelection	
	 if(selection.size == 1) {	
	 	 val selectedElement = selection.firstElement	
	 	 if(selectedElement instanceof EObjectHandle)	
	 	 	 editorOpener.open(selectedElement.URI, true)	
	 }	
]
Diagram Layout
KIELER
Open-source, University of Kiel
Java API to various open-source layout algorithms
Including Graphviz layout
yFiles (yWorks)
ILOG JViews (IBM)
3 - Build Your Own GEF View
GEF
GEF is the base of all graphical Eclipse frameworks
Lowest level of abstraction
-> maximum freedom
Allows to enhance usability to a certain degree…
…but is seriously limited in rendering
4 - JavaFX
JavaFX
Next generation graphics framework
Overcomes limitations of GEF/SWT
Not primarily a diagram framework
Intuitive API
Combine with Xtend for max productivity
An Unfair Comparison
Graphviz Zest GEF JavaFX
Link with
Editor
no/(dot4zest) yes yes yes
Simplicity ++ + - - 0
Rendering ++ - - ++
Layouts ++ + - 0/++
Export vector raster raster raster/vector
Extensibility - - 0 + ++
Conclusion
Conclusion
Please, start to focus on humans/users again!
Visuals and ease of use are essential
Build your own behavior
Graphical views
Are simple to implement
Avoid usability issues of graphical editors
Head for
A state-of-the art rendering framework
A diagram library to get you started quickly
A powerful language to build your own additions
Links
https://github.com/JanKoehnlein
https://www.informatik.uni-kiel.de/rtsys/kieler/

More Related Content

PDF
Diagrams, Xtext and UX
PDF
Xtext, diagrams and ux
PDF
Graphical Views For Xtext With FXDiagram
PDF
Responsiveness
KEY
Implementing CATiledLayer
PDF
Design and Code. Work should be fun.
PPTX
Plotly & cartopy Module in python
PDF
WebGL Fundamentals
Diagrams, Xtext and UX
Xtext, diagrams and ux
Graphical Views For Xtext With FXDiagram
Responsiveness
Implementing CATiledLayer
Design and Code. Work should be fun.
Plotly & cartopy Module in python
WebGL Fundamentals

Viewers also liked (20)

PPTX
Building Your Own DSL with Xtext
PDF
Java DSLs with Xtext
PDF
Jazoon 2010 - Building DSLs with Eclipse
PPTX
Enhancing Xtext for General Purpose Languages
PDF
Eclipse DemoCamp in Paris: Language Development with Xtext
PDF
From Stairway to Heaven onto the Highway to Hell with Xtext
KEY
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
PDF
Future of Xtext
KEY
Xtext Best Practices
PDF
Xtext Webinar
PDF
Recipes to build Code Generators for Non-Xtext Models with Xtend
PDF
The Xtext Grammar Language
KEY
EMF - Beyond The Basics
DOC
EMF Tips n Tricks
PDF
Serializing EMF models with Xtext
PDF
DSLs for Java Developers
KEY
Xtend - A Language Made for Java Developers
PDF
ARText - Driving Developments with Xtext
PDF
Language Engineering With Xtext
PDF
What's Cooking in Xtext 2.0
Building Your Own DSL with Xtext
Java DSLs with Xtext
Jazoon 2010 - Building DSLs with Eclipse
Enhancing Xtext for General Purpose Languages
Eclipse DemoCamp in Paris: Language Development with Xtext
From Stairway to Heaven onto the Highway to Hell with Xtext
Pragmatic DSL Design with Xtext, Xbase and Xtend 2
Future of Xtext
Xtext Best Practices
Xtext Webinar
Recipes to build Code Generators for Non-Xtext Models with Xtend
The Xtext Grammar Language
EMF - Beyond The Basics
EMF Tips n Tricks
Serializing EMF models with Xtext
DSLs for Java Developers
Xtend - A Language Made for Java Developers
ARText - Driving Developments with Xtext
Language Engineering With Xtext
What's Cooking in Xtext 2.0
Ad

Similar to Graphical Views For Xtext (20)

PPT
Design Patterns By Sisimon Soman
PPTX
OOP, API Design and MVP
ODP
Ontology based semantics and graphical notation as directed graphs
PPT
Class & Object - Intro
PPT
Concepts In Object Oriented Programming Languages
PPTX
Automating SolidWorks with Excel
PDF
Session 2 android study jam
PPTX
Solid OOPS
PPTX
Class[3][5th jun] [three js]
PPTX
PATTERNS04 - Structural Design Patterns
PPTX
Design patterns
PPT
e4 Webinar - Toolkit Model
PDF
C# Summer course - Lecture 1
PPTX
COMP111-Week-1_138439.pptx
PDF
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
PDF
Visual C++ project model
PDF
Who killed object oriented design?
PDF
Introduction to Machine Learning with SciKit-Learn
PPT
CodeMash - Building Rich Apps with Groovy SwingBuilder
PPTX
UML as a Programming Language
Design Patterns By Sisimon Soman
OOP, API Design and MVP
Ontology based semantics and graphical notation as directed graphs
Class & Object - Intro
Concepts In Object Oriented Programming Languages
Automating SolidWorks with Excel
Session 2 android study jam
Solid OOPS
Class[3][5th jun] [three js]
PATTERNS04 - Structural Design Patterns
Design patterns
e4 Webinar - Toolkit Model
C# Summer course - Lecture 1
COMP111-Week-1_138439.pptx
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
Visual C++ project model
Who killed object oriented design?
Introduction to Machine Learning with SciKit-Learn
CodeMash - Building Rich Apps with Groovy SwingBuilder
UML as a Programming Language
Ad

More from Dr. Jan Köhnlein (20)

PDF
The Eclipse Layout Kernel sirius con 2017
PDF
A New Approach Towards Web-based IDEs
PDF
Getting rid of backtracking
PDF
PDF
PDF
Diagram Editors - The FXed Generation
PDF
Code Generation With Xtend
PDF
Eclipse Diagram Editors - An Endangered Species
PDF
A fresh look at graphical editing
PDF
A fresh look at graphical editing
KEY
A fresh look at graphical editing
PDF
Android tutorial - Xtext slides
KEY
Eclipse meets e4
KEY
Combining Text and Graphics in Eclipse-based Modeling Tools
KEY
Combining Graphical and Textual
KEY
Domain Specific Languages With Eclipse Modeling
KEY
Domänenspezifische Sprachen mit Xtext
KEY
Workshop On Xtext
KEY
KEY
Eclipse Modeling Overview
The Eclipse Layout Kernel sirius con 2017
A New Approach Towards Web-based IDEs
Getting rid of backtracking
Diagram Editors - The FXed Generation
Code Generation With Xtend
Eclipse Diagram Editors - An Endangered Species
A fresh look at graphical editing
A fresh look at graphical editing
A fresh look at graphical editing
Android tutorial - Xtext slides
Eclipse meets e4
Combining Text and Graphics in Eclipse-based Modeling Tools
Combining Graphical and Textual
Domain Specific Languages With Eclipse Modeling
Domänenspezifische Sprachen mit Xtext
Workshop On Xtext
Eclipse Modeling Overview

Recently uploaded (20)

PDF
Digital Strategies for Manufacturing Companies
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Introduction to Artificial Intelligence
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
System and Network Administraation Chapter 3
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Cost to Outsource Software Development in 2025
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
history of c programming in notes for students .pptx
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
System and Network Administration Chapter 2
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Digital Strategies for Manufacturing Companies
Which alternative to Crystal Reports is best for small or large businesses.pdf
Introduction to Artificial Intelligence
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
System and Network Administraation Chapter 3
Softaken Excel to vCard Converter Software.pdf
Cost to Outsource Software Development in 2025
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Design an Analysis of Algorithms II-SECS-1021-03
history of c programming in notes for students .pptx
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
wealthsignaloriginal-com-DS-text-... (1).pdf
L1 - Introduction to python Backend.pptx
System and Network Administration Chapter 2
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Reimagine Home Health with the Power of Agentic AI​
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Designing Intelligence for the Shop Floor.pdf
iTop VPN Free 5.6.0.5262 Crack latest version 2025

Graphical Views For Xtext

  • 1. Graphical Views For Xtext Jan Köhnlein 2014, Kiel
  • 3. I Like Diagrams Are very suggestive Simplify communication Highlight relations between elements Are made for humans!
  • 4. Diagram Tools Human-centric requirements Good visuals Usability Customizable behavior Limited amount of information Multiple diagrams for single model (projection) Integration with non-graphical tooling
  • 6. Mapping Mismatch TreeNode * children Diagram Node Edge edgesnodes * * TreeNode A { TreeNode B } Diagram { Node A Node B Edge (A,B)
 }
  • 7. Editor Sync Projection means Changes have to be merged with other editors Frameworks won’t help! Solutions introduce further usability issues IDE surprises Loss of changes
  • 9. …will not only require a lot of effort…
  • 10. …but will also cause major usability quirks.
  • 12. Graphical Model Views K.I.S.S. Uni-directional mapping from model to diagram Read-only model access Makes multiple views on the same model easy Leave model modification and details to Xtext Simplicity allows to focus on Visuals Usability Custom behavior
  • 14. Graphviz Simple but powerful DSL for diagrams “LATEX for diagrams” Print-ready rendering Excellent open-source layout algorithms Used in PlantUML digraph MrsGrantsSecretCompartments { "idle2"->"active" [label="doorClosed"] "active"->"waitingForLight" [label="drawOpened"] "active"->"waitingForDraw" [label="lightOn"] "waitingForLight"->"unlockedPanel" [label="lightOn"] "waitingForDraw"->"unlockedPanel" [label="drawOpened"] "unlockedPanel"->"idle2" [label="panelClosed"] } idle2 active doorClosed waitingForLight drawOpened waitingForDraw lightOn unlockedPanel lightOn drawOpened panelClosed
  • 16. Zest Views based on GEF JFace abstractions for diagrams IContentProvider ILabelProvider Hooks to configure figures, nesting and filters New layouts Enhanced Usability (?)
  • 17. Live Views for Xtext
  • 18. Xtext -> Diagram class ShowInViewHandler extends AbstractHandler { ! @Inject EObjectAtOffsetHelper eObjectAtOffsetHelper override Object execute(ExecutionEvent event) throws ExecutionException { ... val editor = EditorUtils.getActiveXtextEditor(event) if (editor != null) { val selection = editor.selectionProvider.selection as ITextSelection editor.document.readOnly[ val selectedElement = eObjectAtOffsetHelper.resolveElementAt(it, selection.offset) if (selectedElement != null) { ... // open in view } null ] } ...
  • 19. URIs vs EObjects class EObjectHandle { URI uri EObject element new(EObject element) { this.element = element this.uri = EcoreUtil.getURI(element) } def getElement() { element } def getURI() { uri } override hashCode() { uri.hashCode } ! override equals(Object obj) { if(obj instanceof EObjectHandle) return obj.uri == uri else return false } }
  • 20. Diagram -> Xtext @Inject IURIEditorOpener editorOpener ... selectionListener = [ event | val selection = event.selection as IStructuredSelection if(selection.size == 1) { val selectedElement = selection.firstElement if(selectedElement instanceof EObjectHandle) editorOpener.open(selectedElement.URI, true) } ]
  • 21. Diagram Layout KIELER Open-source, University of Kiel Java API to various open-source layout algorithms Including Graphviz layout yFiles (yWorks) ILOG JViews (IBM)
  • 22. 3 - Build Your Own GEF View
  • 23. GEF GEF is the base of all graphical Eclipse frameworks Lowest level of abstraction -> maximum freedom Allows to enhance usability to a certain degree… …but is seriously limited in rendering
  • 25. JavaFX Next generation graphics framework Overcomes limitations of GEF/SWT Not primarily a diagram framework Intuitive API Combine with Xtend for max productivity
  • 27. Graphviz Zest GEF JavaFX Link with Editor no/(dot4zest) yes yes yes Simplicity ++ + - - 0 Rendering ++ - - ++ Layouts ++ + - 0/++ Export vector raster raster raster/vector Extensibility - - 0 + ++
  • 29. Conclusion Please, start to focus on humans/users again! Visuals and ease of use are essential Build your own behavior Graphical views Are simple to implement Avoid usability issues of graphical editors Head for A state-of-the art rendering framework A diagram library to get you started quickly A powerful language to build your own additions