1 56 57 package org.objectstyle.cayenne.modeler.action; 58 59 import java.awt.event.ActionEvent ; 60 61 import org.objectstyle.cayenne.map.Relationship; 62 import org.objectstyle.cayenne.modeler.Application; 63 import org.objectstyle.cayenne.project.ProjectPath; 64 65 70 public class RemoveRelationshipAction extends RemoveAction { 71 private final static String ACTION_NAME = "Remove Relationship"; 72 73 public static String getActionName() { 74 return ACTION_NAME; 75 } 76 77 public RemoveRelationshipAction(Application application) { 78 super(ACTION_NAME, application); 79 } 80 81 84 public boolean enableForPath(ProjectPath path) { 85 if (path == null) { 86 return false; 87 } 88 Object lastObject = path.getObject(); 89 90 return lastObject instanceof Relationship; 91 } 92 93 public void performAction(ActionEvent e) { 94 if (getProjectController().getCurrentObjRelationship() != null) { 95 removeObjRelationship(); 96 } 97 else if (getProjectController().getCurrentDbRelationship() != null) { 98 removeDbRelationship(); 99 } 100 } 101 } 102 | Popular Tags |