itemis world | repository

Default enum literals for Xtext generated EMF models

Dietmar Stoll

Xtext allows to easily build fully-fledged editors for domain specific languages (DSL) which are based on the Eclipse Modeling Framework (EMF). While existing Ecore models may be used, Xtext is also able to infer an Ecore model from the Xtext grammar. For complex Ecore models, it should certainly be considered to manage them independently, e.g. with Xcore. However, a few simple tweaks of grammar rules can influence the automatically generated Ecore model quite remarkably (e.g. the inheritance hierarchy) [...]

Multiple Validators in Xtext

Dietmar Stoll

Early validation of domain specific languages (DSLs) and suggestions on how to fix these errors ('quickfixes') are key for a good end user experience and for avoiding problems in the toolchain, for instance in generators that use DSL models: The more editor validations, the better. This description shows how to improve the maintainability and modularity of validation code for Xtext DSLs by simply splitting them. In the generated [MyDsl]JavaValidator, an annotation referring to other custom validators [...]

Clean Eclipse Preferences Tree with Multiple DSLs

Dietmar Stoll

As it is easy to build new domain specific languages (DSLs) with Xtext for Eclipse, enterprise projects may have multiple languages, which are usually related. Each language comes with its own Eclipse preference page, which are by default mixed with other preference pages. A simple way to keep the Eclipse preferences tree clean is to add a root page which aggregates the preference pages for individual (but possibly related) Xtext languages. This can be done by adding the snippet below to a plugin.xml [...]

Custom Syntax Error Messages with Quick Fix

Dietmar Stoll

Xtext editors for domain specific languages (DSLs) provide many error messages out of the box, such as syntactical errors, duplicate name errors or unresolvable references. For an improved user experience, some technical error messages from the editor (or, more specifically, from the Antlr parser that is used by the editor) may be customized. In many DSLs, identifiers (for DSL concepts like packages, entities and so on) are expected to conform to the regular expression of the terminal rule ID:terminal [...]

Xtext Grammar Visualization

Dietmar Stoll

When developing EBNF-style grammars, e.g. for Xtext, syntax graphs can be a great help. One of the new features in Xtext 2 is the Xtext Syntax Graph which can be selected in the Eclipse menu under Views - Xtext - Xtext Syntax Graph. In case the grammar has ambiguities, users get an error message similar to the following when trying to generate the code for the grammar by running the MWE2 workflow file. Decision can match input such as [...] using multiple alternatives 1,2 If the error isn't obvious, [...]

Quickly formatting DSLs with Xtext

Dietmar Stoll

One typical task of developing new domain specific languages with Xtext is to customize the formatting in order to have a nice text layout. If the majority of grammar keywords should be formatted in the same way and only a few in a specific way, a generic formatter could be used. As an example, for DSLs with many key-value pairs (e.g. domain models), one might want to indent everything between curly braces and start a new line before each keyword. Instead of manually listing the keywords for the [...]

XtendTools 1.0.1 released

feltes

A new release of XtendTools is available! Release 1.0.1 contains some bug fixes and additions suggested in the comments of my blog post about the initial release of XtendTools (see change log for details) and also a complete Javadoc-like API documentation of XtendLib which has been generated using XtendDoc. As usual, comments, suggestions and contributions […]

Migrating from Xtext 0.7.x to Xtext 1.0 in Eclipse Galileo (3.5)

Dietmar Stoll

Are you stuck with Eclipse Galileo in your project but still like to use the new features of Xtext 1.0? Xtext 1.0 works fine not only in the newest Eclipse Helios (3.6), but also in Eclipse Galileo (3.5). Galileo users can also benefit from Xtext 1.0 features. The eclipse plugins can be updated by using the Eclipse update mechanism and adding the Xtext update site http://download.itemis.com/updates/releases/ to the update manager.After the update of the Xtext plugins, developers may refer to the [...]

Xtext Quick Fix Variants

Dietmar Stoll

One of my favorite Eclipse features is the quick fix functionality. When there is an error in your source code, Eclipse may have a quick fix available - it shows up with a bulb symbol on the left editor margin and may offer you several actions to fix it. You can also use the shortcut [Ctrl-1] to activate it. Xtext ships with a quick fix API which makes it easy to provide quick fixes for your own DSL, so you can provide quick fixes for your customized validation errors and warnings, which is really [...]

API Documentation Generator for Xtend

feltes

During some of my last Xtext and/or Xpand based MDSD projects I wrote a lot of extensions and model transformations with Xtend. Unfortunately is it very hard to efficiently reuse extensions, if there was no API documentation at all or the documentation was scattered across a lot of files. I really wished to have something […]