Modeling in the Browser: What DSL Forge gives for free

Tweet about this on TwitterShare on FacebookBuffer this pageShare on RedditShare on LinkedInShare on Google+Email this to someone

Moving modeling tools to the cloud is not just a shift of a desktop RCP (Rich Client Platform) application to the browser. The web opens up new possibilities to make the modeling experience more collaborative by letting users from different locations share the same resources and processes, simplify application deployment (no installation needed), and provide easy access to models regardless of the users devices.

Cloud IDEs will incorporate modeling technologies

It seems that cloud IDEs are slowly but surely gaining ground in the open-source community. Just a couple of weeks ago, Codenvy made the show at the EclipseCon North America, demonstrating how easy it is to set up cloud IDEs using Eclipse Che. The emergence of dozens of IDEs in the cloud, like Codenvy, Nitrous, or Cloud9, just to name a few, is showing that there are practical use cases for which such tools are used. As to modeling in the browser, just like today’s majority of modeling tools are based on desktop IDEs (except some online graphical modelers), the next wave of modeling tools will probably be based on cloud IDEs. Indeed, cloud IDEs and cloud MDE (Model-Driven Engineering) tools are fighting the same battle, but for now cloud IDEs seem to be on the front line; if they are actually adopted, modeling tools would follow.

DSL Forge makes it easy to create web-based text editors

The DSL Forge  open source project, led by PlugBee, provides a technology to develop textual domain-specific language (DSL) editors for web applications and cloud IDEs. Given language grammars in ANTLR or Xtext, the framework allows to generate web-based textual editors targeting various web application architectures. The generated editors come with a set of features bound by default, including: syntax highlighting and validation, content assist, semantic validation, template proposals, theming, text hover, key bindings, undo/redo, and code folding.

The framework has evolved since the initial prototype presented at MoDELS 2014 , and currently proposes an advanced integration with two Eclipse technologies: the Remote Application Platform (RAP) and the Web Tools Platform (WTP). Relying on Eclipse RAP makes it possible to integrate the editors into online platforms, letting users create and edit models, launch tool chains, including model transformations and code generation, do live validation, and launch executions or simulations on the server. A text editor demo  example is publicly available; it gives an idea of what you can do with the framework.

Web-based text editor created by DSL Forge

Web-based text editor created by DSL Forge

Supported Web Architectures

Currently two web architectures are covered: static web applications running mainly in the client browser, written in HTML, CSS and JavaScript, and application servlets written in Java and based on the Eclipse RAP technology. RAP provides a powerful widget toolkit and integrates well with proven technologies such as OSGi and JEE. It has the advantage of making the transition to web technologies more smooth (interoperability between Java and JavaScript); a big part of legacy RCP applications can be migrated as-is without considerable effort. Detailed instructions and examples for both target architectures are provided in the documentation.

Generate the Editor

The tooling contains variants of ANTLR and Xtext project generators, and a RAP target platform aggregating Equinox, EMF, Xtext, and Gemini JPA. Two generators are currently provided:

  1. The ACE Generator produces a text editor with JavaScript parsers and lexers from ANTLR v3. You get an ACE editor tailored for the language definition which runs entirely on the client.
  2. The RAP Generator produces a plugin to be packaged with the original Xtext language plugin into an Eclipse workbench application enabling precise interaction between the client and the server. You get a RAP editor with advanced client server interaction model based on our styled text widget. Some examples of the widget specialized for various languages are provided in the live demo.
DSL Forge Editor Generators

DSL Forge Tooling Generators

Run the Editor

The runtime provides services such as Xtext and EMF runtime features, but also enhanced workspace management support, based on a coupling of a file system and a database. Files are persisted as such in the server, while the workspace metadata is persisted in an embedded database. This approach is preferred to total database storage approaches (like in CDO or EMFStore) because parser-based textual models, as they are rebuilt totally for every single change, do not preserve model elements identifiers.

Package and Deploy

A Maven Tycho build is provided as an example illustrating how to package automatically the editors into web application archives (war). For JEE environments, we have successfully deployed workbench applications in production environments, using the Equinox servlet bridge  component. The bridge component, being automatically packaged in the web application archive, makes it possible to embed the generated war into any servlet container, including Tomcat and Jetty.

How it Works

When it comes to online textual editing, the amount of interaction between the client and the server is high. Think of all the computation needed at each user interaction with the editor: parsing, highlighting, validation, content assist, etc. Moreover, the amount of server-side computation grows with the number of simultaneous users, which means the more you delegate computation to the client, the better the application scales. For this reason, we generate a default configuration and let the developer customize the generated code using the RAP lifecycle API, and the provided classes (editors, workspace, wizards, etc.). For more details, explore our repository on GitHub.

Having an Xtext grammar as input, the generators extract the rules to generate an ANTLR grammar, and trigger an embedded parser generator to derive JavaScript lexer and parser. This way, the JavaScript parser can be enabled on the client, independently from the Java parser generated by Xtext. You can even enable both parsers at the same time, for different purposes (building the syntax tree, computing content assist proposals). Alternatively, if you choose to generate a static web project, the editor you get runs fully on the client, as it is a full-featured ACE editor customized for the extracted ANTLR grammar.

Generation process

Generation process

Roadmap

DSL Forge is an open source technology available under the Eclipse Public license (EPL) so contributions are welcome. Currently feature enhancements on the client side are planned before the end of the second quarter. Other enhancements on the Tooling, including the ANTLR editor and the incremental project builder are also planned. The styled text widget, on top of which the DSL Forge RAP editors are built, will be soon migrated to the RAP Incubator  Project. We  also provide professional support for customers who want similar environments on their private information system or the World Wide Web.

Tweet about this on TwitterShare on FacebookBuffer this pageShare on RedditShare on LinkedInShare on Google+Email this to someone
Comments
  1. Jabier

Reply

Your email address will not be published. Required fields are marked *