Package org.eclipse.wst.validation.internal.operations

Examples of org.eclipse.wst.validation.internal.operations.LocalizedMessage


  /**
   * @param currentFile
   * @param reporter
   */
  private void validateV1File(IFile currentFile, IReporter reporter) {
    Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, currentFile.getFullPath().toString().substring(1));
    reporter.displaySubtask(MarkupValidator.this, message);

    IStructuredModel model = null;
    try {
      model = StructuredModelManager.getModelManager().getModelForRead(currentFile);
View Full Code Here


    if (sdRegion.isDeleted()) {
      return;
    }

    int lineNo = getLineNumber(start);
    LocalizedMessage message = new LocalizedMessage(messageSeverity, messageText);
    message.setOffset(start);
    message.setLength(length);
    message.setLineNo(lineNo);
   

    getAnnotationMsg(reporter, problemId, message, attributeValueText,length);
   
  }
View Full Code Here

    }
    // create one error for all attributes in the end tag
    if (errorCount > 0) {
      // Position p = new Position(start, end - start);
      String messageText = XMLCoreMessages.End_tag_has_attributes;
      LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.END_TAG_WITH_ATTRIBUTES), messageText);
      message.setOffset(start);
      message.setLength(end - start);
      message.setLineNo(getLineNumber(start));

      getAnnotationMsg(reporter, ProblemIDsXML.AttrsInEndTag, message, null,end-start);
     
    }
  }
View Full Code Here

      int start = structuredDocumentRegion.getStartOffset();
      int length = structuredDocumentRegion.getText().trim().length();
      int lineNo = getLineNumber(start);

      LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.MISSING_CLOSING_BRACKET) , messageText);
      message.setOffset(start);
      message.setLength(length);
      message.setLineNo(lineNo);
      getAnnotationMsg(reporter, ProblemIDsXML.MissingClosingBracket, message, null,length);

     
    }
  }
View Full Code Here

        String messageText = XMLCoreMessages.ReconcileStepForMarkup_3;
        int start = structuredDocumentRegion.getStartOffset();
        int length = structuredDocumentRegion.getLength();
        int lineNo = getLineNumber(start);

        LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.MISSING_TAG_NAME) , messageText);
        message.setOffset(start);
        message.setLength(length);
        message.setLineNo(lineNo);

        getAnnotationMsg(reporter, ProblemIDsXML.EmptyTag, message, null,length);
      }
    }
  }
View Full Code Here

            int start = structuredDocumentRegion.getStartOffset(nameRegion);
            int end = structuredDocumentRegion.getEndOffset();
            int lineNo = getLineNumber(start);
            int textLength = structuredDocumentRegion.getText(nameRegion).trim().length();

            LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.ATTRIBUTE_HAS_NO_VALUE) , messageText);
            message.setOffset(start);
            message.setLength(textLength);
            message.setLineNo(lineNo);

            // quick fix info
            ITextRegion equalsRegion = textRegions.get(i - 2 + 1);
            int insertOffset = structuredDocumentRegion.getTextEndOffset(equalsRegion) - end;
            Object[] additionalFixInfo = {structuredDocumentRegion.getText(nameRegion), new Integer(insertOffset)};

            getAnnotationMsg(reporter, ProblemIDsXML.MissingAttrValue, message, additionalFixInfo,textLength);
            errorCount++;
          }
        }
        // name but no '=' (XML only)
        else if ((attrState == 1) && (i >= 1)) {
          // create annotation
          ITextRegion previousRegion = textRegions.get(i - 1);
          if (!(previousRegion instanceof ITextRegionContainer)) {
            Object[] args = {structuredDocumentRegion.getText(previousRegion)};
            String messageText = NLS.bind(XMLCoreMessages.Attribute__has_no_value, args);
            int start = structuredDocumentRegion.getStartOffset(previousRegion);
            int textLength = structuredDocumentRegion.getText(previousRegion).trim().length();
            int lineNo = getLineNumber(start);

            LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.ATTRIBUTE_HAS_NO_VALUE), messageText);
            message.setOffset(start);
            message.setLength(textLength);
            message.setLineNo(lineNo);

            getAnnotationMsg(reporter, ProblemIDsXML.NoAttrValue, message, structuredDocumentRegion.getText(previousRegion),textLength);
       

            errorCount++;
View Full Code Here

          String messageText = XMLCoreMessages.ReconcileStepForMarkup_2;
          int start = structuredDocumentRegion.getStartOffset();
          // find length of whitespace
          int length = sdRegionText.trim().equals("") ? sdRegionText.length() : sdRegionText.indexOf(sdRegionText.trim()); //$NON-NLS-1$

          LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.WHITESPACE_BEFORE_TAGNAME) , messageText);
          message.setOffset(start);
          message.setLength(length);
          message.setLineNo(getLineNumber(start));
          getAnnotationMsg(reporter, ProblemIDsXML.SpacesBeforeTagName, message, null,length);
        }
      }
    }
  }
