Skip to main content
Jump to: navigation, search

Difference between revisions of "Wire EMF Databinding RCP"

(Create an EMF-Project)
(Create the Ecore-Model)
Line 90: Line 90:
 
<li>Editing the properties in the property view<br />
 
<li>Editing the properties in the property view<br />
 
[[Image:EMF_RCP_EMF8.png]]</li>
 
[[Image:EMF_RCP_EMF8.png]]</li>
 
 
</ol>
 
</ol>
 +
Now we have to add our Domain-Objects <font family="Courier">Person</font> and Address to the Ecore-Model.
 
[[Category:EMF]] [[Category:RCP]]
 
[[Category:EMF]] [[Category:RCP]]

Revision as of 01:50, 11 July 2007

THIS IS AN ARTICLE WORK IN PROGRESS (Bug 195163)

Abstract/Requirements Definition

I'm trying to implement a fairly simple address book application on top of RCP using frameworks provided by Eclipse in 3.3. There's also focus on how to structure and design an RCP to be as extensible and as flexible as possible, including theming, internationalization, datastorage independency, ... .

Setup the Toolchain

  1. Eclipse 3.3 for RCP-Developers (available from http://www.eclipse.org/downloads)
  2. EMF using the Update-Manager (Help>Software Updates>Find and Install)
  3. Derby-Plugins (available from http://db.apache.org/derby/derby_downloads.html)
    To install:
    1. Stop your eclipse (if running)
    2. Unzip „derby.zip“s (as of this writing derby_core_plugin_10.2.2.485682.zip and derby_ui_plugin_1.1.0.zip) into your %ECLIPSE_HOME/plugin directory
    3. Start up eclipse
  4. iBatis (available from http://ibatis.apache.org)
  5. Fetch application icons (e.g. available from http://websvn.kde.org/trunk/KDE/kdelibs/pics/oxygen/ using your favorite SVN-Client)
  6. (Optional) Visual-Database Design
    1. Install Clay for Eclipse (available from http://www.azzurri.jp/en/software/clay/)
    2. Download Clay-Utils used for creation of DDL and documentation (available from http://publicsvn.bestsolution.at/repos/java/clayUtils/release/at.bestsolution.clayutils-nodeps-0.0.7.jar)
    3. DDL-Utils to create database DDL for any database you want (available from http://db.apache.org/ddlutils)
  7. (Optional) Subclipse for Version-Control (available from http://subclipse.tigris.org)

Application Design

Plugin-Design

at.bestsolution.addressbook

The main RCP-Application

at.bestsolution.addressbook.ui

This plugin provides the UI bits (ViewPart, ...) for the addressbook application.

at.bestsolution.addressbook.ui.theme

This plugin addresses the themeability of the application by providing a plugable theme-API. It will by default provide a standard theme.

at.bestsolution.addressbook.core

This plugin provides the none GUI bits for the application like Command-Definitions, handlers, ...

at.bestsolution.addressbook.core.model

This plugin provides the model implementation created using EMF

at.bestsolution.addressbook.core.datasource

This plugin will provide the API to provide plugable datasources in our case

at.bestsolution.addressbook.core.datasource.xmi

This plugin provides a datasource implementation on top of XMI (directly supported by EMF)

at.bestsolution.addressbook.core.datasource.iBatis

This plugin provides a datasource implementation on top of iBatis

Plugin Overview

EMF RCP PluginOverview.png

Domain Model

The domain model is fairly simple and can be represented by 2 classes as shown in the diagram below. The only interesting thing is that there's a bidirectional relationship between Person(Attribute: primaryAddress) and Address(Attribute: person).

EMF RCP Domain.png

Hands on practice or „Let's begin our journey“

Implementing at.bestsolution.addressbook.core.model

Create an EMF-Project

  1. Open the "New Project Wizard"
  2. Select Eclipse Modeling Framework
    EMF RCP EMF1.png
  3. Name the project "at.bestsolution.addressbook.core.model"
    EMF RCP EMF2.png
  4. The resulting workspace looks like this
    EMF RCP EMF3.png

Create the Ecore-Model

  1. Select Example EMF Model Creation Wizards > Ecore Model
    EMF RCP EMF4.png
  2. Name the model "addressbook.ecore"
    EMF RCP EMF5.png
  3. Open the Properties-View (Window > Show View > Others ...)
    EMF RCP EMF6.png
  4. Select the root node currently shown in the editor as null
    EMF RCP EMF7.png
  5. Editing the properties in the property view
    EMF RCP EMF8.png

Now we have to add our Domain-Objects Person and Address to the Ecore-Model.

Back to the top