Author: akazakov
Date: 2007-12-27 07:50:12 -0500 (Thu, 27 Dec 2007)
New Revision: 5458
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java
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-1570 Fixed. JUnit for this issue already exists.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2007-12-27
01:20:37 UTC (rev 5457)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractContextVariable.java 2007-12-27
12:50:12 UTC (rev 5458)
@@ -27,6 +27,9 @@
protected String scope;
public ScopeType getScope() {
+ if(scopeType == null) {
+ return ScopeType.UNSPECIFIED;
+ }
return scopeType;
}
@@ -66,7 +69,7 @@
scope = f.scope;
scopeType = f.scopeType;
}
-
+
return changes;
}
@@ -79,5 +82,4 @@
AbstractContextVariable c = (AbstractContextVariable)super.clone();
return c;
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java 2007-12-27
01:20:37 UTC (rev 5457)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/Role.java 2007-12-27
12:50:12 UTC (rev 5458)
@@ -12,11 +12,40 @@
package org.jboss.tools.seam.internal.core;
import org.jboss.tools.seam.core.IRole;
+import org.jboss.tools.seam.core.ISeamContextVariable;
+import org.jboss.tools.seam.core.ISeamElement;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
+import org.jboss.tools.seam.core.ScopeType;
public class Role extends SeamJavaContextVariable implements IRole {
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.SeamJavaContextVariable#clone()
+ */
+ @Override
public Role clone() throws CloneNotSupportedException {
return (Role)super.clone();
}
-}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.internal.core.AbstractContextVariable#getScope()
+ */
+ @Override
+ public ScopeType getScope() {
+ ScopeType returnScopeType = scopeType;
+ if(returnScopeType == null) {
+ ISeamElement parent = getParent();
+ if(parent instanceof ISeamContextVariable) {
+ returnScopeType = ((ISeamContextVariable)parent).getScope();
+ } else if(parent instanceof ISeamJavaComponentDeclaration) {
+ returnScopeType = ((ISeamJavaComponentDeclaration)parent).getScope();
+ }
+ if(returnScopeType == null) {
+ returnScopeType = ScopeType.UNSPECIFIED;
+ }
+ }
+ return returnScopeType;
+ }
+}
\ No newline at end of file
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
01:20:37 UTC (rev 5457)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-12-27
12:50:12 UTC (rev 5458)
@@ -285,7 +285,7 @@
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
+ // Save link to factory resource.
ISeamTextSourceReference location = null;
if(!firstDuplicateVariableWasMarked) {
firstDuplicateVariableWasMarked = true;
@@ -294,14 +294,14 @@
location = coreHelper.getLocationOfName(factory);
this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID,
SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location,
factory.getResource());
}
- // mark duplicate variable
+ // 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);
+// markedDuplicateFactoryNames.add(factoryName);
}
} else {
// We have that variable name
@@ -309,6 +309,9 @@
}
}
}
+ if(firstDuplicateVariableWasMarked) {
+ markedDuplicateFactoryNames.add(factoryName);
+ }
if(unknownVariable && validateUnknownName) {
// mark unknown factory name
// save link to factory resource