KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mc4j > console > connection > DeleteConnectionAction


1 /*
2  * Copyright 2002-2004 Greg Hinkle
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.mc4j.console.connection;
18
19 import org.openide.nodes.Node;
20 import org.openide.util.HelpCtx;
21 import org.openide.util.actions.NodeAction;
22
23 /**
24  * <p>Deletes a connection from the connection set.</p>
25  *
26  * @author Greg Hinkle (ghinkle@users.sourceforge.net), September 2002
27  * @version $Revision: 480 $($Author: ghinkl $ / $Date: 2004-10-05 01:17:41 -0400 (Tue, 05 Oct 2004) $)
28  */

29 public class DeleteConnectionAction extends NodeAction {
30
31     protected void performAction(Node[] nodes) {
32         ConnectionNode node = (ConnectionNode)nodes[0];
33         
34         node.deleteConnection();
35     }
36
37     protected boolean enable(Node[] nodes) {
38         // e.g.:
39
return nodes.length == 1 && nodes[0] instanceof ConnectionNode;
40     }
41
42     public String JavaDoc getName() {
43         return "Delete"; //NbBundle.getMessage(DisconnectAction.class, "LBL_Action");
44
}
45
46     protected String JavaDoc iconResource() {
47         return null;
48     }
49
50     public HelpCtx getHelpCtx() {
51         return HelpCtx.DEFAULT_HELP;
52         // If you will provide context help then use:
53
// return new HelpCtx(DisconnectAction.class);
54
}
55 }
56
Popular Tags