1 18 19 package org.objectweb.jac.ide.diagrams; 20 21 import CH.ifa.draw.framework.DrawingEditor; 22 import org.objectweb.jac.aspects.gui.DisplayContext; 23 import org.objectweb.jac.core.rtti.ClassRepository; 24 import org.objectweb.jac.ide.Diagram; 25 import org.objectweb.jac.ide.Instance; 26 import CH.ifa.draw.framework.Figure; 27 28 public class InstanceFigureCreationTool extends CreationTool { 29 30 DisplayContext context; 31 32 public InstanceFigureCreationTool(DrawingEditor newDrawingEditor, 33 DisplayContext context) { 34 super(newDrawingEditor); 35 this.context = context; 36 } 37 38 public void chooseInstance(org.objectweb.jac.ide.Instance clazz) {} 39 40 protected Figure createFigure() { 41 Object [] parameters = new Object [] {null}; 42 boolean result = context.getDisplay().showInput( 43 this,ClassRepository.get().getClass(getClass()).getMethod("chooseInstance"), 44 parameters); 45 InstanceFigure cf = null; 46 if( result ) { 47 cf = new InstanceFigure(); 48 if( parameters[0] != null ) { 49 cf.setSubstance((Instance)parameters[0]); 50 cf.setContainerPackage(((Diagram)((DiagramView)editor()).getSubstance()).getContainer()); 51 52 cf.initInstance(); 53 } 54 } 55 editor().toolDone(); 56 return cf; 57 } 58 } 59 | Popular Tags |