Example: Implement a GMF editor with image nodes using EuGENia

@namespace(uri="friends", prefix="")
package friends;

@gmf.diagram
class World {
  val Person[*] people;
}

@gmf.node(figure="figures.PersonFigure", 
  label.icon="false", label="name", label.placement="external")
class Person {
  attr String name;
  @gmf.link(width="2", color="0,255,0", source.decoration="arrow", 
    target.decoration="arrow", style="dash")
  ref Person[*] friendOf;
  @gmf.link(width="2", color="255,0,0", source.decoration="arrow", 
    target.decoration="arrow", style="dash")
  ref Person[*] enemyOf;
}
/*******************************************************************************
 * Copyright (c) 2009 The University of York.
 * 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
 * 
 * Contributors:
 *     Dimitrios Kolovos - initial API and implementation
 ******************************************************************************/
package figures;

import org.eclipse.draw2d.ImageFigure;
import org.eclipse.epsilon.eugenia.examples.friends.figures.activator.PluginActivator;

/**
 * @generated
 */
public class PersonFigure extends ImageFigure {

  public PersonFigure() { 
    super(PluginActivator.imageDescriptorFromPlugin(PluginActivator.ID,
        "images/Person.png").createImage(), 0);
  }

}

Check out the code from the SVN:

  • go to the SVN repository
  • navigate to trunk/examples
  • check out the org.eclipse.epsilon.eugenia.examples.friends project
  • check out the org.eclipse.epsilon.eugenia.examples.friends.figures project

What's this?

In this example we use EuGENia to implement a GMF editor with images instead of shapes for nodes.

What are .emf files?

.emf files are Ecore metamodels expressed using the Emfatic textual syntax.

More examples...

Epsilon Object Language
Epsilon Transformation Language
Epsilon Generation Language
Epsilon Validation Language
Epsilon Merging Language
Epsilon Flock
Combining the Epsilon Languages
EuGENia
EUnit

Even more examples...

More examples are available in the examples folder of the SVN repository.