1 56 package org.objectstyle.cayenne.modeler.action; 57 58 import java.awt.event.ActionEvent ; 59 60 import org.objectstyle.cayenne.map.DataMap; 61 import org.objectstyle.cayenne.modeler.Application; 62 import org.objectstyle.cayenne.modeler.dialog.classgen.ClassGeneratorController; 63 import org.objectstyle.cayenne.modeler.util.CayenneAction; 64 import org.objectstyle.cayenne.project.ProjectPath; 65 66 69 public class GenerateClassesAction extends CayenneAction { 70 71 public static String getActionName() { 72 return "Generate Classes"; 73 } 74 75 78 public GenerateClassesAction(Application application) { 79 super(getActionName(), application); 80 } 81 82 public String getIconName() { 83 return "icon-gen_java.gif"; 84 } 85 86 89 public void performAction(ActionEvent e) { 90 generateClasses(); 91 } 92 93 protected void generateClasses() { 94 new ClassGeneratorController(getProjectController()).startup(); 95 } 96 97 100 public boolean enableForPath(ProjectPath path) { 101 if (path == null) { 102 return false; 103 } 104 105 return path.firstInstanceOf(DataMap.class) != null; 106 } 107 } | Popular Tags |