Search in sources :

Example 11 with AnnotationInfo

use of org.eclipse.wst.sse.ui.internal.reconcile.validator.AnnotationInfo in project webtools.sourceediting by eclipse.

the class MarkupValidator method checkEmptyTag.

private void checkEmptyTag(IStructuredDocumentRegion structuredDocumentRegion, IReporter reporter) {
    if (structuredDocumentRegion.isDeleted()) {
        return;
    }
    // navigate to name
    ITextRegionList regions = structuredDocumentRegion.getRegions();
    if (regions.size() == 2) {
        // missing name region
        if ((regions.get(0).getType() == DOMRegionContext.XML_TAG_OPEN) && (regions.get(1).getType() == DOMRegionContext.XML_TAG_CLOSE)) {
            String messageText = XMLUIMessages.ReconcileStepForMarkup_3;
            int start = structuredDocumentRegion.getStartOffset();
            int length = structuredDocumentRegion.getLength();
            int lineNo = getLineNumber(start);
            LocalizedMessage message = new LocalizedMessage(SEVERITY_TAG_NAME_MISSING, messageText);
            message.setOffset(start);
            message.setLength(length);
            message.setLineNo(lineNo);
            if (reporter instanceof IncrementalReporter) {
                MarkupQuickAssistProcessor processor = new MarkupQuickAssistProcessor();
                processor.setProblemId(ProblemIDsXML.EmptyTag);
                message.setAttribute(QUICKASSISTPROCESSOR, processor);
                AnnotationInfo info = new AnnotationInfo(message);
                ((IncrementalReporter) reporter).addAnnotationInfo(this, info);
            } else {
                reporter.addMessage(this, message);
            }
        }
    }
}
Also used : IncrementalReporter(org.eclipse.wst.sse.ui.internal.reconcile.validator.IncrementalReporter) ITextRegionList(org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList) LocalizedMessage(org.eclipse.wst.validation.internal.operations.LocalizedMessage) AnnotationInfo(org.eclipse.wst.sse.ui.internal.reconcile.validator.AnnotationInfo)

Aggregations

AnnotationInfo (org.eclipse.wst.sse.ui.internal.reconcile.validator.AnnotationInfo)11 IncrementalReporter (org.eclipse.wst.sse.ui.internal.reconcile.validator.IncrementalReporter)11 LocalizedMessage (org.eclipse.wst.validation.internal.operations.LocalizedMessage)9 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)6 ITextRegion (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)5 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)3 IMessage (org.eclipse.wst.validation.internal.provisional.core.IMessage)3 BadLocationException (org.eclipse.jface.text.BadLocationException)2 ITextRegionContainer (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer)1 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)1