theia-ide / sprotty

A next-gen web-based graphics framework
Apache License 2.0
138 stars 23 forks source link

SModel <-> EMF binding? #130

Closed erdalkaraca closed 7 years ago

erdalkaraca commented 7 years ago

It does not seem very complicated to map custom EMF models to SModel and vice-versa, But do you have a proposal/best-practice for this task?

Thanks.

JanKoehnlein commented 7 years ago

Currently not.

Using Xtend might help, as you can use the active annotations to quickly create Java beans for the JSON types. See https://github.com/TypeFox/sprotty/blob/master/server/xtext-diagram-examples/io.typefox.sprotty.example.multicore.web/src/main/java/io/typefox/sprotty/example/multicore/web/diagram/FlowModel.xtend

For an example mapping, have a look at https://github.com/TypeFox/sprotty/blob/master/server/xtext-diagram-examples/io.typefox.sprotty.example.multicore.web/src/main/java/io/typefox/sprotty/example/multicore/web/diagram/MulticoreAllocationDiagramGenerator.xtend