View Full Code Here

        if (index != -1) {
          String messageText = XMLCoreMessages.ReconcileStepForMarkup_4;
          int start = structuredDocumentRegion.getStartOffset(r) + index;
          int length = piText.trim().length() - index;

          LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.NAMESPACE_IN_PI_TARGET) , messageText);
          message.setOffset(start);
          message.setLength(length);
          message.setLineNo(getLineNumber(start));

         
          getAnnotationMsg(reporter, ProblemIDsXML.NamespaceInPI, message, null,length);

          errorCount++;
View Full Code Here

            Object[] args = {tagName};
            String messageText = NLS.bind(XMLCoreMessages.Missing_end_tag_, args);

            int lineNumber = getLineNumber(start);

            LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.MISSING_END_TAG) , messageText);
            message.setOffset(start);
            message.setLength(length);
            message.setLineNo(lineNumber);
            Object[] additionalFixInfo = getStartEndFixInfo(xmlNode, tagName, r);
 
            getAnnotationMsg(reporter, ProblemIDsXML.MissingEndTag, message, additionalFixInfo,length);
          }
        }
      }
      else {
        IStructuredDocumentRegion startRegion = xmlNode.getStartStructuredDocumentRegion();
        if (startRegion == null || startRegion.isDeleted()) {
          // analyze the tag (check self closing)
          ITextRegionList regions = endRegion.getRegions();
          ITextRegion r = null;
          int start = sdRegion.getStart();
          int length = sdRegion.getTextLength();
          for (int i = 0; i < regions.size(); i++) {
            r = regions.get(i);
            if (r.getType() == DOMRegionContext.XML_TAG_NAME) {
              tagName = sdRegion.getText(r);
              start = sdRegion.getStartOffset(r);
              length = r.getTextLength();
            }
          }

          if (tagName != null) {
            Object[] args = {tagName};
            String messageText = NLS.bind(XMLCoreMessages.Missing_start_tag_, args);

            int lineNumber = getLineNumber(start);

            LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.MISSING_START_TAG), messageText);
            message.setOffset(start);
            message.setLength(length);
            message.setLineNo(lineNumber);
            Object[] additionalFixInfo = getStartEndFixInfo(xmlNode, tagName, r);
                       
            getAnnotationMsg(reporter, ProblemIDsXML.MissingStartTag, message, additionalFixInfo,length);
           
          }
        }
      }

    }
    /*
     * Check for an end tag that has no start tag
     */
    else {
      IStructuredDocumentRegion startRegion = xmlNode.getStartStructuredDocumentRegion();
      if (startRegion == null) {
        IStructuredDocumentRegion endRegion = xmlNode.getEndStructuredDocumentRegion();
        if (!endRegion.isDeleted()) {
          // get name
          ITextRegionList regions = endRegion.getRegions();
          ITextRegion r = null;
          for (int i = 0; i < regions.size(); i++) {
            r = regions.get(i);
            if (r.getType() == DOMRegionContext.XML_TAG_NAME) {
              tagName = sdRegion.getText(r);
            }
          }

          if (!selfClosed && (tagName != null)) {
            String messageText = XMLCoreMessages.Indicate_no_grammar_specified_severities_error;

            int start = sdRegion.getStart();
            int lineNumber = getLineNumber(start);

            // SEVERITY_STRUCTURE == IMessage.HIGH_SEVERITY
            IMessage message = new LocalizedMessage(IMessage.HIGH_SEVERITY, messageText);
            message.setOffset(start);
            message.setLength(sdRegion.getTextLength());
            message.setLineNo(lineNumber);

            reporter.addMessage(this, message);
          }
        }
      }
View Full Code Here

      if (prev.getType() == DOMRegionContext.XML_CONTENT) {
        String messageText = XMLCoreMessages.ReconcileStepForMarkup_5;
        int start = prev.getStartOffset();
        int length = prev.getLength();

        LocalizedMessage message = new LocalizedMessage(getPluginPreference().getInt(XMLCorePreferenceNames.WHITESPACE_AT_START) , messageText);
        message.setOffset(start);
        message.setLength(length);
        message.setLineNo(getLineNumber(start));

     
        getAnnotationMsg(reporter, ProblemIDsXML.SpacesBeforePI, message, null,length);
       
        // Position p = new Position(start, length);
View Full Code Here

TOP

Related Classes of org.eclipse.wst.validation.internal.operations.LocalizedMessage

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.