About Eclipse Modeling Framework
In this and in the following posts I will introduce you to the Eclipse Modeling Framework and it’s capabilities. I will show you how to create Ecore models and generate code, based on those models. More information about Ecore and EMF can be found here and here. There is also a book about EMF available here.
This is a series of posts. Trough this series I will show you how to create all needed inputs and generate the code. I will work on the following example: There will be several .xml files which will contain translations for several languages used by one application to implement its localization. We will create a .xsd file, based on the provided .xml files. From that .xsd file we will create an Ecore model. Then we will write templates in Xpand which will be used to generate C++ code. Don’t worry if you don’t know any of these terms I just mentioned. You will learn about them in the following posts.
The most important thing that we need is Eclipse IDE. If you already have an Eclipse IDE, you should be able to just install the needed packages and work with it. However, my preferred approach is to have a separate IDE for the Modeling. Fortunately, there is a designated version of Eclipse for this goal, which has all needed tools pre-installed. It goes by the name “Eclipse Modeling Tools” and can be downloaded from here. The given version was the latest one when I was writing this post. Please, make sure to check for a newer version. Also, just as a remainder, make sure to download from the correct link since the page contains multiple and one of them is for another version of the IDE:
In this post I will explain how to install the needed packages in your existing Eclipse IDE and how to prepare the Eclipse Modeling Tools if you decide to go with it.
Next, we need several .xml files, which will contain translations. Each .xml file will contain translated strings for a given language. You can make them yourself or download the files, which I have prepared for this series of posts. The download link is at the end of the post. If you are going to make them yourself, make sure they look like the following:
<?xml version="1.0" encoding="utf-8"?> <Translations> <TranslatedString name="app_file">File</TranslatedString> <TranslatedString name="app_new_file">New</TranslatedString> <TranslatedString name="app_open_file">Open File...</TranslatedString> <TranslatedString name="app_close_file">Close</TranslatedString> <TranslatedString name="app_edit">Edit</TranslatedString> <TranslatedString name="app_cut">Cut</TranslatedString> <TranslatedString name="app_copy">Copy</TranslatedString> <TranslatedString name="app_paste">Paste</TranslatedString> <TranslatedString name="app_find">Find</TranslatedString> <TranslatedString name="app_replace">Replace</TranslatedString> <TranslatedString name="app_help">Help</TranslatedString> <TranslatedString name="app_about">About</TranslatedString> </Translations>
Make at least two of these files for different languages. The strings and their names should be the same
The post gives a brief overview of what will be the output of the whole series of posts about Eclipse Modeling Framework. Once the reader gets through the whole series, he/she should be able to make Ecore models and generate code on his/her preferred programming language. Following the given link the user can find the IDE, specifically designed for EMF. In the next post we will see how to setup it. From the link at the end of the post you can download exemplary .xml files, which will be used in the forthcoming posts. Enjoy!
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?
Passionate developer, loving husband and caring father. As an introvert programming is my life. I work as a senior software engineer in a big international company. My hobbies include playing computer games (mostly World of Warcraft), watching TV series and hiking.