XText Ecore Model to XText Code - eclipse

The more I figure out how XText works and what it does the more I like it. I'm using it in several areas of my development and have a feature I'd like to build where I want to programmatically construct an ecore model based on the generated Xtext model for my DSL and then reverse engineer that model back into DSL code. I suppose I could build a code generator for doing this unique to each DSL but it would be great if XText had a generic feature allowing me to take an in memory model of my DSL and generate the DSL code like it nicely does from code to ecore model. Can’t find much online and wondering if anyone might be able to help. Thanks! - Duncan Krebs

Please have a look at the chapter on serialization in the reference documentation. It describes exactly what you are looking for.

Related

Model-to-Model-Transformation - no meta model for source

I have to do a model-to-model transformation but the source model is rather obscure but also quite similar to UML activity diagrams (which are also the target by the way).
I've looked into tutorials for Eclipse Modeling Tools but I struggle a lot with it. Also, because there is no meta model for the source, I'm not sure if EMT is any help. What are my options here? Can I use EMT, should I use another tool in this case or should I write a generator myself?
Greetings

Eclipse: Xtext and integration with Epsilon/GMF/Graphiti

I want to create a DSL with graphical support in Eclipse. For the DSL I use Xtext, but cannot find good example on how to integrate the graphical part. I have not decided on one of the technologies to prove a graphical part and are prepared to use any one.
Does anybody now of good examples?
That depends on how you want to design the integration. What should be the main syntax for editing, text or graphics?
Here are some examples integrating Xtext with Graphiti, GMF, and Sirius:
https://github.com/spoenemann/xtext-gef
If you don't need graphical editing, but would like to generate graphical views for your text models, you could consider KIELER (esp. the KLighD component).

Generate full class diagram using GraphViz and Doxygen

I'm currently working on my internship, and for the company's sake I decided to just go ahead on the programming work. For my current internship that seemed to fit better than to create all kinds of diagrams no one gets or uses.
Now I ran into a problem though. 4 weeks of internship and 50 java-classes later my school decided they want to see a class diagram. I've already got doxygen set up with GraphViz to generate partial class diagrams, with the focus on only one of the classes and it's associations. But what I wonder is, is it possible to generate one class diagram containing all relations from all classes? Or am I gonna have to try to convince my school that this way the class diagrams have better readability?
The short answer is that this is not possible. Doxygen parses the code and includes only classes in the diagrams which are in any direct or indirect relationship with the documented class.
A general class diagram containing all classes and their associations is not generated by doxygen.
Play araound with the diagram options of doxygen to see with graphs make sense for you (either using the "doxywizard" [Wizard tab -> Diagrams or Expert tab -> Dot] or as I prefer editing directly the doxyfile).
I don't believe that a class diagram with more than 50 classes makes sense, because this would result in a hard to read diagram which is more confusing than helping. (Generally it might be better to organize your code in packages which you might document using the grouping feature of doxygen. In that case you could use the collaboration diagrams to show more high level relations between the packages.)
Another approach might be using a UML/CASE tool to generate UML diagrams from your code (e.g. Enterprise Architect from Sparx Systems, you could import your code and let the tool generate class diagrams out of it). You could include such generated graphs by exporting that graphs as picures and including that pictures in your doxygen generated documentation using the \image tag.
I hope this helps.

Xtext and GMF integration

First of all, I have seen many links on stackoverflow of integrating XText with GMF.
The most consistent tutorial I've seen so far was: http://www.eclipse.org/forums/index.php/mv/msg/472225/1036564/#msg_1036564
..But not even generate a textual editor in the final step (only GMF editor).
I also saw the documentation, but I can not understand what they suggest in this link: http://www.eclipse.org/Xtext/documentation.html#gmf_integration
So I wonder if anyone knows how to integrate effectively the GMF with Xtext with an existing ecore! Use the XText 2.0.4.
Thank you!
Depending on how fixed you are on using GMF, you may want to look at Graphiti (built on GEF).
Graphiti is an Eclipse-based graphics framework that enables rapid development of state-of-the-art diagram editors for domain models. Graphiti can use EMF-based domain models very easily but can deal with any Java-based objects on the domain side as well.
There is an Eclipse Labs project for creation of Graphiti editors using an XText DSL, called Spray.
This project aims to provide one or more Domain Specific Languages (DSL) to describe Visual DSL Editors against the Graphiti runtime, and provide code generation to create the boilerplate code for realizing the implementation against the Graphiti framework. Potentially the Spray DSL can be used to generate code for other frameworks as well.
You can import your DSL ecore model into Spray, and using references to your DSL's types create a graphical editor with relatively little boilerplate. The presentation at CodeGen 2012 (SprayCodeGeneration2012.pdf on the Google Code link above) highlights some of Spray's features.

UML tool for reverse engineering an eclipse project

I am currently working on a project in Eclipse but the problem is that this project is very big (a lot of codes, classes, packages, etc) and undocumented. Since, the project is written in Java, my idea was to make a reverse enineering of the project to see his architecture in UML. Do you know an eclipse plugin who can complete this task very easily? Thanks for your answer !!
I think MoDisco is what you are looking for ( here for a short intro)
It seems that the question is dealing with Eclipse plugin therefore Modisco and StartUML are not a possible choice because they are either not a graphical class diagram viewwer or an Eclipse plugin.
The tools that I have evaluated and selected are:
Topcased can reverse a project and gives an UML view. The reverse is good even if not recursive. I mean that you can detect only object having their own information such as class, interface, package, method and attributes but you can not detect calls between classes because this require a recursive reverse.
eUML will give you a visual class diagrams and the possibility to navigate but no model only EMF tags inserted inside your own code. I like the visual representation of the class diagram but having EMF tags in my code is too intrusive !!
You can try RSA which is a pretty good reverse having a real UML model but you will also get EMF tag in your code
The best for me and with no doubt is EclipseUML Omondo with no tag in the code and a high quality UML model but it is really too expensive !!
I'd advise StarUML or StavrUML, the unofficial fork. It reverse engineers code compliant with Java versions before 1.6 or something. Yes, the project was abandoned years ago, but the UML editor remains incredibly strong and powerful.
However, I'd avoid using reverse engineering a UML diagram. You'll probably get an unreadable mess out if it. Just get stuck in and make it manually :)
I'm sure you can find a suitable tool for your needs if you check these.