Author: akazakov
Date: 2010-03-03 13:12:26 -0500 (Wed, 03 Mar 2010)
New Revision: 20622
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/components.3
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5976
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-03-03
17:03:13 UTC (rev 20621)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-03-03
18:12:26 UTC (rev 20622)
@@ -620,8 +620,8 @@
}
String className = declaration.getClassName();
+ IType type = null;
if(className!=null) {
- IType type = null;
// validate class name
try {
IProject p = seamProject.getProject();
@@ -648,16 +648,24 @@
} catch (JavaModelException e) {
SeamCorePlugin.getDefault().logError(SeamCoreMessages.SEAM_CORE_VALIDATOR_ERROR_VALIDATING_SEAM_CORE,
e);
}
- // validate properties
- Collection<ISeamProperty> properties = declaration.getProperties();
- for (ISeamProperty property : properties) {
- if(SeamUtil.isJar(property)) {
- return;
+ }
+ // validate properties
+ Collection<ISeamProperty> properties = declaration.getProperties();
+ for (ISeamProperty property : properties) {
+ if(SeamUtil.isJar(property)) {
+ return;
+ }
+ String name = property.getName();
+ if(name==null) {
+ return;
+ }
+ if(type==null && component.getJavaDeclaration()!=null) {
+ IMember member = component.getJavaDeclaration().getSourceMember();
+ if(member instanceof IType) {
+ type = (IType)member;
}
- String name = property.getName();
- if(name==null) {
- return;
- }
+ }
+ if(type!=null) {
boolean ok = type.isBinary() || SeamUtil.findProperty(type, name)!=null;
if(!ok) {
addError(SeamValidationMessages.UNKNOWN_COMPONENT_PROPERTY,
SeamPreferences.UNKNOWN_COMPONENT_PROPERTY, new String[]{type.getElementName(),
componentName, name}, property, declaration.getResource());
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/components.3
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/components.3 2010-03-03
17:03:13 UTC (rev 20621)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/SeamWebWarTestProject/WebContent/WEB-INF/components.3 2010-03-03
18:12:26 UTC (rev 20622)
@@ -16,6 +16,10 @@
<property name="abc">value1</property>
</component>
+ <component name="statefulComponent">
+ <property name="abc">value1</property>
+ </component>
+
<core:init debug="true" jndi-pattern="@jndiPattern@"/>
<core:manager concurrent-request-timeout="500"
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2010-03-03
17:03:13 UTC (rev 20621)
+++
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2010-03-03
18:12:26 UTC (rev 20622)
@@ -306,7 +306,7 @@
assertMarkerIsCreated(
componentsFile,
MARKER_TYPE,
- "Class \"StatefulComponent\" of component
\"statefulComponent\" does not have a setter or a field for the property
\"abc\"", 16);
+ "Class \"StatefulComponent\" of component
\"statefulComponent\" does not have a setter or a field for the property
\"abc\"", 16, 20);
}
public void testEntityHasWrongScope_Validator() throws CoreException {