Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter.

Similar presentations


Presentation on theme: "Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter."— Presentation transcript:

1 Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter

2 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

3 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

4 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

5 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

6 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

7 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

8 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)

9 The advantages of EMF Serialization Notification Code generation  Low cost entry for/into modeling

10 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

11 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

12 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

13 GMF Workflow Generator Model (GMFGen) Java code Mapping (GMFMap) Tool Definition (GMFTool) Graphical Definition (GMFGraph) Domain Model (ECore)

14 Example GMF application Drawing palette View <eStructuralFeature eType=”eReference” name=”orders” eReferenceType=”PurchaseOrder”/> … Domain Model

15 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

16 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

17 Challenges EMF Need additional info for our model EMF supports Extended Meta Data and this gets recorded as annotations in the Ecore model

18 Challenges GMF The code that GMF generates must often be adapted A lot of code has to be customized to support our additional information

19 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

20 Modeling and DPL formalism Signatures ~ Modeling languages Signature := collection of predicates Predicate ~ constraints set by modeling languages Diagram Specifications ~ models

21 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

22 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

23 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

24 Arrow decorations - Example

25 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

26 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()

27 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; }

28 Coloring nodes – cntd(1) /** * Need to override this to get the colorchanging bit to work */ @Override protected void handleNotificationEvent(Notification notification) { super.handleNotificationEvent(notification); changeFigureColor(primaryShape); }

29 Coloring nodes – cntd(2)

30 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

31 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


Download ppt "Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter."

Similar presentations


Ads by Google