/**
* @return Returns the ValidatorStrategy.
*/
protected ValidatorStrategy getValidatorStrategy() {
ValidatorStrategy validatorStrategy = null;
if (fValidatorStrategy == null && fValidationEnabled) {
if (getTextViewer() instanceof ISourceViewer) {
ISourceViewer viewer = (ISourceViewer) getTextViewer();
String contentTypeId = null;
IDocument doc = viewer.getDocument();
contentTypeId = getContentType(doc);
if (contentTypeId != null) {
validatorStrategy = new ValidatorStrategy(viewer, contentTypeId);
ValidatorBuilder vBuilder = new ValidatorBuilder();
ValidatorMetaData[] vmds = vBuilder.getValidatorMetaData(SSE_UI_ID);
List enabledValidators = new ArrayList(1);
/* if any "must" handle this content type, just add them */
boolean foundSpecificContentTypeValidators = false;
for (int i = 0; i < vmds.length; i++) {
if (vmds[i].mustHandleContentType(contentTypeId)) {
if (DEBUG_VALIDATORS)
Logger.log(Logger.INFO, contentTypeId + " using specific validator " + vmds[i].getValidatorId()); //$NON-NLS-1$
foundSpecificContentTypeValidators = true;
enabledValidators.add(vmds[i]);
}
}
if (!foundSpecificContentTypeValidators) {
for (int i = 0; i < vmds.length; i++) {
if (vmds[i].canHandleContentType(contentTypeId)) {
if (DEBUG_VALIDATORS)
Logger.log(Logger.INFO, contentTypeId + " using inherited(?) validator " + vmds[i].getValidatorId()); //$NON-NLS-1$
enabledValidators.add(vmds[i]);
}
}
}
for (int i = 0; i < enabledValidators.size(); i++) {
validatorStrategy.addValidatorMetaData((ValidatorMetaData) enabledValidators.get(i));
}
}
}
fValidatorStrategy = validatorStrategy;
} else if(fValidatorStrategy != null && fValidationEnabled) {