1 56 57 package org.objectstyle.cayenne.modeler.action; 58 59 import java.awt.event.ActionEvent ; 60 61 import org.objectstyle.cayenne.map.Attribute; 62 import org.objectstyle.cayenne.modeler.Application; 63 import org.objectstyle.cayenne.project.ProjectPath; 64 65 70 public class RemoveAttributeAction extends RemoveAction { 71 private final static String ACTION_NAME = "Remove Attribute"; 72 73 public static String getActionName() { 74 return ACTION_NAME; 75 } 76 77 public RemoveAttributeAction(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 89 Object lastObject = path.getObject(); 90 91 return lastObject instanceof Attribute; 92 } 93 94 public void performAction(ActionEvent e) { 95 if (getProjectController().getCurrentObjAttribute() != null) { 96 removeObjAttribute(); 97 } 98 else if (getProjectController().getCurrentDbAttribute() != null) { 99 removeDbAttribute(); 100 } 101 } 102 } 103 | Popular Tags |