1 19 20 23 24 package org.netbeans.modules.j2ee.sun.ws7.nodes.actions; 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 import org.netbeans.modules.j2ee.sun.ws7.nodes.WS70ResourcesRootNode; 30 import org.netbeans.modules.j2ee.sun.ws7.nodes.WS70ResourceNode; 31 import org.netbeans.modules.j2ee.sun.ws7.nodes.WS70Resource; 32 import org.netbeans.modules.j2ee.sun.ws7.ui.Util; 33 37 public class DeleteResourceAction extends NodeAction{ 38 39 42 public DeleteResourceAction() { 43 } 44 protected void performAction(Node[] nodes){ 45 Node parentNode = nodes[0].getParentNode(); 46 WS70ResourceNode node = (WS70ResourceNode)nodes[0].getCookie(WS70ResourceNode.class); 47 WS70Resource res = (WS70Resource)nodes[0].getCookie(WS70Resource.class); 48 try{ 49 res.deleteResource(); 50 }catch(Exception ex){ 51 Util.showError(ex.getMessage()); 52 return; 53 } 54 WS70ResourcesRootNode resRootNode = (WS70ResourcesRootNode)parentNode.getCookie(WS70ResourcesRootNode.class); 55 if(resRootNode!=null){ 56 resRootNode.refresh(); 57 } 58 } 59 60 protected boolean enable(Node[] nodes){ 61 return nodes.length==1; 62 } 63 64 public String getName(){ 65 return NbBundle.getMessage(DeleteResourceAction.class, "LBL_DeleteResourceAction"); 66 } 67 68 public HelpCtx getHelpCtx(){ 69 return HelpCtx.DEFAULT_HELP; 70 } 71 72 } 73 | Popular Tags |