1 19 20 28 29 package org.netbeans.modules.xml.schema.refactoring.query.actions; 30 31 import java.io.IOException ; 32 import org.netbeans.modules.xml.schema.refactoring.query.QueryUnusedGlobals; 33 import org.netbeans.modules.xml.schema.refactoring.ui.QueryPanel; 34 import org.netbeans.modules.xml.schema.ui.basic.SchemaModelCookie; 35 import org.openide.ErrorManager; 36 import org.openide.loaders.DataObject; 37 import org.openide.nodes.Node; 38 import org.openide.util.HelpCtx; 39 import org.openide.util.NbBundle; 40 import org.openide.util.actions.CookieAction; 41 42 46 public class FindUnusedAction extends CookieAction{ 47 48 49 public FindUnusedAction() { 50 } 51 52 protected void performAction(Node[] node) { 53 try { 54 assert node.length==1: 55 "Length of nodes array should be 1"; 56 DataObject dobj = (DataObject)node[0].getCookie(DataObject.class); 57 SchemaModelCookie modelCookie = (SchemaModelCookie)dobj.getCookie(SchemaModelCookie.class); 58 QueryUnusedGlobals query = new QueryUnusedGlobals(modelCookie.getModel()); 59 new QueryPanel(query); 60 } catch (IOException ex) { 61 ErrorManager.getDefault().notify( ex); 62 } 63 64 } 65 66 public String getName() { 67 return NbBundle.getMessage(FindUnusedAction.class,"LBL_Find_Unused"); 68 } 69 70 public HelpCtx getHelpCtx() { 71 return HelpCtx.DEFAULT_HELP; 72 } 73 74 protected boolean asynchronous() { 75 return false; 76 } 77 78 protected int mode() { 79 return CookieAction.MODE_EXACTLY_ONE; 80 } 81 82 protected Class [] cookieClasses() { 83 return new Class [] {SchemaModelCookie.class}; 84 } 85 } 86 | Popular Tags |