Author: akazakov
Date: 2007-12-27 11:19:40 -0500 (Thu, 27 Dec 2007)
New Revision: 5460
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1572 Fixed. JUnit test for this feature is already
exists.
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 2007-12-27
14:41:20 UTC (rev 5459)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-12-27
16:19:40 UTC (rev 5460)
@@ -281,32 +281,30 @@
boolean unknownVariable = true;
boolean firstDuplicateVariableWasMarked = false;
for (ISeamContextVariable variable : variables) {
- if((factoryScope == variable.getScope() ||
factoryScope.getPriority()>variable.getScope().getPriority())) {
- if(variable instanceof ISeamFactory || variable instanceof ISeamComponent || variable
instanceof IRole) {
- if(variable!=factory && !markedDuplicateFactoryNames.contains(factoryName))
{
- // Duplicate factory name. Mark it.
- // Save link to factory resource.
- ISeamTextSourceReference location = null;
- if(!firstDuplicateVariableWasMarked) {
- firstDuplicateVariableWasMarked = true;
- // mark original factory
- validationContext.addLinkedCoreResource(factoryName, factory.getSourcePath());
- location = coreHelper.getLocationOfName(factory);
- this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID,
SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location,
factory.getResource());
- }
- // Mark duplicate variable.
- if(!coreHelper.isJar(variable.getSourcePath())) {
- IResource resource = coreHelper.getComponentResourceWithName(variable);
- validationContext.addLinkedCoreResource(factoryName, resource.getFullPath());
- location = coreHelper.getLocationOfName(variable);
- this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID,
SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location, resource);
- }
-// markedDuplicateFactoryNames.add(factoryName);
+ if(variable instanceof ISeamFactory || variable instanceof ISeamComponent || variable
instanceof IRole) {
+ if(variable!=factory && !markedDuplicateFactoryNames.contains(factoryName)
&&
+ (factoryScope == variable.getScope() ||
factoryScope.getPriority()>variable.getScope().getPriority())) {
+ // Duplicate factory name. Mark it.
+ // Save link to factory resource.
+ ISeamTextSourceReference location = null;
+ if(!firstDuplicateVariableWasMarked) {
+ firstDuplicateVariableWasMarked = true;
+ // mark original factory
+ validationContext.addLinkedCoreResource(factoryName, factory.getSourcePath());
+ location = coreHelper.getLocationOfName(factory);
+ this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID,
SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location,
factory.getResource());
}
- } else {
- // We have that variable name
- unknownVariable = false;
+ // Mark duplicate variable.
+ if(!coreHelper.isJar(variable.getSourcePath())) {
+ IResource resource = coreHelper.getComponentResourceWithName(variable);
+ validationContext.addLinkedCoreResource(factoryName, resource.getFullPath());
+ location = coreHelper.getLocationOfName(variable);
+ this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID,
SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location, resource);
+ }
}
+ } else {
+ // We know that variable name
+ unknownVariable = false;
}
}
if(firstDuplicateVariableWasMarked) {