Author: xcoulon
Date: 2012-02-29 09:44:35 -0500 (Wed, 29 Feb 2012)
New Revision: 39194
Modified:
branches/jbosstools-3.3.0.Beta1/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
Log:
Fixed - JBIDE-10686
[Validation] Show error when trying to inject unsupported type with @Context
Modified:
branches/jbosstools-3.3.0.Beta1/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
===================================================================
---
branches/jbosstools-3.3.0.Beta1/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java 2012-02-29
14:09:27 UTC (rev 39193)
+++
branches/jbosstools-3.3.0.Beta1/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java 2012-02-29
14:44:35 UTC (rev 39194)
@@ -28,6 +28,7 @@
import org.jboss.tools.ws.jaxrs.core.internal.utils.ConstantUtils;
import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
import org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils;
+import org.jboss.tools.ws.jaxrs.core.metamodel.EnumElementKind;
import org.jboss.tools.ws.jaxrs.core.metamodel.JaxrsMetamodelLocator;
public class JaxrsMetamodelValidator extends AbstractValidator {
@@ -52,13 +53,15 @@
if (jaxrsMetamodel == null) {
return validationResult;
}
- JaxrsBaseElement element =
jaxrsMetamodel.getElement(JdtUtils.getCompilationUnit(resource));
- if (element != null) {
- Logger.debug("Validating the JAX-RS Metamodel after {} was {}",
resource.getName(),
- ConstantUtils.getStaticFieldName(IResourceDelta.class, kind));
- List<ValidatorMessage> validationMessages = element.validate();
- for (ValidatorMessage validationMessage : validationMessages) {
- validationResult.add(validationMessage);
+ List<JaxrsBaseElement> elements =
jaxrsMetamodel.getElements(JdtUtils.getCompilationUnit(resource));
+ for(JaxrsBaseElement element : elements) {
+ if (element.getElementKind() == EnumElementKind.RESOURCE) {
+ Logger.debug("Validating the JAX-RS Metamodel after {} was {}",
resource.getName(),
+ ConstantUtils.getStaticFieldName(IResourceDelta.class, kind));
+ List<ValidatorMessage> validationMessages = element.validate();
+ for (ValidatorMessage validationMessage : validationMessages) {
+ validationResult.add(validationMessage);
+ }
}
}
}