Example: Implement a GMF editor with image nodes using EuGENia


  • friends.emf
  • PersonFigure.java
  • Get it!
@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);
  }

}

There are two ways to get the code of this example:

  1. download the following zip archive(s), extract them and import them as new Eclipse projects
  2. or 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