1 19 20 21 package ca.mcgill.sable.graph.editparts; 22 23 import org.eclipse.gef.EditPart; 24 import org.eclipse.gef.EditPartFactory; 25 import ca.mcgill.sable.graph.model.*; 26 27 public class PartFactory implements EditPartFactory { 28 29 public PartFactory() { 30 super(); 31 } 32 33 36 public EditPart createEditPart(EditPart arg0, Object arg1) { 37 EditPart part = null; 38 if (arg1 instanceof Graph){ 39 part = new GraphEditPart(); 40 } 41 else if (arg1 instanceof SimpleNode){ 42 part = new SimpleNodeEditPart(); 43 } 44 else if (arg1 instanceof Edge){ 45 part = new EdgeEditPart(); 46 } 47 else if (arg1 instanceof ComplexNode){ 48 part = new ComplexNodeEditPart(); 49 } 50 51 part.setModel(arg1); 52 return part; 53 } 54 55 } 56 | Popular Tags |