tools for diagrammatic specifications stian skjerveggen supervisors: yngve lamo, adrian rutle, uwe...
TRANSCRIPT
![Page 1: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/1.jpg)
Tools for Diagrammatic Specifications
Stian SkjerveggenSupervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert
Wolter
![Page 2: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/2.jpg)
The background
Formal models can be expressed by specification techniques specified in Diagrammatic Predicate Logic (DPL)
DPL is a proposed formalism for Model-Driven Software Architecture
Our focus is on investigating, adapting, evaluating… these proposals
![Page 3: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/3.jpg)
Todays situation
Many different editors for modeling languages exists
The main problem is that they have no generic way to describe modeling languages
… and most of them have semi-formal semantics
![Page 4: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/4.jpg)
The project
A graphical editor is to be designed and implemented that allows to specify abstract signatures corresponding to metamodels of modeling languages and also supports the definition of transformations between those signatures.
Slogan: Signature ~ Modeling Language
![Page 5: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/5.jpg)
Related work
Sketcher95• Incomplete
• Not fully functional
• No source code
Sketcher v1.0 (.NET)• Previous master thesis
• Also incomplete and not fully functional
• Tries to recreate Sketcher95
![Page 6: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/6.jpg)
The platform
Previous version in C # Eclipse was chosen as the developing platform So why choose Eclipse?
• Alot of model related projects in the Eclipse community (Eclipse Modeling Framework)
• You get a lot for free by using Eclispe
Eclipse is much more than just a Java IDE Eclipse can be used to create many different
types of applications
![Page 7: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/7.jpg)
What Eclipse provides
Open source, robust, commercial quality platform
Extensible frameworks For this project, the main features are
the Eclipse Modeling Framework, the Graphical Editing Framework and the Graphical Modeling Framework
![Page 8: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/8.jpg)
Eclipse Modeling Framework - EMF
A modeling framework and code generation facility
Model specification described in XMI XMI (XML Metadata Interchange) is
OMGs standard for exchanging Metadata information
The core of EMF is called Ecore (metamodel of EMF models is Ecore)
![Page 9: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/9.jpg)
The advantages of EMF
Serialization Notification Code generation
Low cost entry for/into modeling
![Page 10: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/10.jpg)
Graphical Editing Framework
Allows developers to take an existing application model and quickly create a rich graphical editor
Many common operations are provided MVC architecture
![Page 11: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/11.jpg)
The advantages of GEF
Most of the graphical elements are predefined and can be extended
A standard look and feel for all graphical editors in Eclipse
![Page 12: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/12.jpg)
Graphical Modeling Framework - GMF
GMF bridges the gap between the model (EMF), the view and the controller (both from GEF)
With GMF you can produce graphical editors for Eclipse
![Page 13: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/13.jpg)
GMF Workflow
Generator Model (GMFGen)
Java code
Mapping (GMFMap)
Tool Definition (GMFTool)
Graphical Definition (GMFGraph)
Domain Model (ECore)
![Page 14: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/14.jpg)
Example GMF application
Drawing palette
View
<eClassifier eType=”EClass” name=”Supplier”><eStructuralFeature eType=”eReference” name=”orders”
eReferenceType=”PurchaseOrder”/> …</eClassifier>
Domain Model
![Page 15: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/15.jpg)
Summary of the frameworks used
EMF provides the model and serialization of it
GEF provides the visualization and the controllers
GMF maps the model, controllers, the visualization and tools (drawing palette) together and generates a diagram editor
![Page 16: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/16.jpg)
Challenges
The biggest challenge is finding out how to do things in Eclipse
Eclipse is a prime example of Agile Development
Eclipse UI Guideline Eclipse Best Practices ”Ready for Rational Software” -- IBM
![Page 17: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/17.jpg)
Challenges EMF
Need additional info for our model EMF supports Extended Meta Data and
this gets recorded as annotations in the Ecore model
![Page 18: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/18.jpg)
Challenges GMF
The code that GMF generates must often be adapted
A lot of code has to be customized to support our additional information
![Page 19: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/19.jpg)
GMF generated code
For a simple diagram containing only Nodes and Edges, 90 source files are generated, with most of the classes extending other classes
![Page 20: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/20.jpg)
Modeling and DPL formalism
Signatures ~ Modeling languages Signature := collection of predicates Predicate ~ constraints set by modeling
languages Diagram Specifications ~ models
![Page 21: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/21.jpg)
Predicates
You can compare a predicate to a Design Pattern
Want to label elements (nodes, arrows and diagrams) from the model by one or more predicates
This must be visualized somehow (next) The predicate information needs to be
saved with the model
![Page 22: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/22.jpg)
How are Predicates Visualized?
Predicates on arrows Arrow decorations
Predicates on nodes Node decorations
Predicates on diagrams Diagram decorations• Diagram dec. := decoration on a set of nodes
and arrows
![Page 23: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/23.jpg)
Arrow decorations in GMF
By default, edges generated by GMF are just lines
Need to add arrowheads manually, either by setting up a point-path or creating your own
![Page 24: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/24.jpg)
Arrow decorations - Example
![Page 25: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/25.jpg)
Dynamic visualization
We want to change visualization based on attributes on the model elements• Ex. A predicate has been added to a node
This is not default behaviour in GMF, so it needs to be custom made
![Page 26: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/26.jpg)
Changing view based on model attributes
Normally, GMF doesn’t change the view of an element once it has been painted
But since the view is attached to the model as a listener, we can detect changes in the model via the method handleNotifications()
![Page 27: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/27.jpg)
Example customization – Coloring nodes
/** * @generated NOT */protected IFigure createNodeShape() { NodeFigure figure = new NodeFigure(); // checking for red color changeFigureColor(figure); return primaryShape = figure;}
private void changeFigureColor(IFigure figure) { Node node = (Node) ((View)getModel()).getElement(); if (node.getNodeTypes().contains(NodeType.RED)) { figure.setBackgroundColor(ColorConstants.red); if (node.getNodeTypes().contains(NodeType.BLUE)) figure.setBackgroundColor(new Color(null, 153, 51, 255)); } else if (node.getNodeTypes().contains(NodeType.BLUE)) figure.setBackgroundColor(ColorConstants.blue); else figure.setBackgroundColor(ColorConstants.white); node = null;}
![Page 28: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/28.jpg)
Coloring nodes – cntd(1)/** * Need to override this to get the colorchanging bit to work */@Overrideprotected void handleNotificationEvent(Notification notification) { super.handleNotificationEvent(notification); changeFigureColor(primaryShape);}
![Page 29: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/29.jpg)
Coloring nodes – cntd(2)
![Page 30: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/30.jpg)
Testing
Everything in Eclipse is testable The tests may not be straightforward and
time-consuming to set up, but doable To test a Plug-in you need a Plug-in test
project
![Page 31: Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter](https://reader035.vdocument.in/reader035/viewer/2022062518/56649e885503460f94b8c105/html5/thumbnails/31.jpg)
Summary
This project spans multiple areas• Modeling
• Graphical development
• Eclipse development / Plug-in development
Which means that there is a lot of documentation to go through