use of org.eclipse.wst.html.core.internal.validate.Segment in project webtools.sourceediting by eclipse.
the class CustomExtendedAttributeValidator method validateAttribute.
public ValidationMessage validateAttribute(IDOMElement target, String attrName) {
if ("plugins".equals(attrName)) {
try {
String attrValue = target.getAttribute(attrName);
Integer.parseInt(attrValue);
} catch (NumberFormatException e) {
Segment segment = CustomValidatorUtil.getAttributeSegment((IDOMNode) target.getAttributeNode(attrName), CustomValidatorUtil.ATTR_REGION_NAME);
return new ValidationMessage("Attribute should be integer", segment.getOffset(), segment.getLength(), ValidationMessage.ERROR);
}
}
return null;
}
use of org.eclipse.wst.html.core.internal.validate.Segment in project webtools.sourceediting by eclipse.
the class CustomExtendedTagValidator method validateTag.
public ValidationMessage validateTag(IDOMElement target) {
Assert.assertEquals(currentFileLocation, getResource(target.getStructuredDocument()));
String tagName = target.getLocalName();
if (tagName.indexOf("thym") >= 0) {
Segment segment = CustomValidatorUtil.getTagSegment(target, CustomValidatorUtil.SEG_START_TAG_NAME);
return new ValidationMessage("Thym is available only with external installation", segment.getOffset(), segment.getLength(), ValidationMessage.ERROR);
}
return null;
}
Aggregations