if (value != null)
{
if (attributeMetaData.getTargetType().isInstance(value) == false)
{
// notify of invalid type
resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
Messages.getString("MandatoryAttributeMissingInspection.AttributeValueHasInvalidType",
element.getName(), attributeMetaData.getDisplayName(Locale.getDefault()),
attributeMetaData.getTargetType().getName(), value.getClass().getName()),
new AttributeLocationInfo(element, attributeMetaData.getNameSpace(), attributeMetaData.getName(), false)));
}
if (attributeMetaData.isDesignTimeValue())
{
if (element.getAttributeExpression(attributeMetaData.getNameSpace(), attributeMetaData.getName()) != null)
{
// warn that design-time values have no need for a expression
resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
Messages.getString("MandatoryAttributeMissingInspection.DesignTimeAttributeWithExpression",
element.getName(), attributeMetaData.getDisplayName(Locale.getDefault())),
new AttributeLocationInfo(element, attributeMetaData.getNameSpace(), attributeMetaData.getName(), false)));
}
}
continue;
}
if (attributeMetaData.isMandatory() == false)
{
continue;
}
if (attributeMetaData.isDesignTimeValue() == false)
{
if (element.getAttributeExpression(attributeMetaData.getNameSpace(), attributeMetaData.getName()) != null)
{
continue;
}
// warn that either value or expression must be set
resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
Messages.getString("MandatoryAttributeMissingInspection.MandatoryAttributeWithoutValueOrExpression",
element.getName(), attributeMetaData.getDisplayName(Locale.getDefault())),
new AttributeLocationInfo(element, attributeMetaData.getNameSpace(), attributeMetaData.getName(), false)));
}
else
{
// warn that a value must be set
resultHandler.notifyInspectionResult(new InspectionResult(this, InspectionResult.Severity.WARNING,
Messages.getString("MandatoryAttributeMissingInspection.MandatoryAttributeWithoutValue",
element.getName(), attributeMetaData.getDisplayName(Locale.getDefault())),
new AttributeLocationInfo(element, attributeMetaData.getNameSpace(), attributeMetaData.getName(), false)));
}
}