Xtext and GMF integration - eclipse

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.

Related

Adding combined fragments in UML Designer for Eclipse

I'm using the latest version of UML Designer (7.1) for Eclipse. I have to create a Sequence Diagram, but in the palettes there are no combined Fragments. All I have are actors and sync/async messages. In some tutorials I've seen seen palettes with comb. fragments.. But I don't have them. How is it possible?
The combined fragments are not implemented in UML Designer and there is no plan to implement them at the moment.
As UML Designer is based on Eclipse Sirius, it is possible to do it and maybe you saw the same kind of features in another Sirius based modeler.
If you are interested in sponsoring us to implement this feature do not hesitate to comment the existing issue :
https://github.com/ObeoNetwork/UML-Designer/issues/175

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).

XText Ecore Model to XText Code

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.

Difference between IDE and Framework

What is a difference between an IDE and Framework with respect to Java?
Basically :
The IDE is the software you use to develop ; for example, Eclipse is an IDE (code editor, debugger, build tools ... )
The Framework is a set of both libraries and best practices that help you not re-invent the wheel, and provide a set of guidelines on how to develop.
Quoting wikipedia, an IDE :
is a software application that
provides comprehensive facilities to
computer programmers for software
development. An IDE normally consists
of:
a source code editor
a compiler and/or an interpreter
build automation tools
a debugger
While a Framework :
is an abstraction in which common code
providing generic functionality can be
selectively overridden or specialized
by user code, thus providing specific
functionality. Frameworks are a
special case of software libraries in
that they are reusable abstractions of
code wrapped in a well-defined
Application programming interface
(API), yet they contain some key
distinguishing features that separate
them from normal libraries.
An IDE is an application used to write and compile code. A framework is generally a software component that someone else wrote that you can use/integrate into your own project, generally to avoid re-inventing the wheel.
A framework is a tool that is closely attached to the language you are using and usually extends upon or adds the the language features.
An IDE (Integrated Development Environment) provides automation support for the language you use with regards to syntax highlighting of keywords, errors, building projects, cleaning them, intgegration with VCS, etc. and usually provides default support for popular frameworks used for your language.
Java makes use of frameworks like Hibernate, Struts and Spring to extend the language and NetBeans or Intellij IDEA bring support for these tools to your Java project in a structured manor.
As per all answers I can come to a conclusion that Visual Studio is an IDE and .NET is a framework.
And also a framework(list of .dll) can be integrated into an IDE. Mean framework is a part of an IDE.

Editor library used in Eclipse source

I am looking to create an editor and I was wondering if there was a Swing library which Eclipse uses for its main editor. It may be something quite basic, but I am looking for the drop down menus which come when you press full stop. Strings become symbols rather than just text.
Eclipse is rather SWT-based than Swing-based.
As for a custom editor, you could look into an eclipse-GMF-EMF-based editor with XText
Xtext is a framework for development of textual domain specific languages (DSLs).
Just describe your very own DSL using Xtext's simple EBNF grammar language and the generator will create a parser, an AST-meta model (implemented in EMF) as well as a full-featured Eclipse text editor from that.
alt text http://www.eclipse.org/Xtext/images/screenshot-title.png
The Framework integrates with technology from Eclipse Modeling such as EMF, GMF, M2T and parts of EMFT.
Development with Xtext is optimized for short turn-arounds, so that adding new features to an existing DSL is a matter of minutes. Still sophisticated programming languages can be implemented.
Actually I think you want to consider developing an Eclipse RCP application which involves using SWT, JFace and other parts of the Eclipse platform. There are many layers of editor support which are in the Platform Text component, this is what the Eclipse JDT editors are based on. The modelling stuff (GMF, EMF, etc) is probably much more than what you want. The AbstractTextEditor class in org.eclipse.ui.texteditor is a good place to start. RCP gets you a lot of other stuff as far as helping you to manage the objects you are editing, but you don't necessarily need to use this.
There are likely Eclipse corner (on eclipse.org) articles on how to do this, but the specific one escapes me now. I always just look at the code.