1 19 package org.netbeans.modules.xml.schema.actions; 20 21 import org.openide.nodes.*; 22 import org.openide.util.HelpCtx; 23 import org.openide.util.actions.CookieAction; 24 25 import org.netbeans.modules.xml.core.actions.*; 26 27 import org.netbeans.api.xml.cookies.*; 28 29 35 public class ValidateSchemaAction extends CookieAction implements CollectXMLAction.XMLAction { 36 37 38 private static final long serialVersionUID = -8772119268950444993L; 39 40 41 42 protected Class [] cookieClasses () { 43 return new Class [] { ValidateXMLCookie.class }; 44 } 45 46 47 protected int mode () { 48 return MODE_ALL; 49 } 50 51 52 protected void performAction (Node[] nodes) { 53 54 if (nodes == null) return; 55 56 InputOutputReporter console = new InputOutputReporter(); 57 boolean allValid = true; 58 59 for (int i = 0; i<nodes.length; i++) { 60 Node node = nodes[i]; 61 ValidateXMLCookie cake = (ValidateXMLCookie) node.getCookie(ValidateXMLCookie.class); 62 if (cake == null) continue; 63 console.setNode(node); allValid &= cake.validateXML(console); 65 } 66 67 if (allValid) { 68 console.message(Util.THIS.getString("MSG_Schema_valid_end")); 69 } else { 70 console.message(Util.THIS.getString("MSG_Schema_invalid_end")); 71 } 72 console.moveToFront(true); 73 } 74 75 76 public String getName() { 77 return Util.THIS.getString("NAME_Validate_Schema"); 78 } 79 80 81 protected String iconResource () { 82 return null; 83 } 84 85 86 public HelpCtx getHelpCtx () { 87 return new HelpCtx (ValidateSchemaAction.class); 88 } 89 90 } 91 | Popular Tags |