Package org.fusesource.ide.commons.camel.tools

Examples of org.fusesource.ide.commons.camel.tools.ValidationHandler


      // load the model
      if (editor.getModel() == null) {
        try {
          editor.setModel(CamelContextIOUtils.loadModelFromFile(camelContextFile));
          editor.setCamelContextFile(camelContextFile);
          ValidationHandler status = CamelContextIOUtils.validateModel(editor.getModel());
          if (status.hasErrors()) {
            Activator.getLogger().error("Unable to validate the model. Invalid input!");
            return false;
          }
        } catch (PartInitException pe) {
          Activator.getLogger().error("Unable to load the model. Invalid input!", pe);
          return false;
        }
      }
      return true;
    } else {
      IRemoteCamelEditorInput remoteEditorInput = editor.asRemoteCamelEditorInput(input);
      if (remoteEditorInput != null) {
        camelContextFile = null;
        container = null;

        // load the model
        if (editor.getModel() == null) {
          try {
            String text = remoteEditorInput.getXml();
            try {
              editor.setModel(CamelContextIOUtils.loadModelFromText(text));
              ValidationHandler status = CamelContextIOUtils.validateModel(editor.getModel());
              if (status.hasErrors()) {
                Activator.getLogger().error("Unable to validate the model. Invalid input!");
                return false;
              }
            } catch (PartInitException pe) {
              Activator.getLogger().error("Unable to load the model. Invalid input!", pe);
View Full Code Here


    if (file.getName().contentEquals("switchyard.xml")) {
      MessageDialog.openWarning(getSite().getShell(), EditorMessages.switchyardFoundTitle,
          EditorMessages.switchyardFoundText);
      switchToSourceEditor();
    }
    ValidationHandler status = this.getModel().validate();
    if (status.hasErrors()) {
      switchToSourceEditor();
    }
  }
View Full Code Here

          String text = document.get();
          loadEditorText(text);
        }

      } else {
        ValidationHandler status = this.getModel().validate();
        if (status.hasErrors()) {
          String error = status.userMessage();
          showXmlValidationError(error);
        }
      }
    }
  }
View Full Code Here

  public ValidationHandler validate() throws Exception {
    if (model != null) {
      return model.validate();
    } else {
      // typically when we've not been able to parse the XML yet...
      return new ValidationHandler();
    }
  }
View Full Code Here

TOP

Related Classes of org.fusesource.ide.commons.camel.tools.ValidationHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.