KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > nodes > WS70ResourcesRootNode


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 /*
21  * WS70ResourcesRootNode.java
22  */

23
24 package org.netbeans.modules.j2ee.sun.ws7.nodes;
25 import javax.enterprise.deploy.spi.DeploymentManager JavaDoc;
26 import org.openide.nodes.AbstractNode;
27 import org.openide.nodes.Node;
28 import org.openide.nodes.Children;
29 import org.openide.util.NbBundle;
30 import org.openide.util.Lookup;
31 import org.openide.util.actions.SystemAction;
32
33 import java.util.Collection JavaDoc;
34
35 import org.netbeans.modules.j2ee.sun.ws7.j2ee.ResourceType;
36 import org.netbeans.modules.j2ee.sun.ws7.nodes.actions.RefreshResourcesAction;
37
38 /**
39  *
40  * @author Mukesh Garg
41  */

42 public class WS70ResourcesRootNode extends AbstractNode implements Node.Cookie{
43     
44     /**
45      * Creates a new instance of WS70ResourcesRootNode
46      */

47     public WS70ResourcesRootNode(Lookup lookup, ResourceType resType) {
48         super(new WS70ResourceChildren(lookup, resType));
49         getCookieSet().add(this);
50         if(resType.eqauls(resType.JDBC)){
51             setDisplayName(NbBundle.getMessage(WS70ResourcesRootNode.class, "LBL_JDBC_RESOURCE"));
52             setIconBaseWithExtension("org/netbeans/modules/j2ee/sun/ws7/resources/JdbcResIcon.gif");
53             
54         }else if(resType.eqauls(resType.JNDI)){
55             setDisplayName(NbBundle.getMessage(WS70ResourcesRootNode.class, "LBL_JNDI_RESOURCE"));
56             setIconBaseWithExtension("org/netbeans/modules/j2ee/sun/ws7/resources/JndiResIcon.gif");
57             
58         }else if(resType.eqauls(resType.CUSTOM)){
59             setDisplayName(NbBundle.getMessage(WS70ResourcesRootNode.class, "LBL_CUSTOM_RESOURCE"));
60             setIconBaseWithExtension("org/netbeans/modules/j2ee/sun/ws7/resources/JndiResIcon.gif");
61             
62         }else if(resType.eqauls(resType.MAIL)){
63             setDisplayName(NbBundle.getMessage(WS70ResourcesRootNode.class, "LBL_MAIL_RESOURCE"));
64             setIconBaseWithExtension("org/netbeans/modules/j2ee/sun/ws7/resources/MailResIcon.gif");
65         }
66     }
67
68     public javax.swing.Action JavaDoc[] getActions(boolean context) {
69         return new SystemAction[] {
70             SystemAction.get(RefreshResourcesAction.class)
71         };
72     }
73     
74
75     // Refresh to be called from the RefreshResourcesAction performAction
76

77     public void refresh(){
78         ((WS70ResourceChildren)getChildren()).updateKeys();
79     }
80     
81 }
82
Popular Tags