1 8 package com.nightlabs.editor2d.editpolicy; 9 10 import org.eclipse.gef.commands.Command; 11 import org.eclipse.gef.editpolicies.ComponentEditPolicy; 12 import org.eclipse.gef.requests.GroupRequest; 13 14 import com.nightlabs.editor2d.DrawComponent; 15 import com.nightlabs.editor2d.DrawComponentContainer; 16 import com.nightlabs.editor2d.command.DeleteDrawComponentCommand; 17 18 public class DrawComponentEditPolicy 19 extends ComponentEditPolicy 20 { 21 24 protected Command createDeleteCommand(GroupRequest deleteRequest) 25 { 26 Object parent = getHost().getParent().getModel(); 27 Object child = getHost().getModel(); 28 if (parent instanceof DrawComponentContainer && child instanceof DrawComponent) { 32 return new DeleteDrawComponentCommand((DrawComponentContainer) parent, (DrawComponent) child); 33 } 34 return super.createDeleteCommand(deleteRequest); 35 } 36 } | Popular Tags |