Single sourcing for databases management with RAP, EMF and Teneo

In the previous article Single sourcing with Eclipse RAP we have seen how to develop an Eclipse project and then run it both as a Desktop (RCP) Application an as a Web (RAP) Application.

Now we will see how to go further and develop a database Application with the same dual approach. We will use EMF and Teneo for this, in the same way showed in the series of tutorials “From Model to Persistence” at page EMF Development.

In the following instructions we must make a clear distinction between installing some feature into the IDE or into the Target Platform (RAP in our case). Installing into IDE is performed going to menu Help -> Install New Software, while installing on the Target Platform is made with Window -> Preferences -> Plug-in Development -> Target Platform (see article Single sourcing with Eclipse RAP).

Let’s first start installing on our IDE all needed tools:

Update site: Indigo (included) –
Category: Modeling
Feature: EMF – Eclipse Modeling Framework SDK

Update site: Indigo (included) –
Category: General Purpose Tools
Feature: All SWT Designer features except SWT Designer XWT Support (requires Eclipse WTP/WST) and all WindowBuilder features except WindowBuilder XML Core

Update site: Elver (to be added) –
Category: Teneo/Texo Dependencies
Feature: All

Update site: Teneo 1.2.0 (to be added) –
: EMF Teneo – Hibernate
Feature: All

Now let’s add on the RAP Target Platform the following (please consider that we already installed Rich Ajax Platform (RAP) Target Components and EMF RAP Target Components in previous tutorial):

Software site: Elver (to be added) –
: Teneo/Texo Dependencies
Feature: All

Software site: Teneo 1.2.0 (to be added) –
: EMF Teneo – Hibernate
Feature: All

Ok now we are ready for the single sourcing development phase. For the model we can just Import the model plug-in we made in the tutorial Eclipse EMF: updating the Model. While we can modify our current RCP/RAP application (it.rcpvision.rcprap.application) in the following way.

In the Activator let’s connect to the database and load data (there is a populating section just for the very first time, when the database is just created)


now rewrite the View like this (as you have learnt in other our tutorials, here we put a TableViewer and bind the content of the loaded EMF resource)




you also need the following dependencies in MANIFEST.MF



as you see we put other Optional dependencies on both org.eclipse.jface.databinding and org.eclipse.rap.jface.databinding.

If you now run this same source code from the RCP workspace you will see this


while from the RAP workspace you’ll see the following (Note: in both cases you may have to check that the launch has all needed plug-ins/bundles; see “Plug-ins” tab, “Add Required Plug-ins” button in case of RCP and tab “Bundles“, “Add Required Bundles” button in case of RAP)


not bad, don’t you think?


Back to index




2012-08-15T16:06:27+00:00 By |

Leave A Comment