1 / 15

How to develop an editor for the Eclipse RCP?

How to develop an editor for the Eclipse RCP?. Ulrich Dinger ulrich.dinger.ext@siemens.com. Outline. Preconditions + Goal Requirements Concept Implementation/Used Tools + Frameworks Result + Metrics ( Demo )?. OIS = Configuration Language for some SBT devices

Download Presentation

How to develop an editor for the Eclipse RCP?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to develop an editor for the Eclipse RCP? Ulrich Dinger ulrich.dinger.ext@siemens.com

  2. Outline Preconditions + Goal Requirements Concept Implementation/Used Tools + Frameworks Result + Metrics ( Demo )? Ulrich Dinger

  3. OIS = Configuration Language for some SBT devices Existing YACC BNF grammar (~6500 LOC) Existing ‘specification’ document (basically the BNF of the grammar) (~10 pages, incl. some mistakes) Goal Port to Java/Eclipse RCP Time frame 3 weeks version 2:2 installation "i1" { point_types { ois_point_type 1 "b" { orders { sis_order 2 "cd" true == true user_group 1 basic { reset_timer "abc" point_name @def } } } } space "1" "2" "3" { points { sis_point_type 1 "ab" { component "component" space "space 1" sis_point_type 1 "2" { @sis = point_name } } } } } Preconditions + Goals Ulrich Dinger

  4. Requirements (1/2) For the first time in history of IT the requirements were precisely specified by the customer: Basically 2 (!!!) requirements: • “Well, some parts of the language may be represented in a tree/hierarchical view…” • “… others not.” • Should be a nice looking Eclipse RCP editor. Ulrich Dinger

  5. “Should be a nice looking Eclipse RCP Editor” gear to Eclipse Forms style “Some parts represented in a tree” “Others not.” Property fields Support of original syntax (incl. highlighting, …) Synchronization between two views NFR Interationalizeability Extensibility of the editor Requirements (2/2) Ulrich Dinger

  6. Concept OIS CL grammar describes Plain text editor for the original syntax Auto completion Syntax highlighting generate OIS CL files manipulate OIS CL parser code read transform JET, QVT, … instantiate synchronize code for meta model read/write manipulate Tree based editor for models OIS xCL files generate OIS CL meta model describes Ulrich Dinger

  7. Implementation (1/4) Model Driven Software Development • Eclipe Modeling Framework [3] • EMF: Ecore Modeling language + Code generation Ecore2Java (load/save models from/to XML/I) • EMF.Edit: Framework for creating editors for EMF models • EMF.Codegen: Model 2 code generator (JET) • Disadvantages • Editors use Eclipse properties view (against one of the requirements) • Problem with large models + packages • adaptability if special problems arise  So I only used the ecore modeling language + another generator + editor framework Ulrich Dinger

  8. Flexible XML based languages (FXL) project [5] Developed at Siemens CT SE 2 since 2003; open source (source forge) Basically an XML generator framework Transformation language (TL) on top of XSLT Pipelining/workflows of transformations Additional package: transformation of Ecore models to Java Code + generation of customizable editors corresponds to EMF code generation + EMF.edit Implementation (2/4) Ulrich Dinger

  9. Implementation (3/4): Tools ANTLR Editor Ecore Editor FXL Generator Configuration TL Editor + TL2XSLT Transformation Eclipse RCP itself for the ‘glue’ Ulrich Dinger

  10. Implementation (4/4): Editor customization Only generic editor generated  customization needed • Internationalization • Via corresponding .i18n file (framework contains editor for that) • Customization • Images -> copy to ‘icons’ directory + provision of LabelProvider class • Tree node texts -> .i18n file + provision of LabelProvider class • special customization interface of the framework allowing • Validation of property values • Specification of custom editors (for properties or complete tree nodes) • Adding of context menu items • Changing layout and used widgets (text fields, …) • … Ulrich Dinger

  11. Result Ulrich Dinger

  12. Metrics Time line (15 days): • Creating meta model via Ecore 3 days • (Re) writing the grammar in ANTLR 7 days • Transformation xCL2CL 1 day • Integration with the Editor framework + adaptation 3 days Code • ois.ecore 42 kB / 138 classes • ois.g (ANTLR) 60 kB / 2300 LOC + ~100 (JUnit) Test cases 1000 LOC • Java classes (partly hand written) 20 / 1785 LOC • Transformation xCL2CL (cov. by JUnit tc) 24 kB / 1200 LOC ( XSLT 57 kB / 1500 LOC ) • Generated code (meta model, …) 4.62 MB / 115k LOC Ulrich Dinger

  13. Open Issues 3 weeks is too short to provide a satisfying product. Still open issues: • Auto completion/syntax highlighting… in text boxes • some custom editors for certain parts of the model • e.g. graphical editors for expressions • Resorting of the tree (now it’s mainly the AST of the language) • … • Horizontal layout of the editor (tree on top, properties on bottom), like in plugin.xml editor (upgrade the framework) • … • Comments are lost during the parsing of the CL files. Ulrich Dinger

  14. how to develop an editor from scratch using Ecore & the FXL framework stuff Requirements: Eclipse 3.2.x (3.1.x should also work) Java 1.4.x or 1.5.x Installed EMF (for standard Ecore editor) FXL Framework FXL Generator plug in Demo Editor Development Ulrich Dinger Ulrich Dinger

  15. References [1] A.Hunt, D.Thomas: The Pragmatic Programmer, Addison-Wesley, 2000 [2] Eclipse – An open development environment http://www.eclipse.org/, 2007 [3] Eclipse Modeling Framework (EMF) http://www.eclipse.org/modeling/emf/?project=emf, 2007 [4] ANTLR Parser Generator http://www.antlr.org/, 2007 [5] Flexible XML based languages (FXL) http://sourceforge.net/projects/fxl-project/, 2007 Ulrich Dinger

More Related