KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > jaxrpc > actions > RefreshClientsAction


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.websvc.jaxrpc.actions;
21
22
23 import org.openide.NotifyDescriptor;
24 import org.openide.DialogDisplayer;
25 import org.openide.nodes.Node;
26 import org.openide.loaders.DataObject;
27 import org.openide.util.HelpCtx;
28 import org.openide.util.actions.NodeAction;
29
30
31 import org.netbeans.modules.websvc.api.client.WebServicesClientSupport;
32
33 /**
34  *
35  * @author Peter Williams
36  */

37 public class RefreshClientsAction extends NodeAction {
38     
39     protected boolean enable(Node[] activatedNodes) {
40         return true;
41     }
42     
43     public HelpCtx getHelpCtx() {
44         // !PW FIXME use correct help context when known.
45
return HelpCtx.DEFAULT_HELP;
46     }
47     
48     public String JavaDoc getName() {
49         return "Refresh View";
50     }
51     
52     protected void performAction(Node[] activatedNodes) {
53         
54         assert (activatedNodes != null && activatedNodes.length == 1);
55         
56         // Invoked on ClientRootNode to refresh the list of webservice clients
57
// in this project.
58
WebServicesClientSupport clientSupport = null;
59         
60         // Find WebServicesClientSupport from activated node.
61
DataObject dobj = (DataObject) activatedNodes[0].getLookup().lookup(DataObject.class);
62         if(dobj != null) {
63             clientSupport = WebServicesClientSupport.getWebServicesClientSupport(dobj.getPrimaryFile());
64         }
65         
66         if(clientSupport == null) {
67             String JavaDoc mes = "Can't locate web services client support for Node: " + activatedNodes[0];
68             NotifyDescriptor desc = new NotifyDescriptor.Message(mes, NotifyDescriptor.Message.ERROR_MESSAGE);
69             DialogDisplayer.getDefault().notify(desc);
70             return;
71         }
72         
73         String JavaDoc mes = "Not Implemented Yet";
74         NotifyDescriptor desc = new NotifyDescriptor.Message(mes, NotifyDescriptor.Message.ERROR_MESSAGE);
75         DialogDisplayer.getDefault().notify(desc);
76     }
77     
78     protected boolean asynchronous() {
79         return false;
80     }
81 }
82
Popular Tags