Posts Tagged ‘ Eclipse ’

Generate graphical Visualizations for textual DSLs

The advantage of using a textual notation for models is that no special editors are required to create and edit these models. Furthermore, the models can also be diffed and merged using standard tools. Such textual notations are particularly suitable for expert tools. Graphical notation, on the other hand, illustrate complex relations and are often easier to understand. The combination of both notations makes optimum use of their particular benefits.

In this post I will demonstrate how we can achieve this goal by enhancing the textual Xtext editors with graphical visualizations. The visualization will be shown in a view within the Eclipse IDE. Thus, we will use the SWT-based Zest toolkit for rendering.

Continue reading

Add Deprecated Annotations and Task Tags to your DSL

Some programming languages allow to discourage the usage of program element. For this purpose, Java provides the annotation @deprecated. It can be added to classes, fields and methods to express that the element should not be used any longer. There are many possible reasons, e.g., the element is unsafe or it has been superseded and may cease to exist in the future. When a deprecated element is used the compilers shows a warning. The Eclipse IDE marks all calls to deprecated methods and accesses to deprecated classes or fields.

Java developers using Eclipse JDT are probably also familiar to the task tags //XXX, //TODO and //FIXME. They offer a convenient way to mark positions in the source code that should be remembered for later reviews or adaptions. Eclipse lists all task tags found in the source code in a special view. By double clicking the entry in this view the IDE jumps to the corresponding position in the source code.

Both, the task tags and the deprecated-annotation are useful tools when creating Java programs in Eclipse. When working with large scale textual models, they can be beneficial, too. Xtext, however, does not provide such a feature out of the box. Though, it can be built with little effort by means of its validation framework.

This post describes how this can be done in such a way that it can be attached to different model elements with little effort.
Continue reading