Examples of ValidationMessage


Examples of org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage

  /* (non-Javadoc)
   * @see org.eclipse.jst.jsf.taglibprocessing.attributevalues.MethodBindingType#isValidValue(java.lang.String)
   */
  public boolean isValidValue(String value){
    if (value == null || (value != null && value.length() == 0)) {
      IValidationMessage msg = new ValidationMessage(Messages.ActionType_invalid_empty_value);
      getValidationMessages().add(msg);
      return false;
    }
    //any other value should be one of the possible values
    //optimize
    IWorkspaceContextResolver wr = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(getStructuredDocumentContext());
    if (wr == null)
      return true;//shouldn't get here
   
    //in case that this is not JSF faceted or missing configs, need to pass
    if (JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(wr.getProject()) == null)
      return true;
     
    IFile jsp = (IFile)wr.getResource();
    List<NavigationRuleType> rules = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(wr.getProject()).getNavigationRulesForPage(jsp);
    for (final NavigationRuleType rule : rules) {
      for (Iterator cases=rule.getNavigationCase().iterator();cases.hasNext();) {       
        NavigationCaseType navCase = (NavigationCaseType)cases.next();         
        if (navCase.getFromOutcome() != null && navCase.getFromOutcome().getTextContent() != null &&
            value.equals(navCase.getFromOutcome().getTextContent().trim()))
          return true;       
      }
    }
    if (JSFVersion.valueOfProject(jsp.getProject()).compareTo(JSFVersion.V2_0) >= 0) {
      int index = value.indexOf('?');
      if (index != -1) {
        value = value.substring(0, index);
      }
      if (value != null && value.length() > 1) {
        IVirtualFolder webRoot = ComponentCore.createComponent(jsp.getProject()).getRootFolder();
        if (value.charAt(0) == '/') {
          IVirtualFile file = webRoot.getFile(new Path(value));
          if (file.exists()) {
            return true;
          }
        } else {
          IPath webContentPath = webRoot.getUnderlyingFolder().getFullPath();
          IPath filePath = jsp.getFullPath();
          if (filePath.matchingFirstSegments(webContentPath) == webContentPath.segmentCount()) {
            String extension = filePath.getFileExtension();
            filePath = filePath.removeFirstSegments(webContentPath.segmentCount());
            filePath = filePath.removeLastSegments(1);
            filePath = filePath.append(value);
            if (filePath.getFileExtension() == null && extension != null) {
              filePath = filePath.addFileExtension(extension);
            }
            IVirtualFile file = webRoot.getFile(filePath);
            if (file.exists()) {
              return true;
            }
          }
        }
      }
    }

    IValidationMessage msg = new ValidationMessage(Messages.ActionType_invalid_value);
    getValidationMessages().add(msg);
    return false;
  }
View Full Code Here

Examples of org.eclipse.jst.jsf.metadataprocessors.features.ValidationMessage

  /* (non-Javadoc)
   * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidValues#isValidValue(java.lang.String)
   */
  public boolean isValidValue(String value) {
    //Strings are invalid.   Requires a EL value binding.
    IValidationMessage msg = new ValidationMessage(Messages.ComponentBindingType_invalid_value);
    getValidationMessages().add(msg);
    return false;
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.validate.ValidationMessage

  /**
   */
  public ValidationMessage createMessage(ErrorInfo info) {
    String errorMsg = getErrorMessage(info);
    int errorSeverity = getErrorSeverity(info);
    return new ValidationMessage(errorMsg, info.getOffset(), info.getLength(), errorSeverity);
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.validate.ValidationMessage

  /**
   */
  public ValidationMessage createMessage(ErrorInfo info) {
    String errorMsg = getErrorMessage(info);
    int errorSeverity = getErrorSeverity(info);
    return new ValidationMessage(errorMsg, info.getOffset(), info.getLength(), errorSeverity);
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage

      List list = (List) viewer.getInput();
      return list != null ? list.toArray() : null;
    }

    public Image getColumnImage(Object object, int columnIndex) {
      ValidationMessage validationMessage = (ValidationMessage) object;
      Image result = null;
      if (columnIndex == 0) {
        int severity = validationMessage.getSeverity();
        if ((severity == IMessage.HIGH_SEVERITY) || (severity == IMessage.NORMAL_SEVERITY)) {
          result = errorImage;
        }
        else {
          result = warnImage;
View Full Code Here

Examples of org.guvnor.common.services.shared.validation.model.ValidationMessage

        }
        return messages;
    }

    private ValidationMessage makeNewValidationMessage( final DSLMappingParseException e ) {
        final ValidationMessage msg = new ValidationMessage();
        msg.setLevel( ValidationMessage.Level.ERROR );
        msg.setLine( e.getLine() );
        msg.setText( e.getMessage() );
        return msg;
    }
View Full Code Here

Examples of org.guvnor.common.services.shared.validation.model.ValidationMessage

        msg.setText( e.getMessage() );
        return msg;
    }

    private ValidationMessage makeNewValidationMessage( final Exception e ) {
        final ValidationMessage msg = new ValidationMessage();
        msg.setLevel( ValidationMessage.Level.ERROR );
        msg.setText( "Exception " + e.getClass() + " " + e.getMessage() + " " + e.getCause() );
        return msg;
    }
View Full Code Here

Examples of org.guvnor.common.services.shared.validation.model.ValidationMessage

        msg.setText( "Exception " + e.getClass() + " " + e.getMessage() + " " + e.getCause() );
        return msg;
    }

    private ValidationMessage makeNewValidationMessage( final Object o ) {
        final ValidationMessage msg = new ValidationMessage();
        msg.setLevel( ValidationMessage.Level.ERROR );
        msg.setText( "Uncategorized error " + o );
        return msg;
    }
View Full Code Here

Examples of org.guvnor.common.services.shared.validation.model.ValidationMessage

        }
    }

    private ValidationMessage makeValidationMessages( final Path path,
                                                      final String message ) {
        final ValidationMessage msg = new ValidationMessage();
        msg.setPath( path );
        msg.setLevel( ValidationMessage.Level.ERROR );
        msg.setText( message );
        return msg;
    }
View Full Code Here

Examples of org.guvnor.common.services.shared.validation.model.ValidationMessage

        }
    }

    private ValidationMessage makeValidationMessages( final Path path,
                                                      final String message ) {
        final ValidationMessage msg = new ValidationMessage();
        msg.setPath( path );
        msg.setLevel( ValidationMessage.Level.ERROR );
        msg.setText( message );
        return msg;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.