JanKoehnlein / FXDiagram

JavaFX diagram
Apache License 2.0
74 stars 21 forks source link

Using mapping API in my own Xtext DSL #52

Closed AjitDingankar closed 8 years ago

AjitDingankar commented 8 years ago

I'm just starting out with Xtext and wanted to try out FXDiagram for graphical view of a textual DSL that I'm developing as a learning exercise. I tried to look for a complete working example of the code snippets on http://jankoehnlein.github.io/FXDiagram/hla.html and browsed the sources and plugin.xml files in the Xtext generated projects to no avail. I couldn't find (with ctntl-H) any references to Diagram in my Eclipse Neon workspace either!

I'm puzzled because I can use the FXDiagram view for the compartments example of statemachine in an EclipseApplication.

Thanks,

Ajit

JanKoehnlein commented 8 years ago

The examples for the statemachine and domain-model DSLs shipped with FXDiagram use so called fragments which add to the classpath of an existing plug-in and provide their extensions in a file called fragment.xml. This is to avoid changing the Xtext examples on every release. The fragments just keep decorating the respective plug-ins with the current version number. For the statemachine example, you find the registration in this fragment.xml.

AjitDingankar commented 8 years ago

Thanks, Jan! Sorry about another stupid question, but does this mean that I can just add a similar fragment.xml in my DSL's top level directory to get the FXDiagram functionality (with the proper DiagramConfig class)? I can't try it now because I'm having an issue with a couple of imports from xbase.

JanKoehnlein commented 8 years ago

A fragment in Eclipse is more a plug-in project than a file. The normal user - I guess that includes you - will implement the diagram config to and add the extension in the UI-plug-in of the DSL.