1 19 20 package org.netbeans.modules.xml.validation; 21 22 import java.io.IOException ; 23 import java.util.ArrayList ; 24 import java.util.List ; 25 import org.netbeans.modules.xml.validation.ui.ValidationOutputWindow; 26 import org.netbeans.modules.xml.xam.Model; 27 import org.netbeans.modules.xml.xam.Model.State; 28 import org.netbeans.modules.xml.xam.spi.Validation; 29 import org.netbeans.modules.xml.xam.spi.Validation.ValidationType; 30 import org.netbeans.modules.xml.xam.spi.Validator.ResultItem; 31 import org.openide.util.NbBundle; 32 33 37 public class ValidationOutputWindowController { 38 39 40 public ValidationOutputWindowController() { 41 } 42 43 44 51 public List <ResultItem> validate(Model model) { 52 53 if (model!=null && !model.inSync()) { 55 try { 56 model.sync(); 57 } catch (IOException ioe) { 58 } 61 } 62 63 Validation validation = new Validation(); 64 validation.validate(model, ValidationType.COMPLETE); 65 List <ResultItem> validationResult = validation.getValidationResult(); 66 printGuidanceInformation(validationResult); 67 68 return validationResult; 69 } 70 71 72 73 private void printGuidanceInformation(List <ResultItem> guidanceInformation) { 74 ValidationOutputWindow guidanceOutputWindow = new ValidationOutputWindow(); 75 guidanceOutputWindow.displayValidationInformation(guidanceInformation); 76 } 77 78 } 79 | Popular Tags |