Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jpa
diff options
context:
space:
mode:
authorpfullbright2007-05-08 19:39:53 +0000
committerpfullbright2007-05-08 19:39:53 +0000
commite9ce8f955ec84c29a1bc93863b080ee098ff4959 (patch)
tree6670ceb444cf00ce78749826ba14be9a376da812 /jpa
parente747295bae27a785e99864e166629e874aa6acb1 (diff)
downloadwebtools.dali-e9ce8f955ec84c29a1bc93863b080ee098ff4959.tar.gz
webtools.dali-e9ce8f955ec84c29a1bc93863b080ee098ff4959.tar.xz
webtools.dali-e9ce8f955ec84c29a1bc93863b080ee098ff4959.zip
added check for in web project or referenced by ear before adding classpath attribute
Diffstat (limited to 'jpa')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
index 012a834b20..288e9b1261 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
@@ -20,6 +20,7 @@ import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
@@ -48,15 +49,22 @@ public class JpaFacetInstallDelegate
IClasspathEntry[] classpath = javaProject.getRawClasspath();
int newLength = classpath.length + 1;
boolean isWebApp = FacetedProjectFramework.hasProjectFacet(project, IModuleConstants.JST_WEB_MODULE);
- IClasspathAttribute depAttrib =
- JavaCore.newClasspathAttribute(
- IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY,
- ClasspathDependencyUtil.getDefaultRuntimePath(isWebApp).toString()
- );
+ IClasspathAttribute[] attributes;
+ if (! isWebApp && J2EEProjectUtilities.isStandaloneProject(project)) {
+ attributes = new IClasspathAttribute[0];
+ }
+ else {
+ attributes = new IClasspathAttribute[] {
+ JavaCore.newClasspathAttribute(
+ IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY,
+ ClasspathDependencyUtil.getDefaultRuntimePath(isWebApp).toString()
+ )
+ };
+ }
IClasspathEntry jpaLibraryEntry =
JavaCore.newContainerEntry(
new Path(JavaCore.USER_LIBRARY_CONTAINER_ID + "/" + jpaLibrary),
- null, new IClasspathAttribute[] {depAttrib}, true);
+ null, attributes, true);
IClasspathEntry[] newClasspath = new IClasspathEntry[newLength];
System.arraycopy(classpath, 0, newClasspath, 0, newLength - 1);
newClasspath[newLength - 1] = jpaLibraryEntry;

Back to the top