Integration of Xtext and GMF Editors 15Ptin Eclipse
Total Page:16
File Type:pdf, Size:1020Kb
Eindhoven University of Technology MASTER Integration of Xtext and GMF editors in Eclipse Dudojevic, E. Award date: 2014 Link to publication Disclaimer This document contains a student thesis (bachelor's or master's), as authored by a student at Eindhoven University of Technology. Student theses are made available in the TU/e repository upon obtaining the required degree. The grade received is not published on the document as presented in the repository. The required complexity or quality of research of student theses may vary by program, and the required minimum study period may vary in duration. General rights Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain Technical University Eindhoven Master Thesis Integration of Xtext and GMF editors in Eclipse Supervisors: Author: prof. dr. Mark van den Brand Edin Dudojevi´c dr. ir. Arjan Mooij Software Engineering and Technology Department of Computer Science June 2014 Abstract Modern Integrated Development Environments (IDEs) provide interactive textual ed- itors and often also offer graphical editors for additional visualization. Eclipse is a platform for developing IDEs, frameworks and other plug-in based applications. The Eclipse Modeling Framework (EMF) is one such framework that enables us to build textual, graphical and other editors on a structured data model. Multiple EMF based frameworks have been developed that offer textual and graphical model editors. How- ever, these frameworks often only operate in isolation, and at best provide a partial integrated solution. Furthermore, textual frameworks can be used mainly to operate on full models. The main problem is that as models tend to get large a user quickly loses overview, which raises the question on how we can isolate certain parts of a model, edit these parts and do this from multiple active editors. In this work we investigate specifically the EMF based frameworks Xtext and GMF, used respectively for developing textual and graphical editors. For both frameworks we propose several approaches on how to apply and orchestrate partial model editing with an overall synchronization of multiple editors. We provide the relevant integration code and demonstrate the proposed solutions with a couple of implementations. Acknowledgements First of all, I would like to to thank my supervisors Mark van den Brand and Arjan Mooij, which devoted a large amount of time to steer this project into the right direction. Their feedback and insightful criticisms have been very helpful and aided the succesful completion of this project. Big thanks also goes to Luo Yaping (Luna) for her overall help and useful discussions at times I faced challenging problems. Finally, a special thanks goes to my beloved fiance Ajka, but also my mother Emina and my brother Ermin who all supported me throughout my entire study, and especially during this project. iii This thesis is dedicated to my father, NedˇzadDudojevi´c. iv Contents Abstract ii Acknowledgements iii Contents v List of Figures ix Contents xi Abbreviations xiii 1 Introduction1 1.1 Context.....................................1 1.2 Project background...............................1 1.3 Problem domain................................2 1.3.1 Problem overview and goal restrictions................2 1.3.2 Problem statement...........................5 1.4 Summary and approach............................5 2 Integration requirements7 2.1 POOSL language................................7 2.1.1 POOSL Definition...........................7 2.1.2 Relation to SHESim..........................8 2.2 POOSL use cases................................9 2.2.1 Creating instantiations and editing existing cluster classes..... 10 2.2.2 Instantiating clusters.......................... 11 2.2.3 Renaming a process class and its ports................ 13 2.2.4 Error propagation........................... 14 2.3 Integration requirements............................ 15 2.4 Conclusions................................... 16 3 State of the art 17 3.1 Survey of EMF-based technologies...................... 17 3.1.1 The Eclipse Project.......................... 17 3.1.2 Eclipse Modeling Framework (EMF)................. 18 v Contents vi 3.1.3 Textual modeling frameworks..................... 19 3.1.4 Graphical modeling frameworks.................... 20 3.1.5 Evaluation............................... 23 3.2 Existing integration.............................. 24 3.2.1 Propagation of changes........................ 25 3.2.2 GMF model referencing........................ 26 3.2.3 Summary and evaluation....................... 28 3.3 Conclusions................................... 29 4 Towards partial model editors 31 4.1 Introduction................................... 31 4.2 Partial model Xtext editors.......................... 32 4.2.1 The highlight range approach..................... 32 4.2.1.1 Synchronization of regular changes............. 33 4.2.1.2 Eclipse editor operations.................. 36 4.2.1.3 Renaming elements..................... 36 4.2.1.4 Sub-grammar restrictions.................. 37 4.2.1.5 Evaluation of advantages and disadvantages....... 38 4.2.2 Dedicated partial model Xtext editors................ 40 4.3 GMF partial editors.............................. 41 4.4 Embedded partial editors........................... 41 4.4.1 Possible combinations of embedded editors............. 41 4.4.2 Viewing and editing textual partial models as labels........ 42 4.4.3 Viewing and editing labels with syntax highlighting........ 45 4.5 Evaluation.................................... 46 4.6 Conclusion................................... 46 5 Architectural patterns 47 5.1 Introduction................................... 47 5.2 Navigational structures............................ 48 5.3 Multi-editor architectures........................... 50 5.4 Conclusions................................... 54 6 Implementation 55 6.1 Introduction................................... 55 6.2 Greetings.................................... 56 6.2.1 Generating implementation code................... 56 6.2.2 Customization............................. 56 6.2.3 Result.................................. 57 6.3 State machines................................. 57 6.3.1 Generating implementation code................... 57 6.3.2 Customization............................. 58 6.3.3 Result.................................. 59 6.4 Web application................................ 59 6.4.1 Generating implementation code and customization........ 60 6.4.2 Result.................................. 60 6.5 POOSL..................................... 61 Contents vii 6.5.1 Generating implementation code................... 61 6.5.2 Result.................................. 61 6.6 Evaluation.................................... 63 7 Related work 65 7.1 Related technologies.............................. 65 7.1.1 Sirius.................................. 65 7.1.2 Meta Programming System (MPS).................. 66 7.1.3 Yakindu Statechart Tools....................... 66 7.1.4 BPEL Designer............................. 68 7.2 Related research................................ 68 8 Conclusions 73 8.1 Results...................................... 73 8.2 Further discussion on co-evolution...................... 74 8.3 Future work................................... 75 A Xtext grammars and model definitions 77 A.1 Greetings Xtext grammar........................... 77 A.2 Statemachines Xtext grammar........................ 77 A.3 Web application Ecore definition....................... 78 A.4 POOSL high-level meta-model........................ 80 B Integration code 81 B.1 Activator.java.................................. 81 B.2 EditPolicyProvider.java............................ 82 B.3 OpenEditPolicy.java.............................. 83 B.4 XtextNewTabEditor.java............................ 84 B.5 plugin.xml extension point........................... 87 C Tutorials 89 C.1 Creating an Xtext editor............................ 89 C.2 Creating a GMF editor............................. 90 C.3 Integrating YST plugins............................ 92 Bibliography 95 List of Figures 1.1 An example Eclipse instance using multiple editors.............3 2.1 SHESim interface, showing a high-level overview of a network layer model8 2.2 SHESim: Class editing window for DataLinkSender3 ............9 2.3 SHESim: Instantiation parameter editing window for DataLinkSender3 .9 2.4 Selecting the process definition SomeProcessClass from the property view 10 2.5 Connecting the ports with channel c ..................... 10 2.6 Choosing the class definition of a process from the right-click menu.... 10 2.7 Showing the class definition in a textual editor............... 11 2.8 Showing the instantiation parameters in a textual editor.......... 11 2.9 Adding extra port q .............................. 11 2.10 Creating a new cluster cluster1 ....................... 12 2.11 The textual representation of cluster1 ................... 12 2.12 Adding and connecting cluster ports s and r ................ 12 2.13 Connecting the two processes to previously created cluster......... 13 2.14 Renaming a process