KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbcore > ui > logicalview > ejb > action > GenerateDTOAction


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.action;
21
22
23 import javax.lang.model.element.Element;
24 import org.netbeans.modules.j2ee.ejbcore.api.methodcontroller.EjbMethodController;
25 import org.openide.nodes.Node;
26 import org.openide.util.HelpCtx;
27 import org.openide.util.NbBundle;
28 import org.openide.util.actions.NodeAction;
29
30
31 /** Action sensitive to the node selection that does something useful.
32  * Consider using a cookie action instead if you can define what the
33  * action is applicable to in terms of cookies.
34  * @author blaha
35  */

36 public class GenerateDTOAction extends NodeAction {
37     
38     protected void performAction(Node[] nodes) {
39         //TODO: RETOUCHE
40
// Element mE = getMemberElement(nodes[0]);
41
// DTOHelper dtoHelp = new DTOHelper(mE);
42
// DTOGenerator dtoGen = new DTOGenerator();
43
// try{
44
// dtoGen.generateDTO(dtoHelp, null, false);
45
// }catch(java.io.IOException ex){
46
// ErrorManager.getDefault().notify(ex);
47
// }
48
}
49     
50     protected boolean enable(Node[] nodes) {
51         if (nodes == null || nodes.length < 1) {
52             return false;
53         }
54         EjbMethodController ejbMethodController;
55         Element feature = getMemberElement(nodes[0]);
56         if (feature == null) {
57             return false;
58         }
59         //TODO: RETOUCHE
60
return false;
61 // return nodes.length == 1 &&
62
// isMemberElement(nodes[0]) &&
63
// (ejbMethodController = EjbMethodController.create(feature)) != null &&
64
// ejbMethodController instanceof EntityMethodController &&
65
// ((EntityMethodController) ejbMethodController).isCMP();
66
}
67     
68     public String JavaDoc getName() {
69         return NbBundle.getMessage(GenerateDTOAction.class, "LBL_GenerateDTOAction");
70     }
71     
72     
73     public HelpCtx getHelpCtx() {
74         return HelpCtx.DEFAULT_HELP;
75         // If you will provide context help then use:
76
// return new HelpCtx(GenerateDTOAction.class);
77
}
78     
79     protected boolean asynchronous() {
80         // performAction(Node[]) should run in event thread
81
return false;
82     }
83         
84     private Element getMemberElement(Node node) {
85         //TODO: RETOUCHE element in lookup
86
return null;
87 // return (Feature) node.getLookup().lookup(Feature.class);
88
}
89     
90     private boolean isMemberElement(Node node){
91         return getMemberElement(node) != null;
92     }
93 }
94
Popular Tags