Author: scabanovich
Date: 2008-10-22 11:40:40 -0400 (Wed, 22 Oct 2008)
New Revision: 11083
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
Log:
JBIDE-2958
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java 2008-10-22
15:33:12 UTC (rev 11082)
+++
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamXmlComponentDeclaration.java 2008-10-22
15:40:40 UTC (rev 11083)
@@ -43,6 +43,8 @@
*/
public String getClassName();
+ public boolean isClassNameGuessed();
+
/**
* @return string value of 'jndi-name' attribute
*/
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2008-10-22
15:33:12 UTC (rev 11082)
+++
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2008-10-22
15:40:40 UTC (rev 11083)
@@ -62,6 +62,8 @@
public static final String STATEFUL_COMPONENT_WRONG_SCOPE =
createSeverityOption("statefulComponentHasWrongScope"); //$NON-NLS-1$
// If className ('component' element) contains unknown class name then
component.xml will be marked.
public static final String UNKNOWN_COMPONENT_CLASS_NAME =
createSeverityOption("unknownComponentClassName"); //$NON-NLS-1$
+
+ public static final String UNKNOWN_COMPONENT_CLASS_NAME_GUESS =
createSeverityOption("unknownComponentClassNameGuess"); //$NON-NLS-1$
// If component/property@name contains some property name which does not have setter
then mark it.
public static final String UNKNOWN_COMPONENT_PROPERTY =
createSeverityOption("unknownComponentProperty"); //$NON-NLS-1$
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2008-10-22
15:33:12 UTC (rev 11082)
+++
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2008-10-22
15:40:40 UTC (rev 11083)
@@ -36,5 +36,8 @@
defaultPreferences.put(SeamPreferences.UNKNOWN_VARIABLE_NAME,
SeamPreferences.WARNING);
defaultPreferences.put(SeamPreferences.UNPAIRED_GETTER_OR_SETTER,
SeamPreferences.IGNORE);
defaultPreferences.put(SeamPreferences.CHECK_VARS, SeamPreferences.ENABLE);
+
+ //JBIDE-2958 temporary until JBIDE-2957 solved //TODO solve JBIDE-2957
+ defaultPreferences.put(SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME_GUESS,
SeamPreferences.WARNING);
}
}
\ No newline at end of file
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2008-10-22
15:33:12 UTC (rev 11082)
+++
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2008-10-22
15:40:40 UTC (rev 11083)
@@ -33,6 +33,8 @@
String precedence = null;
String scope = null;
+ boolean isClassNameGuessed = false;
+
public String getAutoCreateAsString() {
return autoCreate;
}
@@ -41,6 +43,10 @@
return className;
}
+ public boolean isClassNameGuessed() {
+ return isClassNameGuessed;
+ }
+
public boolean getInstalledAsString() {
return !"false".equals(installed); //$NON-NLS-1$
}
@@ -83,6 +89,10 @@
setClassName(value == null ? null : value.getValue());
}
+ public void setClassNameGuessed(boolean b) {
+ isClassNameGuessed = b;
+ }
+
public void setAutoCreate(String autoCreate) {
this.autoCreate = autoCreate;
}
@@ -143,6 +153,7 @@
changes = Change.addChange(changes, new Change(this, CLASS, className,
xd.className));
className = xd.className;
}
+ this.isClassNameGuessed = xd.isClassNameGuessed;
if(!stringsEqual(autoCreate, xd.autoCreate)) {
changes = Change.addChange(changes, new Change(this, AUTO_CREATE, autoCreate,
xd.autoCreate));
autoCreate = xd.autoCreate;
@@ -178,6 +189,10 @@
public Element toXML(Element parent, Properties context) {
Element element = super.toXML(parent, context);
+
+ if(isClassNameGuessed) {
+ element.setAttribute("isClassNameGuessed", "true");
+ }
return element;
}
@@ -192,12 +207,16 @@
setScope(attributes.get(SCOPE));
setClassName(attributes.get(CLASS));
+ isClassNameGuessed =
"true".equals(element.getAttribute("isClassNameGuessed"));
+
if(className == null && id instanceof XModelObject) {
XModelObject c = (XModelObject)id;
if(c.getModelEntity().getName().equals("FileSeamComponent12")) {
className = XMLScanner.getImpliedClassName(c, source);
+ isClassNameGuessed = true;
} else {
className = XMLScanner.getDefaultClassName(c);
+ isClassNameGuessed = true;
}
}
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2008-10-22
15:33:12 UTC (rev 11082)
+++
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2008-10-22
15:40:40 UTC (rev 11083)
@@ -173,6 +173,7 @@
String className = getDefaultClassName(c);
if(className != null) {
component.setClassName(className);
+ component.setClassNameGuessed(true);
}
}
component.setScope(new XMLValueInfo(c, ISeamXmlComponentDeclaration.SCOPE));
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2008-10-22
15:33:12 UTC (rev 11082)
+++
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2008-10-22
15:40:40 UTC (rev 11083)
@@ -465,7 +465,11 @@
if(isEmptyLocation(location)) {
location = declaration;
}
- addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID,
SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME, new String[]{className}, location,
declaration.getResource());
+ if(!declaration.isClassNameGuessed()) {
+ addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID,
SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME, new String[]{className}, location,
declaration.getResource());
+ } else {
+ addError(UNKNOWN_COMPONENT_CLASS_NAME_MESSAGE_ID,
SeamPreferences.UNKNOWN_COMPONENT_CLASS_NAME_GUESS, new String[]{className}, location,
declaration.getResource());
+ }
return;
} else if(!type.isBinary()) {
validationContext.addLinkedCoreResource(componentName,
type.getResource().getFullPath());
Modified:
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2008-10-22
15:33:12 UTC (rev 11082)
+++
branches/jbosstools-3.0.0.Beta1/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationContext.java 2008-10-22
15:40:40 UTC (rev 11083)
@@ -280,6 +280,8 @@
if(variableName==null) {
throw new
IllegalArgumentException(SeamCoreMessages.SEAM_VALIDATION_CONTEXT_VARIABLE_NAME_MUST_NOT_BE_NULL);
}
+
+ synchronized(this) {
Set<IPath> linkedResources = resourcesByVariableName.get(variableName);
if(linkedResources==null) {
// create set of linked resources with variable name.
@@ -288,6 +290,7 @@
}
// save linked resources.
linkedResources.add(linkedResourcePath);
+ }
// Save link between resource and variable names. It's needed if variable name
changes in resource file.
Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
@@ -304,11 +307,13 @@
* @param linkedResourcePath
*/
public void removeLinkedResource(String name, IPath linkedResourcePath) {
+ synchronized(this) {
Set<IPath> linkedResources = resourcesByVariableName.get(name);
if(linkedResources!=null) {
// remove linked resource.
linkedResources.remove(linkedResourcePath);
}
+ }
// Remove link between resource and variable names.
Set<String> variableNames = variableNamesByResource.get(linkedResourcePath);
if(variableNames!=null) {
@@ -330,7 +335,7 @@
* Removes link between resource and variable names.
* @param linkedResources
*/
- public void removeLinkedResource(IPath resource) {
+ public synchronized void removeLinkedResource(IPath resource) {
Set<String> resourceNames = variableNamesByResource.get(resource);
if(resourceNames!=null) {
for (String name : resourceNames) {
@@ -350,7 +355,7 @@
return resourcesByVariableName.get(variableName);
}
- public Set<String> getVariableNamesByResource(IPath fullPath) {
+ public synchronized Set<String> getVariableNamesByResource(IPath fullPath) {
return variableNamesByResource.get(fullPath);
}
@@ -378,13 +383,13 @@
unnamedResources.remove(fullPath);
}
- public void clearAll() {
+ public synchronized void clearAll() {
resourcesByVariableName.clear();
variableNamesByResource.clear();
unnamedResources.clear();
}
- public void store(Element root) {
+ public synchronized void store(Element root) {
Set<String> variables = resourcesByVariableName.keySet();
for (String name: variables) {
Set<IPath> paths = resourcesByVariableName.get(name);