siemens corporate research prec+goals requirements concept implementation results+metrics demo how...

15
Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger [email protected]

Upload: aron-brent-merritt

Post on 12-Jan-2016

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

How to develop an editor for the Eclipse RCP?

Ulrich [email protected]

Page 2: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 2/1904/21/23

Outline

Preconditions + Goal

Requirements

Concept

Implementation/Used Tools + Frameworks

Result + Metrics

( Demo )?

Page 3: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 3/1904/21/23

Preconditions + Goals

• 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 } } } }

}

Page 4: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 4/1904/21/23

Requirements (1/2)

For the first time in history of IT the requirements were precisely specified by the customer:

Basically 2 (!!!) requirements:

1. “Well, some parts of the language may be represented in a tree/hierarchical view…”

2. “… others not.”

3. Should be a nice looking Eclipse RCP editor.

Page 5: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 5/1904/21/23

Requirements (2/2)

1. “Should be a nice looking Eclipse RCP Editor”– gear to Eclipse Forms

style

2. “Some parts represented in a tree”

3. “Others not.”– Property fields

4. Support of original syntax (incl. highlighting, …)

5. Synchronization between two views

NFR

- Interationalizeability

- Extensibility of the editor

Page 6: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 6/1904/21/23

Concept

OIS CL grammar

OIS CL files

describes

OIS CL meta model

OIS xCL files

describes

OIS CL parser code

generate

read

code for meta model

generate

read/write

instantiatetransform

Plain text editor for the original syntax

Auto completion

Syntax highlighting

Tree based editor for models

manipulate

manipulate

synchronize

JET, QVT, …

Page 7: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 7/1904/21/23

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

Page 8: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 8/1904/21/23

Implementation (2/4)

• 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

Page 9: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 9/1904/21/23

Implementation (3/4): Tools

ANTLR Editor

Ecore Editor

FXL Generator Configuration

TL Editor + TL2XSLT Transformation

Eclipse RCP itself for the ‘glue’

Page 10: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 10/1904/21/23

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, …)

• …

Page 11: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 11/1904/21/23

Result

Page 12: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 12/1904/21/23

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
???
Page 13: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 13/1904/21/23

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.

Page 14: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 14/1904/21/23

Demo

• 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

Editor Development

Ulrich Dinger

Page 15: Siemens Corporate Research Prec+Goals Requirements Concept Implementation Results+Metrics Demo How to develop an editor for the Eclipse RCP? Ulrich Dinger

Siemens Corporate Research

Prec+Goals Requirements Concept Implementation Results+Metrics Demo

Ulrich Dinger 15/1904/21/23

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