/emf-loophole

EMF Loophole helps you implement the generation gap pattern for EMF code generation

Primary LanguageJava

EMF Loophole

Generation Gap Pattern Tooling

EMF Loophole is a tool that hooks into the EMF codegen and helps you implement the generation gap pattern. This pattern is about separating generated code and the handwritten one in two separate classes, the handwritten one inheriting from the generated one.

The Loophole model editor

This project is based on the ideas described in a blog post by Heiko Behrens (http://heikobehrens.net/2009/04/23/generation-gap-pattern/) and a basic implementation in MWE 2 (http://download.eclipse.org/modeling/emft/mwe/javadoc/2.3/org/eclipse/emf/mwe2/ecore/EcoreGenerator.html)

Installation

EMF Loophole is released in several versions, one for each EMF version. The following Eclipse p2 repository (update-site) in your update manager (in Eclipse, Help Menu > Install New Software..., Add... button on the top right corner) provides all releases for all versions:

http://mbarbero.github.io/emf-loophole/

The releases for each EMF version can be a accessed with the following URLs:

Then, select the “EMF Loophole” feature suitable for you and click on Finish.

Requirements

  • Java SE 5
  • Eclipse 3.5+ (Galileo)

Basic usage

  • File > New > Eclipse Modeling Framework > Loophole Generator model
  • Click Next, then select the Generator model (.genmodel) file you want to reference (if a genmodel file was selected before launching the wizard, it has already been set to this one)
  • Click Finish

GenGapModel Options

Model

  • customClassNamePattern Pattern for deriving custom implementation and item provider names from model element names (“{0}CustomImpl” by default)
  • generateCustomClasses Whether all custom implementation classes should be generated
  • customModelDirectory The target directory for custom model code
  • cleanModelDirectory Whether the source folder containing generated model classes should be cleaned

Edit

  • generateCustomProviders Whether all custom item providers should be generated
  • customEditDirectory The target directory for custom edit code
  • cleanEditDirectory Whether the source folder containing generated item provider should be cleaned

GenGapPackage Options

Model

  • customClassPackageSuffix The suffix of the package for custom model class

Edit

  • customProviderPackageSuffix The suffix of the package for custom item providers

Limitations

It is not possible to reference a Loophole Generator (.gengapmodel) model from another one. Then it is not possible to create customized Ecore models that reference each others.

Build

Go to org.eclipselabs.emf.loophole-parent and do a mvn clean package.

Contribute

Clone this repository, import all projects in your Eclipse and set your target platform to the one in org.eclipselabs.emf.loophole-parent/targetPlatforms.

License

Copyright © 2013 Obeo. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html