1 27 28 package org.nightlabs.editor2d.editpolicy; 29 30 import org.eclipse.gef.commands.Command; 31 import org.eclipse.gef.editpolicies.ComponentEditPolicy; 32 import org.eclipse.gef.requests.GroupRequest; 33 34 import org.nightlabs.editor2d.DrawComponent; 35 import org.nightlabs.editor2d.DrawComponentContainer; 36 import org.nightlabs.editor2d.command.DeleteDrawComponentCommand; 37 38 public class DrawComponentEditPolicy 39 extends ComponentEditPolicy 40 { 41 44 protected Command createDeleteCommand(GroupRequest deleteRequest) 45 { 46 Object parent = getHost().getParent().getModel(); 47 Object child = getHost().getModel(); 48 if (parent instanceof DrawComponentContainer && child instanceof DrawComponent) { 49 return new DeleteDrawComponentCommand((DrawComponentContainer) parent, (DrawComponent) child); 50 } 51 return super.createDeleteCommand(deleteRequest); 52 } 53 } 54 | Popular Tags |