Author: scabanovich
Date: 2007-09-21 05:27:07 -0400 (Fri, 21 Sep 2007)
New Revision: 3753
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
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/SeamValidationHelper.java
Log:
JBIDE-922
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2007-09-21
07:57:02 UTC (rev 3752)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2007-09-21
09:27:07 UTC (rev 3753)
@@ -42,7 +42,7 @@
}
public IResource getResource() {
- return javaSource == null ? super.getResource() :
javaSource.getTypeRoot().getResource();
+ return javaSource == null || javaSource.getTypeRoot().getResource() == null ?
super.getResource() : javaSource.getTypeRoot().getResource();
}
public int getStartPosition() {
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-09-21
07:57:02 UTC (rev 3752)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2007-09-21
09:27:07 UTC (rev 3753)
@@ -206,24 +206,9 @@
}
private void validateFactory(ISeamFactory factory, Set<String>
markedDuplicateFactoryNames) {
-
- if(factory.getResource() == null) {
- IPath source = factory.getSourcePath();
- String name = factory.getName();
- String message = null;
- if(factory.getSeamProject() != null) {
- factory.getSeamProject().removeFactory(factory);
- message = "Seam core validator detected factory with null resource " +
"(name=" + name + " source=" + source + ").";
- } else {
- message = "Seam core validator detected factory with null resource " +
"(name=" + name + " source=" + source + ")" + " and
null parent in seam model.";
- }
- SeamCorePlugin.getPluginLog().logInfo(message);
+ if(coreHelper.isJar(factory.getSourcePath())) {
return;
}
-
- if(coreHelper.isJar(factory.getResource())) {
- return;
- }
if(factory instanceof ISeamAnnotatedFactory) {
validateAnnotatedFactory((ISeamAnnotatedFactory)factory,
markedDuplicateFactoryNames);
} else {
@@ -292,8 +277,8 @@
this.addError(DUPLICATE_VARIABLE_NAME_MESSAGE_ID,
SeamPreferences.DUPLICATE_VARIABLE_NAME, new String[]{factoryName}, location,
factory.getResource());
}
// mark duplicate variable
- IResource resource = coreHelper.getComponentResourceWithName(variable);
- if(!coreHelper.isJar(resource)) {
+ 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);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java 2007-09-21
07:57:02 UTC (rev 3752)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationHelper.java 2007-09-21
09:27:07 UTC (rev 3753)
@@ -18,6 +18,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
@@ -117,12 +118,12 @@
* @param resource
* @return true if resource is Jar file
*/
- public boolean isJar(IResource resource) {
- if(resource==null) {
+ public boolean isJar(IPath path) {
+ if(path == null) {
throw new IllegalArgumentException("Resource must not be null");
}
- String ext = resource.getFileExtension();
- return ext!=null && ext.equalsIgnoreCase("jar");
+ String ext = path.getFileExtension();
+ return ext != null && ext.equalsIgnoreCase("jar");
}
/**
@@ -130,7 +131,7 @@
* @return true if seam element packed in Jar file
*/
public boolean isJar(ISeamElement element) {
- return isJar(element.getResource());
+ return isJar(element.getSourcePath());
}
/**
Show replies by date