This commit was manufactured by cvs2svn to create tag 'R1_5_4'.
diff --git a/features/org.eclipse.jem-feature/.settings/org.eclipse.core.resources.prefs b/features/org.eclipse.jem-feature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..9b533a5
--- /dev/null
+++ b/features/org.eclipse.jem-feature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Sun Apr 15 21:19:46 EDT 2007
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/features/org.eclipse.jem-feature/feature.xml b/features/org.eclipse.jem-feature/feature.xml
index de66834..6b5168d 100644
--- a/features/org.eclipse.jem-feature/feature.xml
+++ b/features/org.eclipse.jem-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jem"
label="%featureName"
- version="1.2.1.qualifier"
+ version="1.2.4.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg">
diff --git a/plugins/org.eclipse.jem.beaninfo.ui/.project b/features/org.eclipse.jem-feature/org.eclipse.jem.sdk-feature/.project
similarity index 80%
rename from plugins/org.eclipse.jem.beaninfo.ui/.project
rename to features/org.eclipse.jem-feature/org.eclipse.jem.sdk-feature/.project
index 3898d56..c8f1a80 100644
--- a/plugins/org.eclipse.jem.beaninfo.ui/.project
+++ b/features/org.eclipse.jem-feature/org.eclipse.jem.sdk-feature/.project
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.jem.beaninfo.ui</name>
+ <name>org.eclipse.jem.sdk-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
-
</buildSpec>
<natures>
</natures>
diff --git a/features/org.eclipse.jem-feature/org.eclipse.jem.sdk-feature/feature.xml b/features/org.eclipse.jem-feature/org.eclipse.jem.sdk-feature/feature.xml
index 1ffe1c0..5e48d67 100644
--- a/features/org.eclipse.jem-feature/org.eclipse.jem.sdk-feature/feature.xml
+++ b/features/org.eclipse.jem-feature/org.eclipse.jem.sdk-feature/feature.xml
@@ -2,18 +2,18 @@
<feature
id="org.eclipse.jem.sdk"
label="%featureName"
- version="1.2.1.qualifier"
+ version="1.2.4.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg">
<description>
%description
</description>
-
+
<copyright>
%copyright
</copyright>
-
+
<license url="%licenseURL">
%license
</license>
diff --git a/features/org.eclipse.jem-feature/org.eclipse.jem.sdk/META-INF/MANIFEST.MF b/features/org.eclipse.jem-feature/org.eclipse.jem.sdk/META-INF/MANIFEST.MF
index 40fa8f4..ed89e9a 100644
--- a/features/org.eclipse.jem-feature/org.eclipse.jem.sdk/META-INF/MANIFEST.MF
+++ b/features/org.eclipse.jem-feature/org.eclipse.jem.sdk/META-INF/MANIFEST.MF
@@ -2,6 +2,6 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jem.sdk
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.2.4.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/features/org.eclipse.jst.doc.user.feature/feature.xml b/features/org.eclipse.jst.doc.user.feature/feature.xml
index 7d1c5c5..77e1a59 100644
--- a/features/org.eclipse.jst.doc.user.feature/feature.xml
+++ b/features/org.eclipse.jst.doc.user.feature/feature.xml
@@ -22,10 +22,6 @@
<update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates/"/>
</url>
- <requires>
- <import plugin="org.eclipse.help"/>
- </requires>
-
<plugin
id="org.eclipse.jst.ejb.doc.user"
download-size="0"
diff --git a/features/org.eclipse.jst.enterprise_core.feature/feature.xml b/features/org.eclipse.jst.enterprise_core.feature/feature.xml
index 1849281..1274492 100644
--- a/features/org.eclipse.jst.enterprise_core.feature/feature.xml
+++ b/features/org.eclipse.jst.enterprise_core.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.enterprise_core.feature"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.4.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.enterprise_core.feature/sourceTemplateFeature/feature.xml b/features/org.eclipse.jst.enterprise_core.feature/sourceTemplateFeature/feature.xml
index 403df7d..4c996bc 100644
--- a/features/org.eclipse.jst.enterprise_core.feature/sourceTemplateFeature/feature.xml
+++ b/features/org.eclipse.jst.enterprise_core.feature/sourceTemplateFeature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.enterprise_core.feature.source"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.4.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.enterprise_sdk.feature/feature.xml b/features/org.eclipse.jst.enterprise_sdk.feature/feature.xml
index 17d5e70..c44e1ce 100644
--- a/features/org.eclipse.jst.enterprise_sdk.feature/feature.xml
+++ b/features/org.eclipse.jst.enterprise_sdk.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.enterprise_sdk.feature"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.4.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.enterprise_ui.feature/feature.xml b/features/org.eclipse.jst.enterprise_ui.feature/feature.xml
index 3e2c6fa..288db5a 100644
--- a/features/org.eclipse.jst.enterprise_ui.feature/feature.xml
+++ b/features/org.eclipse.jst.enterprise_ui.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.enterprise_ui.feature"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.4.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.enterprise_ui.feature/sourceTemplateFeature/feature.xml b/features/org.eclipse.jst.enterprise_ui.feature/sourceTemplateFeature/feature.xml
index dec61d7..85c6ba4 100644
--- a/features/org.eclipse.jst.enterprise_ui.feature/sourceTemplateFeature/feature.xml
+++ b/features/org.eclipse.jst.enterprise_ui.feature/sourceTemplateFeature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.enterprise_ui.feature.source"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.4.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.enterprise_userdoc.feature/feature.xml b/features/org.eclipse.jst.enterprise_userdoc.feature/feature.xml
index a8de9b6..9cd3fee 100644
--- a/features/org.eclipse.jst.enterprise_userdoc.feature/feature.xml
+++ b/features/org.eclipse.jst.enterprise_userdoc.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.enterprise_userdoc.feature"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.3.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.web_core.feature/feature.xml b/features/org.eclipse.jst.web_core.feature/feature.xml
index f410dc8..4fba389 100644
--- a/features/org.eclipse.jst.web_core.feature/feature.xml
+++ b/features/org.eclipse.jst.web_core.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.web_core.feature"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.4.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.web_core.feature/sourceTemplateFeature/feature.xml b/features/org.eclipse.jst.web_core.feature/sourceTemplateFeature/feature.xml
index 4bc6292..0d953f8 100644
--- a/features/org.eclipse.jst.web_core.feature/sourceTemplateFeature/feature.xml
+++ b/features/org.eclipse.jst.web_core.feature/sourceTemplateFeature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.web_core.feature.source"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.4.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.web_sdk.feature/feature.xml b/features/org.eclipse.jst.web_sdk.feature/feature.xml
index 00dd307..50685d4 100644
--- a/features/org.eclipse.jst.web_sdk.feature/feature.xml
+++ b/features/org.eclipse.jst.web_sdk.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.web_sdk.feature"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.4.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.web_ui.feature/feature.xml b/features/org.eclipse.jst.web_ui.feature/feature.xml
index c27b885..818d135 100644
--- a/features/org.eclipse.jst.web_ui.feature/feature.xml
+++ b/features/org.eclipse.jst.web_ui.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.web_ui.feature"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.3.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.web_ui.feature/sourceTemplateFeature/feature.xml b/features/org.eclipse.jst.web_ui.feature/sourceTemplateFeature/feature.xml
index 129df68..1b083a7 100644
--- a/features/org.eclipse.jst.web_ui.feature/sourceTemplateFeature/feature.xml
+++ b/features/org.eclipse.jst.web_ui.feature/sourceTemplateFeature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.web_ui.feature.source"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.3.qualifier"
provider-name="%providerName">
<description>
diff --git a/features/org.eclipse.jst.web_userdoc.feature/feature.xml b/features/org.eclipse.jst.web_userdoc.feature/feature.xml
index 4aa0723..eb1401a 100644
--- a/features/org.eclipse.jst.web_userdoc.feature/feature.xml
+++ b/features/org.eclipse.jst.web_userdoc.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jst.web_userdoc.feature"
label="%featureName"
- version="1.6.0.qualifier"
+ version="1.5.3.qualifier"
provider-name="%providerName">
<description>
diff --git a/plugins/org.eclipse.jem.beaninfo.ui/OBSOLETE-moved to org.eclipse.jem.ui b/plugins/org.eclipse.jem.beaninfo.ui/OBSOLETE-moved to org.eclipse.jem.ui
deleted file mode 100644
index e69de29..0000000
--- a/plugins/org.eclipse.jem.beaninfo.ui/OBSOLETE-moved to org.eclipse.jem.ui
+++ /dev/null
diff --git a/plugins/org.eclipse.jem.beaninfo/META-INF/MANIFEST.MF b/plugins/org.eclipse.jem.beaninfo/META-INF/MANIFEST.MF
index 6276938..3f0019e 100644
--- a/plugins/org.eclipse.jem.beaninfo/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jem.beaninfo/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jem.beaninfo; singleton:=true
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 1.2.2.qualifier
Bundle-Activator: org.eclipse.jem.internal.beaninfo.core.BeaninfoPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoClassAdapter.java b/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoClassAdapter.java
index 6277c63..2572ccd 100644
--- a/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoClassAdapter.java
+++ b/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoClassAdapter.java
@@ -11,7 +11,7 @@
package org.eclipse.jem.internal.beaninfo.adapters;
/*
* $RCSfile: BeaninfoClassAdapter.java,v $
- * $Revision: 1.53 $ $Date: 2006/05/23 15:43:06 $
+ * $Revision: 1.54 $ $Date: 2006/10/27 19:35:27 $
*/
import java.io.FileNotFoundException;
@@ -2068,7 +2068,7 @@
sa.setAllOperationsCollectionModified(false); // Now built, so reset to not changed.
} finally {
synchronized(this) {
- isDoingAllProperties = false;
+ isDoingAllOperations = false;
}
}
}
diff --git a/plugins/org.eclipse.jem.workbench/.classpath b/plugins/org.eclipse.jem.workbench/.classpath
index 7682dad..8fd3a20 100644
--- a/plugins/org.eclipse.jem.workbench/.classpath
+++ b/plugins/org.eclipse.jem.workbench/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="workbench/"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="src" path="workbench/"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/org.eclipse.jem.workbench/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.jem.workbench/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..d7ce39e
--- /dev/null
+++ b/plugins/org.eclipse.jem.workbench/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Sun Apr 15 21:22:16 EDT 2007
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/plugins/org.eclipse.jem.workbench/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.jem.workbench/.settings/org.eclipse.jdt.core.prefs
index d78073f..aa19783 100644
--- a/plugins/org.eclipse.jem.workbench/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.jem.workbench/.settings/org.eclipse.jdt.core.prefs
@@ -1,11 +1,15 @@
-#Tue Feb 21 10:09:19 EST 2006
+#Sun Apr 15 21:31:38 EDT 2007
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -41,6 +45,7 @@
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/plugins/org.eclipse.jem.workbench/META-INF/MANIFEST.MF b/plugins/org.eclipse.jem.workbench/META-INF/MANIFEST.MF
index cfa026b..ceb0de0 100644
--- a/plugins/org.eclipse.jem.workbench/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jem.workbench/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jem.workbench; singleton:=true
-Bundle-Version: 1.2.1.qualifier
+Bundle-Version: 1.2.4.qualifier
Bundle-Activator: org.eclipse.jem.internal.plugin.JavaPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -16,3 +16,4 @@
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jem.util;bundle-version="[1.2.0,2.0.0)"
Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMAdaptor.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMAdaptor.java
index 372b839..d7f6e8e 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMAdaptor.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMAdaptor.java
@@ -11,7 +11,7 @@
package org.eclipse.jem.internal.adapters.jdom;
/*
* $RCSfile: JDOMAdaptor.java,v $
- * $Revision: 1.8 $ $Date: 2005/10/18 14:58:18 $
+ * $Revision: 1.9 $ $Date: 2007/01/30 14:39:13 $
*/
import java.io.File;
@@ -303,11 +303,18 @@
* Converts a type signature to a readable string.
*
* Uses Signature.toString(), then tries to undo bad replacement for inner classes.
+ *
+ * Bug: 166226 [https://bugs.eclipse.org/bugs/show_bug.cgi?id=166226]
+ * Update to use the erasure type from the signature in order to
+ * tolerate JDK 5 generics.
*
*/
public static String signatureToString(String signature) throws IllegalArgumentException {
boolean hasDollar = (signature.indexOf(Signature.C_DOLLAR) != -1);
- String result = Signature.toString(signature);
+ //begin 166226 fix
+ String result = Signature.getTypeErasure(signature);
+ result = Signature.toString(result);
+ //end 166226 fix
if (hasDollar) {
int newPos = result.lastIndexOf("."); //$NON-NLS-1$
if (newPos != -1) {
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaMethodJDOMAdaptor.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaMethodJDOMAdaptor.java
index 5497877..1c1af1a 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaMethodJDOMAdaptor.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JavaMethodJDOMAdaptor.java
@@ -10,7 +10,7 @@
*******************************************************************************/
/*
* $RCSfile: JavaMethodJDOMAdaptor.java,v $
- * $Revision: 1.14 $ $Date: 2005/10/18 14:58:18 $
+ * $Revision: 1.15.2.1 $ $Date: 2007/04/18 13:46:00 $
*/
package org.eclipse.jem.internal.adapters.jdom;
@@ -361,4 +361,108 @@
public void setSourceMethod(org.eclipse.jdt.core.IMethod newSourceMethod) {
sourceMethod = newSourceMethod;
}
+
+ /*
+ * Override to tolerate JDK 5 variable types.
+ * @see org.eclipse.jem.internal.adapters.jdom.JDOMAdaptor#typeNameFromSignature(java.lang.String)
+ */
+ protected String typeNameFromSignature(String typeSignature) {
+ String erasure = null;
+ try {
+ erasure = Signature.getTypeErasure(typeSignature);
+ } catch (IllegalArgumentException e) {
+ //The signature is not the correct format for a variable.
+ }
+ if (erasure != null) {
+ String variableName = null;
+ String resolvedVariable = null;
+
+ int arrayCount = Signature.getArrayCount(erasure);
+ if (arrayCount > 0) {
+ //We have an array. Check if the element type is a variable.
+ String elementTypeName = Signature.getElementType(erasure);
+ variableName = Signature.toString(elementTypeName);
+ resolvedVariable = resolveVariableName(erasure, variableName);
+ if (resolvedVariable != null) {
+ //Add array info.
+ StringBuffer b = new StringBuffer(resolvedVariable);
+ for (int i = 0; i < arrayCount; i++) {
+ b.append("[]"); //$NON-NLS-1$
+ }
+ resolvedVariable = b.toString();
+ }
+ } else {
+ variableName = Signature.toString(erasure);
+ //Need to resolve the variable.
+ resolvedVariable = resolveVariableName(erasure, variableName);
+ }
+ if (resolvedVariable == null) {
+ return super.typeNameFromSignature(erasure);
+ } else {
+ return resolvedVariable;
+ }
+ }
+ return super.typeNameFromSignature(typeSignature);
+ }
+
+
+ private String resolveVariableName(String erasure, String variableName) {
+ IMethod method = getSourceMethod();
+ ITypeParameter[] typeParameters = null;
+ try {
+ typeParameters = method.getTypeParameters();
+ } catch (JavaModelException e1) {
+ //Failed to retrieve type parameters for any number of reasons.
+ }
+ ITypeParameter typeParam = null;
+ if (typeParameters != null && typeParameters.length > 0) {
+ for (int i = 0; i < typeParameters.length; i++) {
+ if (typeParameters[i].exists() && variableName.equals(typeParameters[i].getElementName())) {
+ typeParam = typeParameters[i];
+ break;
+ }
+ }
+ if (typeParam != null) {
+ String[] bounds = null;
+ try {
+ bounds = typeParam.getBounds();
+ } catch (JavaModelException e) {}
+ if (bounds != null && bounds.length > 0) {
+ return JDOMSearchHelper.getResolvedTypeName(bounds[0], getType(), getTypeResolutionCache());
+ } else {
+ return "java.lang.Object";
+ }
+ }
+ }
+
+ IJavaElement parent = method.getParent();
+ if (parent instanceof IType)
+ {
+ try {
+ typeParameters = ((IType)parent).getTypeParameters();
+ } catch (JavaModelException e1) {
+ //Failed to retrieve type parameters for any number of reasons.
+ }
+ }
+ if (typeParameters != null && typeParameters.length > 0) {
+ for (int i = 0; i < typeParameters.length; i++) {
+ if (typeParameters[i].exists() && variableName.equals(typeParameters[i].getElementName())) {
+ typeParam = typeParameters[i];
+ break;
+ }
+ }
+ if (typeParam != null) {
+ String[] bounds = null;
+ try {
+ bounds = typeParam.getBounds();
+ } catch (JavaModelException e) {}
+ if (bounds != null && bounds.length > 0) {
+ return JDOMSearchHelper.getResolvedTypeName(bounds[0], getType(), getTypeResolutionCache());
+ } else {
+ return "java.lang.Object";
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/plugins/org.eclipse.jst.common.frameworks/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.common.frameworks/META-INF/MANIFEST.MF
index 29ac0f0..ee2c11c 100644
--- a/plugins/org.eclipse.jst.common.frameworks/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.common.frameworks/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.common.frameworks; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.4.qualifier
Bundle-Vendor: %pluginVendor
Bundle-Localization: plugin
Export-Package:
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java
index 880d15c..3252d14 100644
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java
+++ b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java
@@ -227,7 +227,7 @@
try
{
- contents = vf.members();
+ contents = members( vf );
}
catch( CoreException e )
{
@@ -275,6 +275,19 @@
return entries;
}
+
+ // TODO: This method was created to provide a safe last-minute workaround
+ // for the issue described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=162974.
+ // This code needs to be revisited in a future release to find a more
+ // permanent solution.
+
+ protected IVirtualResource[] members( final IVirtualFolder vf )
+
+ throws CoreException
+
+ {
+ return vf.members();
+ }
private IClasspathEntry newLibraryEntry( final IPath p )
{
diff --git a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetInstallDataModelProvider.java
index c404d7d..7ae6f53 100644
--- a/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetInstallDataModelProvider.java
+++ b/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/project/facet/JavaFacetInstallDataModelProvider.java
@@ -49,7 +49,7 @@
return JavaFacetUtils.JAVA_50;
} else if (SOURCE_FOLDER_NAME.equals(propertyName)) {
- return "src"; //$NON-NLS-1$
+ return ProductManager.getProperty(IProductConstants.DEFAULT_SOURCE_FOLDER);
} else if (DEFAULT_OUTPUT_FOLDER_NAME.equals(propertyName)) {
return ProductManager.getProperty(IProductConstants.OUTPUT_FOLDER);
}
diff --git a/plugins/org.eclipse.jst.j2ee.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.core/META-INF/MANIFEST.MF
index 49dbf98..354aaeb 100644
--- a/plugins/org.eclipse.jst.j2ee.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: J2EE Core Component
Bundle-SymbolicName: org.eclipse.jst.j2ee.core; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.53.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.core.internal.plugin.J2EECorePlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/impl/ArchiveCopySessionUtility.java b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/impl/ArchiveCopySessionUtility.java
index c515a38..c38f1ce 100644
--- a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/impl/ArchiveCopySessionUtility.java
+++ b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/impl/ArchiveCopySessionUtility.java
@@ -22,6 +22,7 @@
import org.eclipse.jem.java.JavaClass;
import org.eclipse.jst.j2ee.ejb.CMPAttribute;
import org.eclipse.jst.j2ee.ejb.ContainerManagedEntity;
+import org.eclipse.jst.j2ee.ejb.internal.impl.ContainerManagedEntityImpl;
import org.eclipse.jst.j2ee.internal.common.XMLResource;
import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopySession;
import org.eclipse.wst.common.internal.emf.utilities.EtoolsCopyUtility;
@@ -94,9 +95,11 @@
protected void copyReference(EReference aReference, EObject aRefObject, String idSuffix, EObject copyRef) {
if (aReference.isMany()) {
- List value = (List) aRefObject.eGet(aReference);
- if (value != null)
- copyManyReference(aReference, value, aRefObject, idSuffix, copyRef);
+ if (shouldCopyReference(aReference, aRefObject)) { // Bugzilla 177397
+ List value = (List) aRefObject.eGet(aReference);
+ if (value != null)
+ copyManyReference(aReference, value, aRefObject, idSuffix, copyRef);
+ }
} else if (aRefObject.eIsSet(aReference)) {
Object value = aRefObject.eGet(aReference);
if (value == null)
@@ -105,4 +108,40 @@
}
}
+ /**
+ * <p>Constant introduced for bugzilla 177397: The name of the CMP 'keyAttributes'
+ * attribute, which is not to be copied if in an uninitialized state.</p>
+ */
+
+ public static final String CMP_KEY_ATTRIBUTES_NAME = "keyAttributes";
+
+ /**
+ * <p>Test introduced for bugzilla 177397: Tell if a specified reference
+ * should be copied. This implementation checks for a CMP Bean, and for
+ * the key attributes attribute, and answers false when this attribute
+ * is in an uninitialized state.</p>
+ *
+ * <p>This attribute is initialized using reflection; there are copy cases
+ * where the parent EJB Jar does not have its full classpath environment
+ * available, which prevents the loading of dependent classes. Since the
+ * initialization is lazy, there is no need to resolve this when copying;
+ * access to the copy target can perform the initialization.</p>
+ *
+ * @param aReference The reference attribute being copied.
+ * @param aRefObject The model object being copied.
+ *
+ * @return True if the reference attribute is to be copied.
+ * False if the reference attribute is not to be copied.
+ */
+
+ protected boolean shouldCopyReference(EReference aReference, EObject aRefObject)
+ {
+ if ( !(aRefObject instanceof ContainerManagedEntityImpl) ||
+ !aReference.getName().equals(CMP_KEY_ATTRIBUTES_NAME) )
+ return true;
+
+ ContainerManagedEntityImpl cmpBean = (ContainerManagedEntityImpl) aRefObject;
+
+ return cmpBean.getIsInitializedKeyAttributes();
+ }
}
diff --git a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/DirectoryLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/DirectoryLoadStrategyImpl.java
index 474788c..96939b0 100644
--- a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/DirectoryLoadStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/DirectoryLoadStrategyImpl.java
@@ -214,17 +214,33 @@
return path;
}
- private String makeRelative(String fileName, String root) {
- if (fileName == null || root == null)
- return null;
- String name = null;
- for (; root.endsWith("/"); root = ArchiveUtil.truncateIgnoreCase(root, "/")); //$NON-NLS-1$ //$NON-NLS-2$
- name = replaceSeparators(fileName);
- if (name.startsWith(root))
- name = name.substring(root.length() + 1);
- else
- name = null;
- return name;
+ private String makeRelative(String fileName, String root)
+ {
+ if ( (fileName == null) || (root == null) )
+ return null;
+
+ int offset = root.length();
+
+ while ( (offset > 0) && root.charAt(offset - 1) == '/' )
+ offset--;
+
+ if ( offset < root.length() ) {
+ offset++;
+
+ if ( offset < root.length() )
+ root = root.substring(0, offset);
+ } else {
+ root += '/';
+ }
+
+ String name = replaceSeparators(fileName);
+
+ if ( name.startsWith(root) )
+ name = name.substring( root.length() );
+ else
+ name = null;
+
+ return name;
}
/**
diff --git a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/LoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/LoadStrategyImpl.java
index 4986be9..7c21ae1 100644
--- a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/LoadStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/LoadStrategyImpl.java
@@ -370,7 +370,24 @@
rs.setURIConverter(converter);
if (archive.shouldUseJavaReflection()) {
rs.getAdapterFactories().add(new JavaJDKAdapterFactory());
- archive.initializeClassLoader();
+
+ // TFB: Problem here:
+ // 'Archive.initializeClassLoader' calls
+ // 'Archive.getJavaAdapterFactory', which
+ // 'Archive.getResourceSet', which calls
+ // 'LoadStrategy.initializeResourceSet', which calls
+ // 'Archive.initializeClassLoader' all over again.
+ //
+ // This creates a second, redundant classloader,
+ // and places the first classloader in the JavaJDKAdapterFactory.
+ // Hence not only is the classloader created twice, but
+ // both copies are active. When there are large classpaths,
+ // this will large duplicate structures.
+ //
+ // Since the classloader will be initialized by 'getClassLoader',
+ // the initialization, here, seems unnecessary.
+
+ // archive.initializeClassLoader();
}
}
diff --git a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/ZipFileLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/ZipFileLoadStrategyImpl.java
index 5f9c188..7452cad 100644
--- a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/ZipFileLoadStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/strategy/ZipFileLoadStrategyImpl.java
@@ -21,6 +21,7 @@
import java.util.zip.ZipFile;
import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
/**
@@ -32,7 +33,7 @@
public class ZipFileLoadStrategyImpl extends LoadStrategyImpl {
protected java.io.File file;
protected ZipFile zipFile;
-
+
/**
* ZipFileLoadStrategy constructor comment.
*/
@@ -96,7 +97,7 @@
aFile.setLastModified(entry.getTime());
list.add(aFile);
}
- } else {
+ } else if(includeEmptyDirectories) {
File aFile = createDirectory(entry.getName());
aFile.setDirectoryEntry(true);
aFile.setSize(entry.getSize());
@@ -158,4 +159,30 @@
public void setZipFile(java.util.zip.ZipFile newZipFile) {
zipFile = newZipFile;
}
+
+ /**
+ * This field is used to determine whether empty directories should be included in the
+ * file list of this archive. The default value is set to {@link #ArchiveUtil.INCLUDE_EMPTY_DIRECTORIES}
+ */
+ private boolean includeEmptyDirectories = ArchiveUtil.INCLUDE_EMPTY_DIRECTORIES;
+
+ /**
+ * If this value has not been set, the default is defined by {@link #ArchiveUtil.INCLUDE_EMPTY_DIRECTORIES}.
+ *
+ * If this value is <code>true></code> then empty directories will be included in {@link #getFiles()}.
+ *
+ * @see #setIncludeEmptyDirectories(boolean)
+ */
+ public boolean isIncludeEmptyDirectories() {
+ return includeEmptyDirectories;
+ }
+
+ /**
+ * If this value has not been set, the default is defined by {@link #ArchiveUtil.INCLUDE_EMPTY_DIRECTORIES}.
+ *
+ * @see #isIncludeEmptyDirectories()
+ */
+ public void setIncludeEmptyDirectories(boolean includeEmptyDirectories) {
+ this.includeEmptyDirectories = includeEmptyDirectories;
+ }
}
diff --git a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/ArchiveFileDynamicClassLoader.java b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/ArchiveFileDynamicClassLoader.java
index eb945c2..7fa4133 100644
--- a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/ArchiveFileDynamicClassLoader.java
+++ b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/ArchiveFileDynamicClassLoader.java
@@ -18,6 +18,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
+import java.security.ProtectionDomain;
import java.util.HashSet;
import java.util.Set;
@@ -33,24 +34,44 @@
* classes and those in the set are the only classes needed to resolve each one)
*/
-public class ArchiveFileDynamicClassLoader extends ClassLoader {
+public class ArchiveFileDynamicClassLoader extends ClassLoader {
protected Archive archive = null;
protected ClassLoader extraClassLoader;
protected boolean inEARFile;
private static final String URL_PROTOCOL = "archive";
private ArchiveURLStreamHandler handler;
+
+ protected ProtectionDomain protectionDomain;
+
+ /**
+ * <p>This constructor accepts a protection domain, which is used
+ * by <code>findClass</code>.</p>
+ *
+ * @see ArchiveFileDynamicClassLoader#findClass(String)
+ */
+
+ public ArchiveFileDynamicClassLoader(Archive anArchive, ClassLoader parentCl, ClassLoader extraCl, ProtectionDomain pDomain) {
+ super(parentCl);
+ setArchive(anArchive);
+ setExtraClassLoader(extraCl);
+ inEARFile = anArchive.getContainer() != null && anArchive.getContainer().isEARFile();
+ handler = new ArchiveURLStreamHandler();
+ protectionDomain = pDomain;
+ }
- public ArchiveFileDynamicClassLoader(Archive anArchive, ClassLoader parentCl, ClassLoader extraCl) {
- super(parentCl);
- setArchive(anArchive);
- setExtraClassLoader(extraCl);
- inEARFile = anArchive.getContainer() != null && anArchive.getContainer().isEARFile();
- handler = new ArchiveURLStreamHandler();
+ public ArchiveFileDynamicClassLoader(Archive anArchive, ClassLoader parentCl, ClassLoader extraCl) {
+ this(anArchive, parentCl, extraCl, null);
}
/**
- * Loads a specified class. This gets called only after the parent class loader has had it's
- * chance, based on the Java2 delegation model
+ * <p>Loads a specified class. Called only after the parent class loader has had
+ * its chance to load the class, as per the Java2 delegation model.</p>
+ *
+ * <p>When non-null, the receiver's protection
+ * domain is passed in to the call to <code>defineClass</code>.</p>
+ *
+ * @see ClassLoader#defineClass(String, byte[], int)
+ * @see ClassLoader#defineClass(String, byte[], int, ProtectionDomain)
*/
protected Class findClass(String name) throws ClassNotFoundException {
@@ -59,7 +80,11 @@
byte[] bytes = getClassBytesFor(name);
if (bytes != null) {
- result = defineClass(name, bytes, 0, bytes.length);
+ if ( protectionDomain == null ) {
+ result = defineClass(name, bytes, 0, bytes.length);
+ } else {
+ result = defineClass(name, bytes, 0, bytes.length, protectionDomain);
+ }
if (result == null) {
throw new ClassNotFoundException(name);
} // endif
diff --git a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/ArchiveUtil.java b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/ArchiveUtil.java
index 2735294..d1599fd 100644
--- a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/ArchiveUtil.java
+++ b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/ArchiveUtil.java
@@ -37,12 +37,14 @@
import org.eclipse.jst.j2ee.application.Module;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonArchiveResourceHandler;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.Container;
import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleFile;
import org.eclipse.jst.j2ee.commonarchivecore.internal.ModuleRef;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ArchiveException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.EmptyResourceException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveURIConverterImpl;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ZipFileLoadStrategyImpl;
import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.common.XMLResource;
@@ -85,6 +87,14 @@
protected static String tempDirectoryName;
protected static java.io.File tempDirectory;
+
+ /**
+ * Flag to indicate whether empty directories should be included during import; defaults to true.
+ *
+ * @see ZipFileLoadStrategyImpl#isIncludeEmptyDirectories()
+ */
+ public static boolean INCLUDE_EMPTY_DIRECTORIES = true;
+
public static String classNameToJavaUri(String className) {
return className.replace('.', '/').concat(DOT_JAVA);
@@ -199,6 +209,40 @@
}
/**
+ * <p>Alternate method for resolving class path entries.</p>
+ *
+ * <p>Note: Not sure what this is for, as a classpath
+ * entry such as "../targetJar.jar" seems invalid, as it
+ * reaches outside of the EAR directory.</p>
+ *
+ * <p>While this method will remove "./" from a classpath entry,
+ * it will not remove "../", which will be added back when
+ * deresolving the entry. There is no meaningful name to assign
+ * to an entity outside of the fileset of the container.</p>
+ *
+ * <p>This implementation uses eclipse URI function, as opposed to the
+ * implementation in <code>deriveEARRelativeURI</code>.</p>
+ *
+ * @param classpathEntry The class-path entry which is to be resolved.
+ * @param container The container against which to resolve the entry.
+ *
+ * @return The text of the resolved entry.
+ */
+
+ public static String deriveRelativeURI(String classpathEntry, Container container)
+ {
+ URI containerURI = URI.createFileURI( container.getURI() );
+ // 'container.getURI()' returns a string.
+
+ URI entryURI = URI.createFileURI(classpathEntry);
+
+ URI resolvedURI = entryURI.resolve(containerURI);
+ URI recoveredURI = resolvedURI.deresolve(containerURI);
+
+ return recoveredURI.toFileString();
+ }
+
+ /**
* Leverage the java.io.File apis to resolve things like "./xxx" and "../xxx" into uris of
* entries in the ear file
*
@@ -232,36 +276,15 @@
String parent = getFileNameParent(archiveUri);
if (parent == null || parent.equals("")) //$NON-NLS-1$
parent = "."; //$NON-NLS-1$
- String workingDir = new java.io.File(".").getCanonicalPath().toLowerCase(); //$NON-NLS-1$
-
- String resolvedPath = new java.io.File(parent, classpathEntry).getCanonicalPath().toLowerCase();
+ String workingDir = new java.io.File(".").getCanonicalPath(); //$NON-NLS-1$
+
+ String resolvedPath = new java.io.File(parent, classpathEntry).getCanonicalPath();
if (!resolvedPath.startsWith(workingDir))
return null;
if (resolvedPath.equals(workingDir))
return null;
int start = workingDir.endsWith(java.io.File.separator) ? workingDir.length() : workingDir.length() + 1;
- String lowerCaseEntry = resolvedPath.substring(start, resolvedPath.length()).replace(java.io.File.separatorChar, '/');
-
- char [] newEntry = lowerCaseEntry.toCharArray();
- char [] oldEntry = classpathEntry.replace(java.io.File.separatorChar, '/').toCharArray();
- int newIndex = 0;
- int oldIndex = 0;
- while(newIndex < newEntry.length && oldIndex < oldEntry.length){
- char c1 = newEntry[newIndex];
- char c2 = oldEntry[oldIndex];
- if(c1 == c2){
- newIndex ++;
- oldIndex ++;
- } else if(Character.toUpperCase(c1) == c2){
- newEntry[newIndex] = c2;
- newIndex ++;
- oldIndex ++;
- } else {
- oldIndex ++;
- }
- }
- String newEntryStr = new String(newEntry);
- return newEntryStr;
+ return resolvedPath.substring(start, resolvedPath.length()).replace(java.io.File.separatorChar, '/');
} catch (java.io.IOException ex) {
//getCanonicalPath could throw this
return null;
diff --git a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/RarFileDynamicClassLoader.java b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/RarFileDynamicClassLoader.java
index c7a26ab..832c099 100644
--- a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/RarFileDynamicClassLoader.java
+++ b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/RarFileDynamicClassLoader.java
@@ -16,15 +16,19 @@
*/
package org.eclipse.jst.j2ee.commonarchivecore.internal.util;
+import java.security.ProtectionDomain;
import java.util.List;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
import org.eclipse.jst.j2ee.commonarchivecore.internal.RARFile;
-
public class RarFileDynamicClassLoader extends ArchiveFileDynamicClassLoader {
+ public RarFileDynamicClassLoader(Archive anArchive, ClassLoader parentCl, ClassLoader extraCl, ProtectionDomain pDomain) {
+ super(anArchive, parentCl, extraCl, pDomain);
+ }
+
public RarFileDynamicClassLoader(Archive anArchive, ClassLoader parentCl, ClassLoader extraCl) {
super(anArchive, parentCl, extraCl);
}
diff --git a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/WarFileDynamicClassLoader.java b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/WarFileDynamicClassLoader.java
index e59c6a2..1c24c72 100644
--- a/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/WarFileDynamicClassLoader.java
+++ b/plugins/org.eclipse.jst.j2ee.core/commonArchive/org/eclipse/jst/j2ee/commonarchivecore/internal/util/WarFileDynamicClassLoader.java
@@ -16,6 +16,7 @@
*/
package org.eclipse.jst.j2ee.commonarchivecore.internal.util;
+import java.security.ProtectionDomain;
import java.util.List;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
@@ -35,10 +36,14 @@
private boolean allowLoadingFromWAR = true;
- public WarFileDynamicClassLoader(Archive anArchive, ClassLoader parentCl, ClassLoader extraCl) {
- super(anArchive, parentCl, extraCl);
+ public WarFileDynamicClassLoader(Archive anArchive, ClassLoader parentCl, ClassLoader extraCl, ProtectionDomain pDomain) {
+ super(anArchive, parentCl, extraCl, pDomain);
allowLoadingFromWAR = anArchive.getOptions().getClassLoadingMode() == ArchiveOptions.LOAD_MODE_COMPAT;
}
+
+ public WarFileDynamicClassLoader(Archive anArchive, ClassLoader parentCl, ClassLoader extraCl) {
+ this(anArchive, parentCl, extraCl, null);
+ }
protected File getFile(String name) {
//search classes directory first, then war, then nested archives.
diff --git a/plugins/org.eclipse.jst.j2ee.core/j2ee-validation/org/eclipse/jst/j2ee/model/internal/validation/EarValidator.java b/plugins/org.eclipse.jst.j2ee.core/j2ee-validation/org/eclipse/jst/j2ee/model/internal/validation/EarValidator.java
index 056ab44..efc2f3a 100644
--- a/plugins/org.eclipse.jst.j2ee.core/j2ee-validation/org/eclipse/jst/j2ee/model/internal/validation/EarValidator.java
+++ b/plugins/org.eclipse.jst.j2ee.core/j2ee-validation/org/eclipse/jst/j2ee/model/internal/validation/EarValidator.java
@@ -401,13 +401,9 @@
validateAppClientRefs(ref);
} catch (ArchiveWrappedException ex) {
Exception nested = ex.getNestedException();
- if (!(nested instanceof NoModuleFileException)) {
- //Logger.getLogger().logError(ex);
- String[] params = new String[1];
- params[0] = ref.getUri();
- addError(EREF_CATEGORY, ERROR_MODULE_DD_FILE_NOT_FOUND, params);
- }
- //otherwise ignore it; there are other validations for this
+ String[] params = new String[1];
+ params[0] = ref.getUri();
+ addError(EREF_CATEGORY, ERROR_MODULE_DD_FILE_NOT_FOUND, params);
}
}
diff --git a/plugins/org.eclipse.jst.j2ee.core/j2ee-validation/org/eclipse/jst/j2ee/model/internal/validation/WarValidator.java b/plugins/org.eclipse.jst.j2ee.core/j2ee-validation/org/eclipse/jst/j2ee/model/internal/validation/WarValidator.java
index b7dbc98..f2d05ec 100644
--- a/plugins/org.eclipse.jst.j2ee.core/j2ee-validation/org/eclipse/jst/j2ee/model/internal/validation/WarValidator.java
+++ b/plugins/org.eclipse.jst.j2ee.core/j2ee-validation/org/eclipse/jst/j2ee/model/internal/validation/WarValidator.java
@@ -176,7 +176,55 @@
if (httpMethods == null) { // Need to construct the Hashtable, once
- String[] mList = {"GET", "PUT", "HEAD", "TRACE", "POST", "DELETE", "OPTIONS"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ String[] mList = {
+ "GET", //$NON-NLS-1$
+ "PUT", //$NON-NLS-1$
+ "HEAD", //$NON-NLS-1$
+ "TRACE", //$NON-NLS-1$
+ "POST", //$NON-NLS-1$
+ "DELETE", //$NON-NLS-1$
+ "OPTIONS", //$NON-NLS-1$
+ //WEBDAV
+ "ACK", //$NON-NLS-1$
+ "ACL", //$NON-NLS-1$
+ "BASELINE-CONTROL", //$NON-NLS-1$
+ "BIND", //$NON-NLS-1$
+ "BYE", //$NON-NLS-1$
+ "CANCEL", //$NON-NLS-1$
+ "CHECKIN", //$NON-NLS-1$
+ "CHECKOUT", //$NON-NLS-1$
+ "COPY", //$NON-NLS-1$
+ "ERRORRESPONSE", //$NON-NLS-1$
+ "INFO", //$NON-NLS-1$
+ "INVITE", //$NON-NLS-1$
+ "LABEL", //$NON-NLS-1$
+ "LOCK", //$NON-NLS-1$
+ "MERGE", //$NON-NLS-1$
+ "MESSAGE", //$NON-NLS-1$
+ "MKACTIVITY", //$NON-NLS-1$
+ "MKCOL", //$NON-NLS-1$
+ "MKWORKSPACE", //$NON-NLS-1$
+ "MOVE", //$NON-NLS-1$
+ "NOTIFY", //$NON-NLS-1$
+ "PRACK", //$NON-NLS-1$
+ "PROPFIND", //$NON-NLS-1$
+ "PROPPATCH", //$NON-NLS-1$
+ "PROVISIONALRESPONSE", //$NON-NLS-1$
+ "PUBLISH", //$NON-NLS-1$
+ "REBIND", //$NON-NLS-1$
+ "REDIRECTRESPONSE", //$NON-NLS-1$
+ "REGISTER", //$NON-NLS-1$
+ "REPORT", //$NON-NLS-1$
+ "REQUEST", //$NON-NLS-1$
+ "RESPONSE", //$NON-NLS-1$
+ "SEARCH", //$NON-NLS-1$
+ "SUCCESSRESPONSE", //$NON-NLS-1$
+ "UNBIND", //$NON-NLS-1$
+ "UNCHECKOUT", //$NON-NLS-1$
+ "UNLOCK", //$NON-NLS-1$
+ "UPDATE", //$NON-NLS-1$
+ "VERSION-CONTROL"//$NON-NLS-1$
+ };
httpMethods = new Hashtable();
for (int i = 0; i < mList.length; i++)
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/ejb/internal/impl/ContainerManagedEntityImpl.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/ejb/internal/impl/ContainerManagedEntityImpl.java
index cea1c3e..2d4467d 100644
--- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/ejb/internal/impl/ContainerManagedEntityImpl.java
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/ejb/internal/impl/ContainerManagedEntityImpl.java
@@ -525,6 +525,24 @@
}
/**
+ * <p>Change for bugzilla 177397. Provide access to the
+ * initialization state of the key attributes attribute.</p>
+ *
+ * <p>The initialization state is used while copying the
+ * receiver. If the key attributes attribute has not been
+ * initialized, then the copy does not need to descend into the
+ * key attributes.</p>
+ *
+ * @return True if the key attributes have been initialized.
+ * Otherwise, false.
+ *
+ * @generated NOT
+ */
+ public boolean getIsInitializedKeyAttributes() {
+ return (keyAttributes == null);
+ }
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/J2EEConstants.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/J2EEConstants.java
index 670a7da..f762c68 100644
--- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/J2EEConstants.java
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/J2EEConstants.java
@@ -30,6 +30,7 @@
/** "WEB-INF" */
String WEB_INF = "WEB-INF"; //$NON-NLS-1$
String WEB_INF_CLASSES = "WEB-INF/classes"; //$NON-NLS-1$
+ String WEB_INF_LIB = "WEB-INF/lib"; //$NON-NLS-1$
/** "ALT-INF" */
String ALT_INF = "ALT-INF"; //$NON-NLS-1$
//Application client info
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/WrappedException.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/WrappedException.java
index 9748f44..545d29b 100644
--- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/WrappedException.java
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/WrappedException.java
@@ -51,6 +51,13 @@
return nestedException;
}
/**
+ * Added to provide compatibility for the Java 1.4.2 addition of
+ * <code>Throwable.getCause()</code>.
+ */
+public java.lang.Throwable getCause() {
+ return getNestedException();
+}
+/**
* Print out a stack trace to the system err.
*/
public void printStackTrace() {
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/WrappedRuntimeException.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/WrappedRuntimeException.java
index 5949505..8892279 100644
--- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/WrappedRuntimeException.java
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/WrappedRuntimeException.java
@@ -55,6 +55,14 @@
return nestedException;
}
/**
+ * Added to provide compatibility for the Java 1.4.2 addition of
+ * <code>Throwable.getCause()</code>.
+ * @return The nested exception held by the receiver.
+ */
+public java.lang.Throwable getCause() {
+ return getNestedException();
+}
+/**
* Print out a stack trace to the system err.
*/
public void printStackTrace() {
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebAppTranslator.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebAppTranslator.java
index 86a6452..0cb07c5 100644
--- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebAppTranslator.java
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/internal/model/translator/webapplication/WebAppTranslator.java
@@ -328,6 +328,7 @@
public static Translator createFilterMapping13Translator() {
GenericTranslator result = new GenericTranslator(FILTER_MAPPING, WEBAPP_PKG.getWebApp_FilterMappings());
result.setChildren(new Translator[] {
+ IDTranslator.INSTANCE,
new SourceLinkTranslator(FILTER_NAME, WEBAPP_PKG.getFilterMapping_Filter(),
new TranslatorPath(new Translator[] {
new Translator(WEB_APP, Translator.CONTAINER_FEATURE),
@@ -433,6 +434,7 @@
public static Translator createServletMappingTranslator() {
GenericTranslator result = new GenericTranslator(SERVLET_MAPPING, WEBAPP_PKG.getWebApp_ServletMappings());
result.setChildren(new Translator[] {
+ IDTranslator.INSTANCE,
new SourceLinkTranslator(SERVLET_NAME, WEBAPP_PKG.getServletMapping_Servlet(),
new TranslatorPath(new Translator[] {
new Translator(WEB_APP, CONTAINER_FEATURE),
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/HTTPMethodTypeEnum.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/HTTPMethodTypeEnum.java
index 2f7c041..1af202b 100644
--- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/HTTPMethodTypeEnum.java
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/HTTPMethodTypeEnum.java
@@ -106,6 +106,48 @@
*/
public static final int TRACE = 6;
+ public static final int ACL = 7;
+ public static final int BASELINE_CONTROL = 8;
+ public static final int BIND = 9;
+ public static final int CHECKIN = 10;
+ public static final int CHECKOUT = 11;
+ public static final int LABEL = 12;
+ public static final int MERGE = 13;
+ public static final int MKACTIVITY = 14;
+ public static final int MKWORKSPACE = 15;
+ public static final int REBIND = 16;
+ public static final int REPORT = 17;
+ public static final int SEARCH = 18;
+ public static final int UNBIND = 19;
+ public static final int UNCHECKOUT = 20;
+ public static final int UPDATE = 21;
+ public static final int VERSION_CONTROL = 22;
+ public static final int ACK = 23;
+ public static final int BYE = 24;
+ public static final int CANCEL = 25;
+ public static final int COPY = 26;
+ public static final int ERRORRESPONSE = 27;
+ public static final int INFO = 28;
+ public static final int INVITE = 29;
+ public static final int LOCK = 30;
+ public static final int MESSAGE = 31;
+ public static final int MKCOL = 32;
+ public static final int MOVE = 33;
+ public static final int NOTIFY = 34;
+ public static final int PRACK = 35;
+ public static final int PROPFIND = 36;
+ public static final int PROPPATCH = 37;
+ public static final int PROVISIONALRESPONSE = 38;
+ public static final int PUBLISH = 39;
+ public static final int REDIRECTRESPONSE = 40;
+ public static final int REGISTER = 41;
+ public static final int REQUEST = 42;
+ public static final int RESPONSE = 43;
+ public static final int SUCCESSRESPONSE = 44;
+ public static final int UNLOCK = 45;
+
+
+
/**
* The '<em><b>GET</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -204,6 +246,48 @@
*/
public static final HTTPMethodTypeEnum TRACE_LITERAL = new HTTPMethodTypeEnum(TRACE, "TRACE", "TRACE");//$NON-NLS-1$
+ //WEBDAV support
+ public static final HTTPMethodTypeEnum ACK_LITERAL = new HTTPMethodTypeEnum(ACK, "ACK", "ACK"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum ACL_LITERAL = new HTTPMethodTypeEnum(ACL, "ACL", "ACL"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum BASELINE_CONTROL_LITERAL = new HTTPMethodTypeEnum(BASELINE_CONTROL, "BASELINE-CONTROL", "BASELINE-CONTROL"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum BIND_LITERAL = new HTTPMethodTypeEnum(BIND, "BIND", "BIND"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum BYE_LITERAL = new HTTPMethodTypeEnum(BYE, "BYE", "BYE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum CANCEL_LITERAL = new HTTPMethodTypeEnum(CANCEL, "CANCEL", "CANCEL"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum CHECKIN_LITERAL = new HTTPMethodTypeEnum(CHECKIN, "CHECKIN", "CHECKIN"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum CHECKOUT_LITERAL = new HTTPMethodTypeEnum(CHECKOUT, "CHECKOUT", "CHECKOUT"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum ERRORRESPONSE_LITERAL = new HTTPMethodTypeEnum(ERRORRESPONSE, "ERRORRESPONSE", "ERRORRESPONSE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum INFO_LITERAL = new HTTPMethodTypeEnum(INFO, "INFO", "INFO"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum INVITE_LITERAL = new HTTPMethodTypeEnum(INVITE, "INVITE", "INVITE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum LABEL_LITERAL = new HTTPMethodTypeEnum(LABEL, "LABEL", "LABEL"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum LOCK_LITERAL = new HTTPMethodTypeEnum(LOCK, "LOCK", "LOCK"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum MERGE_LITERAL = new HTTPMethodTypeEnum(MERGE, "MERGE", "MERGE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum MESSAGE_LITERAL = new HTTPMethodTypeEnum(MESSAGE, "MESSAGE", "MESSAGE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum MKACTIVITY_LITERAL = new HTTPMethodTypeEnum(MKACTIVITY, "MKACTIVITY", "MKACTIVITY"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum MKCOL_LITERAL = new HTTPMethodTypeEnum(MKCOL, "MKCOL", "MKCOL"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum MKWORKSPACE_LITERAL = new HTTPMethodTypeEnum(MKWORKSPACE, "MKWORKSPACE", "MKWORKSPACE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum MOVE_LITERAL = new HTTPMethodTypeEnum(MOVE, "MOVE", "MOVE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum NOTIFY_LITERAL = new HTTPMethodTypeEnum(NOTIFY, "NOTIFY", "NOTIFY"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum PRACK_LITERAL = new HTTPMethodTypeEnum(PRACK, "PRACK", "PRACK"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum PROPFIND_LITERAL = new HTTPMethodTypeEnum(PROPFIND, "PROPFIND", "PROPFIND"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum PROPPATCH_LITERAL = new HTTPMethodTypeEnum(PROPPATCH, "PROPPATCH", "PROPPATCH"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum PROVISIONALRESPONSE_LITERAL = new HTTPMethodTypeEnum(PROVISIONALRESPONSE, "PROVISIONALRESPONSE", "PROVISIONALRESPONSE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum PUBLISH_LITERAL = new HTTPMethodTypeEnum(PUBLISH, "PUBLISH", "PUBLISH"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum REBIND_LITERAL = new HTTPMethodTypeEnum(REBIND, "REBIND", "REBIND"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum REDIRECTRESPONSE_LITERAL = new HTTPMethodTypeEnum(REDIRECTRESPONSE, "REDIRECTRESPONSE", "REDIRECTRESPONSE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum REGISTER_LITERAL = new HTTPMethodTypeEnum(REGISTER, "REGISTER", "REGISTER"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum REPORT_LITERAL = new HTTPMethodTypeEnum(REPORT, "REPORT", "REPORT"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum REQUEST_LITERAL = new HTTPMethodTypeEnum(REQUEST, "REQUEST", "REQUEST"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum RESPONSE_LITERAL = new HTTPMethodTypeEnum(RESPONSE, "RESPONSE", "RESPONSE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum SEARCH_LITERAL = new HTTPMethodTypeEnum(SEARCH, "SEARCH", "SEARCH"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum SUCCESSRESPONSE_LITERAL = new HTTPMethodTypeEnum(SUCCESSRESPONSE, "SUCCESSRESPONSE", "SUCCESSRESPONSE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum UNBIND_LITERAL = new HTTPMethodTypeEnum(UNBIND, "UNBIND", "UNBIND"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum UNCHECKOUT_LITERAL = new HTTPMethodTypeEnum(UNCHECKOUT, "UNCHECKOUT", "UNCHECKOUT"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum UNLOCK_LITERAL = new HTTPMethodTypeEnum(UNLOCK, "UNLOCK", "UNLOCK"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum UPDATE_LITERAL = new HTTPMethodTypeEnum(UPDATE, "UPDATE", "UPDATE"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum VERSION_CONTROL_LITERAL = new HTTPMethodTypeEnum(VERSION_CONTROL, "VERSION-CONTROL", "VERSION-CONTROL"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final HTTPMethodTypeEnum COPY_LITERAL = new HTTPMethodTypeEnum(COPY, "COPY", "COPY"); //$NON-NLS-1$ //$NON-NLS-2$
+
+
/**
* An array of all the '<em><b>HTTP Method Type Enum</b></em>' enumerators.
* <!-- begin-user-doc -->
@@ -219,6 +303,46 @@
HEAD_LITERAL,
OPTIONS_LITERAL,
TRACE_LITERAL,
+ //WEBDAV support
+ ACK_LITERAL,
+ ACL_LITERAL,
+ BASELINE_CONTROL_LITERAL,
+ BIND_LITERAL,
+ BYE_LITERAL,
+ CANCEL_LITERAL,
+ CHECKIN_LITERAL,
+ CHECKOUT_LITERAL,
+ COPY_LITERAL,
+ ERRORRESPONSE_LITERAL,
+ INFO_LITERAL,
+ INVITE_LITERAL,
+ LABEL_LITERAL,
+ LOCK_LITERAL,
+ MERGE_LITERAL,
+ MESSAGE_LITERAL,
+ MKACTIVITY_LITERAL,
+ MKCOL_LITERAL,
+ MKWORKSPACE_LITERAL,
+ MOVE_LITERAL,
+ NOTIFY_LITERAL,
+ PRACK_LITERAL,
+ PROPFIND_LITERAL,
+ PROPPATCH_LITERAL,
+ PROVISIONALRESPONSE_LITERAL,
+ PUBLISH_LITERAL,
+ REBIND_LITERAL,
+ REDIRECTRESPONSE_LITERAL,
+ REGISTER_LITERAL,
+ REPORT_LITERAL,
+ REQUEST_LITERAL,
+ RESPONSE_LITERAL,
+ SEARCH_LITERAL,
+ SUCCESSRESPONSE_LITERAL,
+ UNBIND_LITERAL,
+ UNCHECKOUT_LITERAL,
+ UNLOCK_LITERAL,
+ UPDATE_LITERAL,
+ VERSION_CONTROL_LITERAL
};
/**
@@ -280,6 +404,46 @@
case HEAD: return HEAD_LITERAL;
case OPTIONS: return OPTIONS_LITERAL;
case TRACE: return TRACE_LITERAL;
+ //WEBDAV support
+ case ACK : return ACK_LITERAL;
+ case ACL : return ACL_LITERAL;
+ case BASELINE_CONTROL : return BASELINE_CONTROL_LITERAL;
+ case BIND : return BIND_LITERAL;
+ case BYE : return BYE_LITERAL;
+ case CANCEL : return CANCEL_LITERAL;
+ case CHECKIN : return CHECKIN_LITERAL;
+ case CHECKOUT : return CHECKOUT_LITERAL;
+ case COPY : return COPY_LITERAL;
+ case ERRORRESPONSE : return ERRORRESPONSE_LITERAL;
+ case INFO : return INFO_LITERAL;
+ case INVITE : return INVITE_LITERAL;
+ case LABEL : return LABEL_LITERAL;
+ case LOCK : return LOCK_LITERAL;
+ case MERGE : return MERGE_LITERAL;
+ case MESSAGE : return MESSAGE_LITERAL;
+ case MKACTIVITY : return MKACTIVITY_LITERAL;
+ case MKCOL : return MKCOL_LITERAL;
+ case MKWORKSPACE : return MKWORKSPACE_LITERAL;
+ case MOVE : return MOVE_LITERAL;
+ case NOTIFY : return NOTIFY_LITERAL;
+ case PRACK : return PRACK_LITERAL;
+ case PROPFIND : return PROPFIND_LITERAL;
+ case PROPPATCH : return PROPPATCH_LITERAL;
+ case PROVISIONALRESPONSE : return PROVISIONALRESPONSE_LITERAL;
+ case PUBLISH : return PUBLISH_LITERAL;
+ case REBIND : return REBIND_LITERAL;
+ case REDIRECTRESPONSE : return REDIRECTRESPONSE_LITERAL;
+ case REGISTER : return REGISTER_LITERAL;
+ case REPORT : return REPORT_LITERAL;
+ case REQUEST : return REQUEST_LITERAL;
+ case RESPONSE : return RESPONSE_LITERAL;
+ case SEARCH : return SEARCH_LITERAL;
+ case SUCCESSRESPONSE : return SUCCESSRESPONSE_LITERAL;
+ case UNBIND : return UNBIND_LITERAL;
+ case UNCHECKOUT : return UNCHECKOUT_LITERAL;
+ case UNLOCK : return UNLOCK_LITERAL;
+ case UPDATE : return UPDATE_LITERAL;
+ case VERSION_CONTROL : return VERSION_CONTROL_LITERAL;
}
return null;
}
diff --git a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/internal/impl/WebapplicationPackageImpl.java b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/internal/impl/WebapplicationPackageImpl.java
index 5cf4986..31e1bf5 100644
--- a/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/internal/impl/WebapplicationPackageImpl.java
+++ b/plugins/org.eclipse.jst.j2ee.core/mofj2ee/org/eclipse/jst/j2ee/webapplication/internal/impl/WebapplicationPackageImpl.java
@@ -1828,7 +1828,50 @@
addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.HEAD_LITERAL);
addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.OPTIONS_LITERAL);
addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.TRACE_LITERAL);
+ //WEBDAV support
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.ACK_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.ACL_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.BASELINE_CONTROL_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.BIND_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.BYE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.CANCEL_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.CHECKIN_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.CHECKOUT_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.COPY_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.ERRORRESPONSE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.INFO_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.INVITE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.LABEL_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.LOCK_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.MERGE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.MESSAGE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.MKACTIVITY_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.MKCOL_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.MKWORKSPACE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.MOVE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.NOTIFY_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.PRACK_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.PROPFIND_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.PROPPATCH_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.PROVISIONALRESPONSE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.PUBLISH_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.REBIND_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.REDIRECTRESPONSE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.REGISTER_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.REPORT_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.REQUEST_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.RESPONSE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.SEARCH_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.SUCCESSRESPONSE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.UNBIND_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.UNCHECKOUT_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.UNLOCK_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.UPDATE_LITERAL);
+ addEEnumLiteral(httpMethodTypeEnumEEnum, HTTPMethodTypeEnum.VERSION_CONTROL_LITERAL);
+
+
+
initEEnum(transportGuaranteeTypeEEnum, TransportGuaranteeType.class, "TransportGuaranteeType");
addEEnumLiteral(transportGuaranteeTypeEEnum, TransportGuaranteeType.NONE_LITERAL);
addEEnumLiteral(transportGuaranteeTypeEEnum, TransportGuaranteeType.INTEGRAL_LITERAL);
diff --git a/plugins/org.eclipse.jst.j2ee.jca/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.jca/META-INF/MANIFEST.MF
index 4e992ed..54850f4 100644
--- a/plugins/org.eclipse.jst.j2ee.jca/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.jca/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.j2ee.jca; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.4.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.jca.internal.plugin.JcaPlugin
Bundle-Vendor: %pluginVendor
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/ConnectorFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/ConnectorFacetInstallDelegate.java
index 7102679..7ec6fb2 100644
--- a/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/ConnectorFacetInstallDelegate.java
+++ b/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/ConnectorFacetInstallDelegate.java
@@ -51,8 +51,6 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
public class ConnectorFacetInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate {
@@ -83,7 +81,7 @@
final IVirtualComponent c = ComponentCore.createComponent(project);
c.create(0, null);
- c.setMetaProperty("java-output-path", ProductManager.getProperty(IProductConstants.OUTPUT_FOLDER)); //$NON-NLS-1$
+ setOutputFolder(model, c);
final IVirtualFolder root = c.getRootFolder();
IFolder sourceFolder = null;
diff --git a/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/ConnectorFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/ConnectorFacetProjectCreationDataModelProvider.java
index 3f43281..e9b5bf3 100644
--- a/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/ConnectorFacetProjectCreationDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/ConnectorFacetProjectCreationDataModelProvider.java
@@ -24,6 +24,7 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.ProductManager;
public class ConnectorFacetProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider {
@@ -38,7 +39,11 @@
map.add(javaFacet);
IDataModel jcaFacet = DataModelFactory.createDataModel(new ConnectorFacetInstallDataModelProvider());
map.add(jcaFacet);
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME,jcaFacet.getStringProperty(IConnectorFacetInstallDataModelProperties.CONFIG_FOLDER));
+ String jcaRoot = jcaFacet.getStringProperty(IConnectorFacetInstallDataModelProperties.CONFIG_FOLDER);
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, jcaRoot);
+ // If using optimized single root structure, set the output folder to the content folder
+ if (ProductManager.shouldUseSingleRootStructure())
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, jcaRoot);
jcaFacet.addListener(new IDataModelListener() {
public void propertyChanged(DataModelEvent event) {
if (IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME.equals(event.getPropertyName())) {
diff --git a/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/IConnectorFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/IConnectorFacetInstallDataModelProperties.java
index fbdf2ba..72b30e2 100644
--- a/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/IConnectorFacetInstallDataModelProperties.java
+++ b/plugins/org.eclipse.jst.j2ee.jca/jca/org/eclipse/jst/j2ee/jca/project/facet/IConnectorFacetInstallDataModelProperties.java
@@ -15,4 +15,8 @@
public interface IConnectorFacetInstallDataModelProperties
extends IJ2EEModuleFacetInstallDataModelProperties{
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = ConnectorFacetInstallDataModelProvider.class;
}
diff --git a/plugins/org.eclipse.jst.j2ee.jca/jcaedit/org/eclipse/jst/j2ee/internal/jca/archive/operations/ConnectorComponentExportOperation.java b/plugins/org.eclipse.jst.j2ee.jca/jcaedit/org/eclipse/jst/j2ee/internal/jca/archive/operations/ConnectorComponentExportOperation.java
index 11c0ed7..7af8340 100644
--- a/plugins/org.eclipse.jst.j2ee.jca/jcaedit/org/eclipse/jst/j2ee/internal/jca/archive/operations/ConnectorComponentExportOperation.java
+++ b/plugins/org.eclipse.jst.j2ee.jca/jcaedit/org/eclipse/jst/j2ee/internal/jca/archive/operations/ConnectorComponentExportOperation.java
@@ -13,12 +13,14 @@
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
+import org.eclipse.jst.j2ee.internal.archive.operations.AppClientArchiveOpsResourceHandler;
import org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation;
-import org.eclipse.jst.j2ee.internal.plugin.J2EEPluginResourceHandler;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
public class ConnectorComponentExportOperation extends J2EEArtifactExportOperation {
@@ -32,14 +34,20 @@
}
protected void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
+ IProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, EXPORT_WORK);
try {
CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory();
ConnectorComponentLoadStrategyImpl ls = new ConnectorComponentLoadStrategyImpl(getComponent());
ls.setExportSource(isExportSource());
setModuleFile(caf.openRARFile(ls, getDestinationPath().toOSString()));
+ ls.setProgressMonitor(subMonitor);
getModuleFile().saveAsNoReopen(getDestinationPath().toOSString());
+ } catch (SaveFailureException ex) {
+ throw ex;
} catch (Exception e) {
- throw new SaveFailureException(J2EEPluginResourceHandler.Error_opening_archive_for_export_2, e);
+ throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e);
+ } finally {
+ subMonitor.done();
}
}
diff --git a/plugins/org.eclipse.jst.j2ee.jca/jcaedit/org/eclipse/jst/j2ee/internal/jca/archive/operations/ConnectorComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.jca/jcaedit/org/eclipse/jst/j2ee/internal/jca/archive/operations/ConnectorComponentLoadStrategyImpl.java
index 79288e4..2d38d32 100644
--- a/plugins/org.eclipse.jst.j2ee.jca/jcaedit/org/eclipse/jst/j2ee/internal/jca/archive/operations/ConnectorComponentLoadStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee.jca/jcaedit/org/eclipse/jst/j2ee/internal/jca/archive/operations/ConnectorComponentLoadStrategyImpl.java
@@ -11,10 +11,14 @@
package org.eclipse.jst.j2ee.internal.jca.archive.operations;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -106,19 +110,20 @@
int sourceContainerSegmentCount = sourceContainer.getProjectRelativePath().segmentCount();
boolean isModuleRoot = knownDD.getProjectRelativePath().toString().startsWith(sourceContainer.getProjectRelativePath().toString());
- List iFiles = new ArrayList();
- boolean foundJava = gatherFilesForJAR(iFiles, sourceContainer, isModuleRoot, false, sourceContainerSegmentCount);
+ Set iFilesSet = new HashSet();
+ boolean foundJava = gatherFilesForJAR(iFilesSet, sourceContainer, isModuleRoot, false, sourceContainerSegmentCount);
if (!isModuleRoot || foundJava) {
- for (int i = 0; i < iFiles.size(); i++) {
- filesHolder.removeIFile((IFile) iFiles.get(i));
+ List iFilesList = Collections.list(Collections.enumeration(iFilesSet));
+ for (int i = 0; i < iFilesList.size(); i++) {
+ filesHolder.removeIFile((IFile) iFilesList.get(i));
}
- File nestedArchive = createNestedArchive(iFiles, sourceContainer, javaOutputFolder);
+ File nestedArchive = createNestedArchive(iFilesList, sourceContainer, javaOutputFolder);
return nestedArchive;
}
return null;
}
- private boolean gatherFilesForJAR(List iFiles, IContainer current, boolean isModuleRoot, boolean foundJava, int sourceContainerSegmentCount) {
+ private boolean gatherFilesForJAR(Collection iFiles, IContainer current, boolean isModuleRoot, boolean foundJava, int sourceContainerSegmentCount) {
IResource[] members;
try {
members = current.members();
@@ -134,7 +139,7 @@
if (belongsInNestedJAR(srcFile, isModuleRoot)) {
if (isJava(srcFile)) {
if (exportSource) {
- iFiles.add(srcFile);
+ iFiles.add(srcFile); //don't need to check duplicates here
}
String className = srcFile.getProjectRelativePath().removeFirstSegments(sourceContainerSegmentCount).toString();
className = className.substring(0, className.length() - dotJavaLength);
@@ -143,11 +148,17 @@
Iterator iterator = classes.iterator();
while (iterator.hasNext()) {
IFile clazz = (IFile) iterator.next();
- iFiles.add(clazz);
+ if(!iFiles.contains(clazz)){
+ //.class need to check for duplicates
+ iFiles.add(clazz);
+ }
}
}
} else {
- iFiles.add(srcFile);
+ if(!iFiles.contains(srcFile)){
+ //if it's not src, then it could be .class and need to check for duplicates
+ iFiles.add(srcFile);
+ }
}
if (isModuleRoot)
foundJava = foundJava || isJava(srcFile) || isClass(srcFile);
diff --git a/plugins/org.eclipse.jst.j2ee.navigator.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.navigator.ui/META-INF/MANIFEST.MF
index 3b6d190..41596ae 100644
--- a/plugins/org.eclipse.jst.j2ee.navigator.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.navigator.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.jst.j2ee.navigator.ui; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.2.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.navigator.internal.plugin.J2EENavigatorPlugin
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.navigator.ui/j2ee-navigator/org/eclipse/jst/j2ee/navigator/internal/dnd/ImportJ2EEModuleDropAssistant.java b/plugins/org.eclipse.jst.j2ee.navigator.ui/j2ee-navigator/org/eclipse/jst/j2ee/navigator/internal/dnd/ImportJ2EEModuleDropAssistant.java
index ea85dc0..a07688e 100644
--- a/plugins/org.eclipse.jst.j2ee.navigator.ui/j2ee-navigator/org/eclipse/jst/j2ee/navigator/internal/dnd/ImportJ2EEModuleDropAssistant.java
+++ b/plugins/org.eclipse.jst.j2ee.navigator.ui/j2ee-navigator/org/eclipse/jst/j2ee/navigator/internal/dnd/ImportJ2EEModuleDropAssistant.java
@@ -19,7 +19,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
@@ -27,7 +26,6 @@
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jst.j2ee.application.internal.operations.EARComponentImportDataModelProvider;
-import org.eclipse.jst.j2ee.application.internal.operations.J2EEUtilityJarImportDataModelProvider;
import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientComponentImportDataModelProvider;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
@@ -37,29 +35,31 @@
import org.eclipse.jst.j2ee.internal.navigator.ui.Messages;
import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentImportDataModelProvider;
import org.eclipse.jst.j2ee.navigator.internal.plugin.J2EENavigatorPlugin;
-import org.eclipse.jst.j2ee.project.facet.EARFacetUtils;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.CopyFilesAndFoldersOperation;
import org.eclipse.ui.navigator.CommonDropAdapter;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
public class ImportJ2EEModuleDropAssistant extends AddProjectToEARDropAssistant {
public boolean isSupportedType(TransferData aTransferType) {
return FileTransfer.getInstance().isSupportedType(aTransferType);
}
-
+
public IStatus handleDrop(CommonDropAdapter aDropAdapter, final DropTargetEvent aDropTargetEvent, final Object aTarget) {
+
if(FileTransfer.getInstance().isSupportedType(aDropAdapter.getCurrentTransfer())) {
+ final Shell shell = getShell();
+
IProgressService service = PlatformUI.getWorkbench().getProgressService();
Job importArtifactsJob = new Job(Messages.ImportJ2EEModuleDropAssistant_Importing_Java_Enterprise_Edition_artifacts) {
protected IStatus run(IProgressMonitor monitor) {
@@ -78,10 +78,14 @@
SubProgressMonitor submonitor = new SubProgressMonitor(monitor, 10);
IDataModel importDataModel = null;
+ boolean performSimpleJarCopy = false;
+ List simpleJarsToCopyList = null;
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
List createdComponents = new ArrayList();
for(int i=0; i<names.length && !monitor.isCanceled(); i++) {
try {
+ importDataModel = null;
+ performSimpleJarCopy = false;
int separatorIndex = names[i].lastIndexOf(File.separatorChar);
int dotIndex = names[i].lastIndexOf('.');
if(separatorIndex > 0 && separatorIndex+1 < dotIndex) {
@@ -104,8 +108,14 @@
importDataModel = DataModelFactory.createDataModel(new AppClientComponentImportDataModelProvider());
else if(archive.isEJBJarFile())
importDataModel = DataModelFactory.createDataModel(new EJBComponentImportDataModelProvider());
- else
- importDataModel = DataModelFactory.createDataModel(new J2EEUtilityJarImportDataModelProvider());
+ else {
+ performSimpleJarCopy = true; //handle Utility jars as regular jars.
+ if(simpleJarsToCopyList == null){
+ simpleJarsToCopyList = new ArrayList();
+ simpleJarsToCopyList.add(names[i]);
+ }
+ }
+
} finally {
if(archive != null)
archive.close();
@@ -119,7 +129,7 @@
createdComponents.add((IVirtualComponent) importDataModel.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT));
- } else {
+ } else if(!performSimpleJarCopy){
status.add(J2EENavigatorPlugin.createErrorStatus(0, NLS.bind(Messages.ImportJ2EEModuleDropAssistant_Could_not_recognize_extension_0_, extension), null));
}
@@ -129,6 +139,7 @@
status.add(J2EENavigatorPlugin.createErrorStatus(0, msg, e));
}
}
+
if(targetEARProject != null) {
List createdModuleProjects = new ArrayList();
for(int i=0; i<createdComponents.size(); i++) {
@@ -149,23 +160,34 @@
String msg = e.getMessage() != null ? e.getMessage() : e.toString();
status.add(J2EENavigatorPlugin.createErrorStatus(0, msg, null));
}
-
+ //copy the simpleJarsOver
+ if(simpleJarsToCopyList != null ){
+ try{
+ final String [] jarsToCopyArray = new String[simpleJarsToCopyList.size()];
+ simpleJarsToCopyList.toArray(jarsToCopyArray);
+
+ CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
+ operation.copyFilesInCurrentThread(jarsToCopyArray, targetEARProject, monitor);
+ }catch (Throwable e) {
+ String msg = e.getMessage() != null ? e.getMessage() : e.toString();
+ status.add(J2EENavigatorPlugin.createErrorStatus(0, msg, e));
+ }
+ }
}
+
return status;
}
};
+
service.showInDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), importArtifactsJob);
importArtifactsJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
importArtifactsJob.schedule();
-
-
return Status.OK_STATUS;
}
return Status.CANCEL_STATUS;
}
-
public IStatus validateDrop(Object target, int operation, TransferData transferType) {
IStatus status = Status.CANCEL_STATUS;
diff --git a/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF
index 0cd5131..db06ff2 100644
--- a/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: WTP J2EE UI Plug-in
Bundle-SymbolicName: org.eclipse.jst.j2ee.ui; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.3.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AddModulestoEARPropertiesPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AddModulestoEARPropertiesPage.java
index 888c857..f7f3a9e 100644
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AddModulestoEARPropertiesPage.java
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/AddModulestoEARPropertiesPage.java
@@ -49,6 +49,7 @@
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties;
@@ -208,6 +209,10 @@
refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent);
refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetCompList);
+
+ // referenced java projects should have archiveName attribute
+ ((Map)refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP)).put(targetcomponent, proj.getName() + IJ2EEModuleConstants.JAR_EXT);
+
refdm.getDefaultOperation().execute(monitor, null);
j2eeComponentList.add(targetcomponent);
}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEComponentProjectMigrator.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEComponentProjectMigrator.java
index 536efdb..c6b9321 100644
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEComponentProjectMigrator.java
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/J2EEComponentProjectMigrator.java
@@ -66,6 +66,7 @@
import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.SimpleValidateEdit;
import org.eclipse.wst.project.facet.SimpleWebFacetInstallDataModelProvider;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.ServerCore;
@@ -94,14 +95,19 @@
public void migrateProject(IProject aProject) {
if (aProject.isAccessible()) {
- project = aProject;
- removeComponentBuilders(project);
- if (multipleComponentsDetected())
- createNewProjects();
- String facetid = getFacetFromProject(project);
- if (facetid.length() == 0)
- addFacets(project);
- J2EEComponentClasspathUpdater.getInstance().queueUpdate(project);
+ final List files = new ArrayList();
+ files.add(aProject.getFile(J2EEProjectUtilities.DOT_PROJECT));
+ files.add(aProject.getFile(J2EEProjectUtilities.DOT_CLASSPATH));
+ if(SimpleValidateEdit.validateEdit(files)){
+ project = aProject;
+ removeComponentBuilders(project);
+ if (multipleComponentsDetected())
+ createNewProjects();
+ String facetid = getFacetFromProject(project);
+ if (facetid.length() == 0)
+ addFacets(project);
+ J2EEComponentClasspathUpdater.getInstance().queueUpdate(project);
+ }
}
ensureJ2EEContentExtensionsEnabled();
}
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/JARDependencyPropertiesPage.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/JARDependencyPropertiesPage.java
index 6a5606f..5363015 100644
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/JARDependencyPropertiesPage.java
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/JARDependencyPropertiesPage.java
@@ -40,7 +40,6 @@
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection;
import org.eclipse.jst.j2ee.application.internal.operations.ClasspathElement;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
@@ -335,7 +334,9 @@
table.setLayout(tableLayout);
table.setHeaderVisible(true);
table.setLinesVisible(true);
- availableJARsViewer.setSorter(new ViewerSorter());
+
+ // do not create sorter otherwise order will go wrong
+ //availableJARsViewer.setSorter(new ViewerSorter());
// table columns
TableColumn fileNameColumn = new TableColumn(table, SWT.NONE, 0);
diff --git a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java
index b75ed21..0cd33cb 100644
--- a/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java
+++ b/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/StringArrayTableWizardSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * Copyright (c) 2003, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
*******************************************************************************/
package org.eclipse.jst.j2ee.internal.wizard;
@@ -118,6 +119,7 @@
// set focus
texts[0].setFocus();
+ Dialog.applyDialogFont(parent);
return composite;
}
diff --git a/plugins/org.eclipse.jst.j2ee.web/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.web/META-INF/MANIFEST.MF
index 77d807b..07e6d2f 100644
--- a/plugins/org.eclipse.jst.j2ee.web/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.web/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Web Plug-in
Bundle-SymbolicName: org.eclipse.jst.j2ee.web; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.3.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
index 2cb7bde..3e1ab4b 100644
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentExportOperation.java
@@ -13,6 +13,8 @@
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
@@ -32,17 +34,22 @@
}
protected void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
+ IProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, EXPORT_WORK);
try {
CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory();
WebComponentLoadStrategyImpl ls = new WebComponentLoadStrategyImpl(getComponent());
ls.setExportSource(isExportSource());
setModuleFile(caf.openWARFile(ls, getDestinationPath().toOSString()));
+ ls.setProgressMonitor(subMonitor);
getModuleFile().saveAsNoReopen(getDestinationPath().toOSString());
} catch (SaveFailureException ex) {
throw ex;
} catch (Exception e) {
throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e);
- } }
+ } finally {
+ subMonitor.done();
+ }
+ }
protected String archiveString() {
return "War File";
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
index 9d11229..222edf7 100644
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentImportOperation.java
@@ -20,7 +20,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
@@ -43,15 +43,38 @@
super(model);
}
+ protected final int LINK_COMPONENTS_WORK = 10;
+ protected final int LIB_FOLDER_WORK = 2;
+
+ protected int computeTotalWork() {
+ int baseWork = super.computeTotalWork() + LIB_FOLDER_WORK;
+ List selectedLibs = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
+ List libProjects = (List) model.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_MODELS);
+ IDataModel importModel = null;
+ IVirtualComponent nestedComponent = null;
+ Archive libArchive = null;
+ for (int i = 0; null != libProjects && i < libProjects.size(); i++) {
+ importModel = (IDataModel) libProjects.get(i);
+ libArchive = (Archive) importModel.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
+ if (selectedLibs.contains(libArchive)) {
+ baseWork += LINK_COMPONENTS_WORK + PROJECT_CREATION_WORK + libArchive.getFiles().size();
+ }
+ }
+
+ return baseWork;
+ }
+
protected void doExecute(IProgressMonitor monitor) throws ExecutionException {
super.doExecute(monitor);
IVirtualFolder libFolder = virtualComponent.getRootFolder().getFolder(WebArtifactEdit.WEBLIB);
if (!libFolder.exists()) {
try {
- libFolder.create(IResource.FORCE, new NullProgressMonitor());
+ libFolder.create(IResource.FORCE, new SubProgressMonitor(monitor, LIB_FOLDER_WORK));
} catch (CoreException e) {
Logger.getLogger().logError(e);
}
+ } else {
+ monitor.worked(LIB_FOLDER_WORK);
}
try {
importWebLibraryProjects(monitor);
@@ -74,7 +97,7 @@
importModel = (IDataModel) libProjects.get(i);
libArchive = (Archive) importModel.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
if (selectedLibs.contains(libArchive)) {
- importModel.getDefaultOperation().execute(monitor, info);
+ importModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, PROJECT_CREATION_WORK + libArchive.getFiles().size()) , info);
nestedComponent = (IVirtualComponent) importModel.getProperty(IJ2EEComponentImportDataModelProperties.COMPONENT);
targetComponents.add(nestedComponent);
String archiveURI = libArchive.getURI();
@@ -96,7 +119,7 @@
createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, "/WEB-INF/lib/"); //$NON-NLS-1$
createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetComponents);
createRefComponentsModel.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, compToURIMap);
- createRefComponentsModel.getDefaultOperation().execute(monitor, info);
+ createRefComponentsModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, LINK_COMPONENTS_WORK * targetComponents.size()), info);
}
}
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
index 23aa5c1..c086aa8 100644
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebComponentSaveStrategyImpl.java
@@ -11,7 +11,6 @@
package org.eclipse.jst.j2ee.internal.web.archive.operations;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IFile;
@@ -23,7 +22,6 @@
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveConstants;
import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
import org.eclipse.jst.j2ee.internal.archive.operations.J2EEComponentSaveStrategyImpl;
-import org.eclipse.jst.j2ee.web.datamodel.properties.IWebComponentImportDataModelProperties;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
@@ -34,14 +32,6 @@
super(vComponent);
}
- protected boolean shouldLinkAsComponentRef(Archive archive) {
- if (null != dataModel) {
- List list = (List) dataModel.getProperty(IWebComponentImportDataModelProperties.WEB_LIB_ARCHIVES_SELECTED);
- return !list.contains(archive);
- }
- return true;
- }
-
/**
* DoNotUseMeThisWillBeDeletedPost15
*
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java
index cb6ad94..db7fdb5 100644
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebFacetProjectCreationDataModelProvider.java
@@ -15,6 +15,7 @@
import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
import org.eclipse.jst.j2ee.project.facet.J2EEFacetProjectCreationDataModelProvider;
@@ -26,6 +27,7 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.ProductManager;
public class WebFacetProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider {
@@ -40,7 +42,12 @@
map.add(javaFacet);
IDataModel webFacet = DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
map.add(webFacet);
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME,webFacet.getStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER));
+ String webRoot = webFacet.getStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER);
+ String webSrc = webFacet.getStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER);
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, webSrc);
+ // If using optimized single root structure, set the output folder to "<content folder>/WEB-INF/classes"
+ if (ProductManager.shouldUseSingleRootStructure())
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, webRoot+"/"+J2EEConstants.WEB_INF_CLASSES); //$NON-NLS-1$
webFacet.addListener(new IDataModelListener() {
public void propertyChanged(DataModelEvent event) {
if (IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME.equals(event.getPropertyName())) {
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
index 13fb000..c4a5351 100644
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebPropertiesUtil.java
@@ -13,7 +13,6 @@
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
-import com.ibm.icu.util.StringTokenizer;
import java.util.Vector;
import org.eclipse.core.resources.IContainer;
@@ -42,6 +41,8 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import com.ibm.icu.util.StringTokenizer;
+
public class WebPropertiesUtil {
// private static final char[] BAD_CHARS = {'/', '\\', ':'};
private static final char[] BAD_CHARS = {':'};
@@ -526,7 +527,10 @@
public static IFolder getModuleServerRoot(IProject project) {
// TODO need to implement module server root properly
- return project.getFolder("WebContent");
+ IPath compRootPath = ComponentCore.createComponent(project).getRootFolder().getUnderlyingFolder().getProjectRelativePath();
+ return project.getFolder(compRootPath);
+ //return project.getFolder("WebContent");
+
}
public static IVirtualFolder getWebLibFolder(IVirtualComponent webComponent) {
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java
index f779cb8..d4eafbf 100644
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/IWebFacetInstallDataModelProperties.java
@@ -10,13 +10,16 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.web.project.facet;
+import org.eclipse.jst.j2ee.internal.web.archive.operations.WebFacetProjectCreationDataModelProvider;
import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
-
-
public interface IWebFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties {
-
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = WebFacetProjectCreationDataModelProvider.class;
+
public static final String CONTEXT_ROOT = "IWebFacetInstallDataModelProperties.CONTEXT_ROOT"; //$NON-NLS-1$
public static final String SOURCE_FOLDER = "IWebFacetInstallDataModelProperties.SOURCE_FOLDER"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java
index 9e33506..4fe3359 100644
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDataModelProvider.java
@@ -14,6 +14,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin;
@@ -61,6 +62,17 @@
} else if (FACET_PROJECT_NAME.equals(propertyName)) {
model.notifyPropertyChange(CONTEXT_ROOT, IDataModel.VALID_VALUES_CHG);
} else if (propertyName.equals(CONFIG_FOLDER)) {
+ // If using optimized single root structure, update the output folder based on content folder change
+ // The output folder will be "<contentRoot>/WEB-INF/classes"
+ if (ProductManager.shouldUseSingleRootStructure()) {
+ IDataModel masterModel = (IDataModel) model.getProperty(MASTER_PROJECT_DM);
+ if (masterModel != null) {
+ FacetDataModelMap map = (FacetDataModelMap) masterModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
+ IDataModel javaModel = map.getFacetDataModel(IModuleConstants.JST_JAVA);
+ if (javaModel != null)
+ javaModel.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME,propertyValue+"/"+J2EEConstants.WEB_INF_CLASSES); //$NON-NLS-1$
+ }
+ }
return true;
} else if (propertyName.equals(SOURCE_FOLDER)) {
IDataModel masterModel = (IDataModel) model.getProperty(MASTER_PROJECT_DM);
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java
index 60473cf..cf5cced 100644
--- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java
+++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/web/project/facet/WebFacetInstallDelegate.java
@@ -12,6 +12,8 @@
package org.eclipse.jst.j2ee.web.project.facet;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
@@ -26,6 +28,7 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.common.project.facet.WtpUtils;
import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
@@ -86,7 +89,7 @@
String contextRoot = model.getStringProperty(IWebFacetInstallDataModelProperties.CONTEXT_ROOT);
setContextRootPropertyIfNeeded(c, contextRoot);
- setJavaOutputPropertyIfNeeded(c);
+ setJavaOutputPropertyIfNeeded(model,c);
final IVirtualFolder webroot = c.getRootFolder();
if (webroot.getProjectRelativePath().equals(new Path("/"))) //$NON-NLS-1$
@@ -152,10 +155,71 @@
}
}
- private void setJavaOutputPropertyIfNeeded(final IVirtualComponent c) {
+ private void setJavaOutputPropertyIfNeeded(IDataModel model, final IVirtualComponent c) {
+
+ // Make sure output folder is set properly for web projects, and the product setting for single root structure is maintained.
+ // We may need to change the existing setup
+
+ if (ProductManager.shouldUseSingleRootStructure()) {
+ String outputFolder = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)+"/"+J2EEConstants.WEB_INF_CLASSES;
+
+ IJavaProject jproj = JavaCore.create(c.getProject());
+ IClasspathEntry[] current = null;
+ boolean webinf = false;
+ IPath pjpath = c.getProject().getFullPath();
+ try {
+ current = jproj.getRawClasspath();
+ List updatedList = new ArrayList();
+ IPath sourcePath = null;
+ boolean changeNeeded = false;
+ for (int i = 0; i < current.length; i++) {
+ IClasspathEntry entry = current[i];
+ if ((entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) && (entry.getOutputLocation() != null && entry.getOutputLocation().toString().indexOf(J2EEConstants.WEB_INF_CLASSES) == -1)) {
+ //output different than J2EEConstants.WEB_INF_CLASSES
+ sourcePath = entry.getPath();
+ updatedList.add(JavaCore.newSourceEntry(sourcePath));
+ changeNeeded = true;
+ }
+ else
+ updatedList.add(entry);
+ }
+ IPath currentDefaultOutput = null;
+ currentDefaultOutput = jproj.getOutputLocation();
+ if (currentDefaultOutput.toString().indexOf(J2EEConstants.WEB_INF_CLASSES) == -1)
+ changeNeeded = true;
+ if (changeNeeded) {
+ IClasspathEntry[] updated = (IClasspathEntry[])updatedList.toArray(new IClasspathEntry[updatedList.size()]);
+ IPath outdir = pjpath.append(outputFolder);
+ jproj.setRawClasspath(updated,outdir ,null);
+ jproj.save(null, true);
+ }
+ } catch (JavaModelException e) {
+ Logger.getLogger().logError(e);
+ }
+ }
+ // Now just set the property
String existing = c.getMetaProperties().getProperty("java-output-path"); //$NON-NLS-1$
if (existing == null)
- c.setMetaProperty("java-output-path", ProductManager.getProperty(IProductConstants.OUTPUT_FOLDER)); //$NON-NLS-1$
+ setOutputFolder(model, c);
+ }
+
+ /**
+ * This overrides the default J2EE set output folder which sets the output folder to the content root
+ * if the optimized single root structure is used. For web projects, we need to switch this to
+ * set the output folder to "<contentRoot>/WEB-INF/classes"
+ *
+ * @param model
+ * @param component
+ */
+ protected void setOutputFolder(IDataModel model, IVirtualComponent component) {
+ String outputFolder = null;
+ // If using single root structure, set the output folder to "<contentRoot>/WEB-INF/classes"
+ if (ProductManager.shouldUseSingleRootStructure())
+ outputFolder = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)+"/"+J2EEConstants.WEB_INF_CLASSES;
+ // Otherwise set the output folder to the product setting default
+ else
+ outputFolder = ProductManager.getProperty(IProductConstants.OUTPUT_FOLDER);
+ component.setMetaProperty("java-output-path", outputFolder ); //$NON-NLS-1$
}
private void setContextRootPropertyIfNeeded(final IVirtualComponent c, String contextRoot) {
@@ -164,13 +228,6 @@
c.setMetaProperty("context-root", contextRoot); //$NON-NLS-1$
}
-// private IPath setSourcePropertyIfNeeded(final IDataModel model, final IPath pjpath, IProject project) {
-// IVirtualComponent c = ComponentCore.createComponent(project);
-// if (c.exists()) {
-// return J2EEProjectUtilities.getSourcePathOrFirst(project, null).makeAbsolute();
-// }
-// return pjpath.append(model.getStringProperty(IWebFacetInstallDataModelProperties.SOURCE_FOLDER));
-// }
private IPath setContentPropertyIfNeeded(final IDataModel model, final IPath pjpath, IProject project) {
IVirtualComponent c = ComponentCore.createComponent(project);
diff --git a/plugins/org.eclipse.jst.j2ee.webservice.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.webservice.ui/META-INF/MANIFEST.MF
index 1be9ab0..1ec7d0b 100644
--- a/plugins/org.eclipse.jst.j2ee.webservice.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.webservice.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.j2ee.webservice.ui; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.3.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.internal.webservice.plugin.WebServiceUIPlugin
Bundle-Vendor: %pluginVendor
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/NewProjectsListener.java b/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/NewProjectsListener.java
index 19b72d7..3174b22 100644
--- a/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/NewProjectsListener.java
+++ b/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/NewProjectsListener.java
@@ -32,7 +32,6 @@
synchronization = sync;
if(synchronization.webServiceProjectsExist(new NullProgressMonitor())) {
synchronizing = true;
- synchronization.start();
}
startListening();
}
diff --git a/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/WebServiceViewerSynchronization.java b/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/WebServiceViewerSynchronization.java
index 6fc26ac..5c69f50 100644
--- a/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/WebServiceViewerSynchronization.java
+++ b/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/WebServiceViewerSynchronization.java
@@ -91,11 +91,11 @@
case WebServiceEvent.REFRESH:
if(!hasNavigatorGroupBeenAdded()) {
- if(!hasIndexJobBeenScheduled())
+ if(!hasIndexJobBeenScheduled()){
indexJob.schedule();
- else {
- new AddWebServicesNodeUIJob().schedule();
}
+ if(!hasNavigatorGroupBeenAdded())
+ new AddWebServicesNodeUIJob().schedule();
} else {
updateJob.schedule();
}
@@ -108,7 +108,6 @@
public void startIndexJob() {
indexJob.schedule();
-
}
/**
@@ -200,19 +199,18 @@
}
/* package */ boolean webServiceProjectsExist(IProgressMonitor monitor) {
-
+ boolean ret = false;
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- try {
- monitor.beginTask("Searching for web service capable projects...", projects.length);
- for (int i = 0; i < projects.length; i++) {
- if(isInteresting(projects[i]))
- return true;
- monitor.worked(1);
- }
- } finally {
- monitor.done();
+
+ monitor.beginTask("Searching for web service capable projects...", projects.length);
+ for (int i = 0; i < projects.length; i++) {
+ if(isInteresting(projects[i])){
+ ret = true;
+ break;
+ }
}
- return false;
+ monitor.worked(1);
+ return ret;
}
/* package */ static boolean isInteresting(IProject project) {
@@ -229,12 +227,13 @@
}
protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(WebServiceUIResourceHandler.WS_NAV_JOB1, 4);
+ monitor.beginTask(WebServiceUIResourceHandler.WS_NAV_JOB1, 5);
- if (webServiceProjectsExist(monitor) && indexWebServices(monitor)) {
- new AddWebServicesNodeUIJob().schedule();
- }
-
+ if (webServiceProjectsExist(monitor))
+ indexWebServices(monitor);
+
+ monitor.done();
+
return Status.OK_STATUS;
}
}
diff --git a/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/WebServicesNavigatorContentProvider.java b/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/WebServicesNavigatorContentProvider.java
index 1e73100..4b6cec5 100644
--- a/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/WebServicesNavigatorContentProvider.java
+++ b/plugins/org.eclipse.jst.j2ee.webservice.ui/webservices_ui/org/eclipse/jst/j2ee/internal/webservice/WebServicesNavigatorContentProvider.java
@@ -87,19 +87,21 @@
if (parentElement instanceof IWorkspaceRoot) {
// return new Object[]{ getWebServicesNavigatorGroup(parentElement) };
- if (!viewerSynchronization.hasNavigatorGroupBeenAdded()) {
- if (!viewerSynchronization.hasIndexJobBeenScheduled())
- viewerSynchronization.startIndexJob();
- return NO_CHILDREN;
- } else {
- return new Object[]{getNavigatorGroup()};
- }
- } else if (parentElement instanceof WebServiceNavigatorGroup)
+ viewerSynchronization.setNavigatorGroupAdded(true);
+ return new Object[]{getNavigatorGroup()};
+ } else if (parentElement instanceof WebServiceNavigatorGroup){
+ if (!viewerSynchronization.hasIndexJobBeenScheduled()) {
+ viewerSynchronization.startIndexJob();
+ }
return new Object[]{getServicesGroup(), getClientsGroup()};
- else if (parentElement instanceof WebServiceNavigatorGroupType) {
+ }else if (parentElement instanceof WebServiceNavigatorGroupType) {
+ if (!viewerSynchronization.hasIndexJobBeenScheduled()) {
+ viewerSynchronization.startIndexJob();
+ }
WebServiceNavigatorGroupType wsGroupType = (WebServiceNavigatorGroupType) parentElement;
return wsGroupType.getChildren();
+
} else if (WSDLServiceExtManager.getServiceHelper().isService(parentElement))
return getServiceLevelNodes(parentElement).toArray();
diff --git a/plugins/org.eclipse.jst.j2ee.webservice/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.webservice/META-INF/MANIFEST.MF
index 87bbce3..6147847 100644
--- a/plugins/org.eclipse.jst.j2ee.webservice/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.webservice/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.j2ee.webservice; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.4.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.internal.webservice.plugin.WebServicePlugin
Bundle-Vendor: %pluginVendor
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.webservice/webservice/org/eclipse/jst/j2ee/internal/webservice/componentcore/util/WSDDArtifactEdit.java b/plugins/org.eclipse.jst.j2ee.webservice/webservice/org/eclipse/jst/j2ee/internal/webservice/componentcore/util/WSDDArtifactEdit.java
index c9f96eb..173614e 100644
--- a/plugins/org.eclipse.jst.j2ee.webservice/webservice/org/eclipse/jst/j2ee/internal/webservice/componentcore/util/WSDDArtifactEdit.java
+++ b/plugins/org.eclipse.jst.j2ee.webservice/webservice/org/eclipse/jst/j2ee/internal/webservice/componentcore/util/WSDDArtifactEdit.java
@@ -464,7 +464,7 @@
// Ignore
}
WSDLServiceHelper serviceHelper = WSDLServiceExtManager.getServiceHelper();
- if (res != null && res.isLoaded() && serviceHelper.isWSDLResource(res))
+ if (res != null && res.isLoaded() && serviceHelper != null && serviceHelper.isWSDLResource(res))
return res;
return null;
}
diff --git a/plugins/org.eclipse.jst.j2ee.webservice/webservice/org/eclipse/jst/j2ee/internal/webservice/helper/WebServicesManager.java b/plugins/org.eclipse.jst.j2ee.webservice/webservice/org/eclipse/jst/j2ee/internal/webservice/helper/WebServicesManager.java
index 64a3514..e25eef9 100644
--- a/plugins/org.eclipse.jst.j2ee.webservice/webservice/org/eclipse/jst/j2ee/internal/webservice/helper/WebServicesManager.java
+++ b/plugins/org.eclipse.jst.j2ee.webservice/webservice/org/eclipse/jst/j2ee/internal/webservice/helper/WebServicesManager.java
@@ -36,6 +36,10 @@
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
@@ -47,7 +51,9 @@
import org.eclipse.jst.j2ee.ejb.EJBJar;
import org.eclipse.jst.j2ee.ejb.EJBResource;
import org.eclipse.jst.j2ee.ejb.EnterpriseBean;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
import org.eclipse.jst.j2ee.internal.common.XMLResource;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.jst.j2ee.internal.webservice.componentcore.util.WSCDDArtifactEdit;
@@ -69,6 +75,7 @@
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
@@ -119,21 +126,47 @@
private void addArtifactEdit(IProject handle) {
synchronized(wsArtifactEdits) {
if (!wsArtifactEdits.containsKey(handle)) {
- ArtifactEdit edit = WSDDArtifactEdit.getWSDDArtifactEditForRead(handle);
+ WSDDArtifactEdit edit = WSDDArtifactEdit.getWSDDArtifactEditForRead(handle);
if (edit != null) {
- edit.addListener(this);
- wsArtifactEdits.put(handle, edit);
- wsElementsChanged = true;
+ WebServices webServices = edit.getWebServices();
+ // If the project has a webservice.xml with internal services or
+ // it has .wsil files with external services, we cache the artifact edit
+ if ((webServices != null && !webServices.getWebServiceDescriptions().isEmpty()) || !edit.getWSILResources().isEmpty()) {
+ edit.addListener(this);
+ wsArtifactEdits.put(handle, edit);
+ wsElementsChanged = true;
+ // Otherwise, dispose the artifact edit
+ } else {
+ edit.dispose();
+ }
}
}
}
synchronized (wsClientArtifactEdits) {
if (!wsClientArtifactEdits.containsKey(handle)) {
- ArtifactEdit edit = WSCDDArtifactEdit.getWSCDDArtifactEditForRead(handle);
+ WSCDDArtifactEdit edit = WSCDDArtifactEdit.getWSCDDArtifactEditForRead(handle);
if (edit != null) {
- edit.addListener(this);
- wsClientArtifactEdits.put(handle, edit);
- wsClientElementsChanged = true;
+ WebServicesResource res = edit.getWscddXmiResource();
+ boolean isInterested = false;
+ // Does the project have 1.3 web service clients?
+ if (res != null && res.isLoaded() && res.getWebServicesClient() != null)
+ isInterested = true;
+
+ // Does the project have 1.4 web service clients?
+ List wsClientEdits = new ArrayList();
+ wsClientEdits.add(edit);
+ if (!getWorkspace14ServiceRefs(wsClientEdits).isEmpty())
+ isInterested = true;
+
+ // If project has 1.3 or 1.4 web service clients, cache the artifact edit
+ if (isInterested) {
+ edit.addListener(this);
+ wsClientArtifactEdits.put(handle, edit);
+ wsClientElementsChanged = true;
+ // Otherwise, dispose the artifact edit
+ } else {
+ edit.dispose();
+ }
}
}
}
@@ -645,11 +678,33 @@
}
public List getWorkspace14ServiceRefs() {
+ return getWorkspace14ServiceRefs(getWSClientArtifactEdits());
+ }
+
+ private List getWorkspace14ServiceRefs(List wsClientArtifactEdits) {
+ Iterator iter = wsClientArtifactEdits.iterator();
List result = new ArrayList();
- Iterator iter = getWSClientArtifactEdits().iterator();
while (iter.hasNext()) {
WSCDDArtifactEdit wscArtifactEdit = (WSCDDArtifactEdit) iter.next();
- ArtifactEdit artifactEdit = ArtifactEdit.getArtifactEditForRead(wscArtifactEdit.getProject());
+
+ IProject project = wscArtifactEdit.getProject();
+
+ String projectType = J2EEProjectUtilities.getJ2EEProjectType(project);
+ String projectVersion = J2EEProjectUtilities.getJ2EEProjectVersion(project);
+ int j2eeLevel = 0;
+ if(IModuleConstants.JST_EJB_MODULE.equals(projectType)){
+ j2eeLevel = J2EEVersionUtil.convertEJBVersionStringToJ2EEVersionID(projectVersion);
+ } else if(IModuleConstants.JST_WEB_MODULE.equals(projectType)){
+ j2eeLevel = J2EEVersionUtil.convertWebVersionStringToJ2EEVersionID(projectVersion);
+ } else if(IModuleConstants.JST_APPCLIENT_MODULE.equals(projectType)){
+ j2eeLevel = J2EEVersionUtil.convertAppClientVersionStringToJ2EEVersionID(projectVersion);
+ }
+
+ // this method needs to check that project's j2ee level is 14
+ if(j2eeLevel != J2EEVersionConstants.J2EE_1_4_ID)
+ continue;
+
+ ArtifactEdit artifactEdit = ArtifactEdit.getArtifactEditForRead(project);
try {
EObject rootObject = null;
if (artifactEdit!=null)
@@ -806,8 +861,9 @@
if ((delta.getKind()==IResourceDelta.ADDED || (((delta.getFlags() & IResourceDelta.OPEN) != 0) && p.isAccessible()))) {
IVirtualComponent component = ComponentCore.createComponent(p);
if (component!=null && !J2EEProjectUtilities.isEARProject(p) && !J2EEProjectUtilities.isStaticWebProject(p)) {
- addArtifactEdit(p);
- notifyListeners(EditModelEvent.ADDED_RESOURCE);
+ Job job = new ProcessProjectsWithWSDL(p, EditModelEvent.ADDED_RESOURCE);
+ job.setRule(p);
+ job.schedule();
return false;
}
}
@@ -820,13 +876,19 @@
}
else if (resource.getType() == IResource.FILE && isInterrestedInFile((IFile) resource)) {
- // Handle WSIL and WSDL File additions
+ // Handle WSIL and WSDL File additions as well as webservice.xml and webserviceclient.xml
if ((delta.getKind() == IResourceDelta.ADDED) || ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0)) {
if (resource.getFileExtension().equals(WSDL_EXT))
addedWsdl((IFile) resource);
else if (resource.getFileExtension().equals(WSIL_EXT))
addedWsil((IFile)resource);
- }
+ else if (resource.getName().equals(J2EEConstants.WEB_SERVICES_CLIENT_SHORTNAME) ||
+ resource.getName().equals(J2EEConstants.WEB_SERVICES_DD_URI)) {
+ Job job = new ProcessProjectsWithWSDL(resource.getProject(), EditModelEvent.LOADED_RESOURCE);
+ job.setRule(resource.getProject());
+ job.schedule();
+ }
+ }
// Handle WSIL or WSDL file removals
else if ((delta.getKind() == IResourceDelta.REMOVED) || ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0)) {
if (resource.getFileExtension().equals(WSDL_EXT) || resource.getFileExtension().equals(WSIL_EXT))
@@ -837,6 +899,25 @@
return true;
}
+ private class ProcessProjectsWithWSDL extends Job
+ {
+ private IProject currentProject;
+ private int eventType;
+
+ public ProcessProjectsWithWSDL(IProject p, int newEventType)
+ {
+ super("Loading artifact edit for project");
+ currentProject = p;
+ eventType = newEventType;
+ }
+
+ protected IStatus run(IProgressMonitor monitor) {
+ addArtifactEdit(currentProject);
+ notifyListeners(eventType);
+ return Status.OK_STATUS;
+ }
+ }
+
protected void addedWsdl(IFile wsdl) {
if (!wsdl.exists())
return;
@@ -866,7 +947,9 @@
protected boolean isInterrestedInFile(IFile aFile) {
if (aFile != null && aFile.getFileExtension() != null) {
String extension = aFile.getFileExtension();
- return extension.equals(WSDL_EXT) || extension.equals(WSIL_EXT);
+ return extension.equals(WSDL_EXT) || extension.equals(WSIL_EXT)
+ || aFile.getName().equals(J2EEConstants.WEB_SERVICES_CLIENT_SHORTNAME)
+ || aFile.getName().equals(J2EEConstants.WEB_SERVICES_DD_URI);
}
return false;
}
diff --git a/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF
index 378b524..518b083 100644
--- a/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: J2EE Component
Bundle-SymbolicName: org.eclipse.jst.j2ee; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.4.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/applicationclient/internal/creation/AppClientFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/applicationclient/internal/creation/AppClientFacetProjectCreationDataModelProvider.java
index 5f7c0e4..bd1b7fa 100644
--- a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/applicationclient/internal/creation/AppClientFacetProjectCreationDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/applicationclient/internal/creation/AppClientFacetProjectCreationDataModelProvider.java
@@ -25,6 +25,7 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.ProductManager;
public class AppClientFacetProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider {
@@ -39,7 +40,11 @@
map.add(javaFacet);
IDataModel appClientFacet = DataModelFactory.createDataModel(new AppClientFacetInstallDataModelProvider());
map.add(appClientFacet);
- javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME,appClientFacet.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER));
+ String appClientRoot = appClientFacet.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER);
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, appClientRoot);
+ // If using optimized single root structure, set the output folder to the content root
+ if (ProductManager.shouldUseSingleRootStructure())
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, appClientRoot);
appClientFacet.addListener(new IDataModelListener() {
public void propertyChanged(DataModelEvent event) {
if (IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME.equals(event.getPropertyName())) {
diff --git a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDelegate.java
index e005408..50cfd02 100644
--- a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDelegate.java
+++ b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetInstallDelegate.java
@@ -37,8 +37,6 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.project.facet.IProductConstants;
-import org.eclipse.wst.project.facet.ProductManager;
public class AppClientFacetInstallDelegate extends J2EEFacetInstallDelegate implements IDelegate {
@@ -90,7 +88,7 @@
final IVirtualComponent c = ComponentCore.createComponent(project);
c.create(0, null);
- c.setMetaProperty("java-output-path", ProductManager.getProperty(IProductConstants.OUTPUT_FOLDER)); //$NON-NLS-1$
+ setOutputFolder(model, c);
final IVirtualFolder root = c.getRootFolder();
IFolder sourceFolder = null;
diff --git a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetPostInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetPostInstallDelegate.java
index 0b49234..2f60d9a 100644
--- a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetPostInstallDelegate.java
+++ b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/AppClientFacetPostInstallDelegate.java
@@ -19,14 +19,13 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.jem.workbench.utility.JemProjectUtilities;
import org.eclipse.jst.j2ee.application.internal.operations.UpdateManifestDataModelProperties;
import org.eclipse.jst.j2ee.application.internal.operations.UpdateManifestDataModelProvider;
import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties;
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.internal.operation.IArtifactEditOperationDataModelProperties;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -86,12 +85,14 @@
mainClassDataModel.setProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME, project.getName());
mainClassDataModel.setProperty(INewJavaClassDataModelProperties.CLASS_NAME, "Main"); //$NON-NLS-1$
mainClassDataModel.setBooleanProperty(INewJavaClassDataModelProperties.MAIN_METHOD, true);
- String projRelativeSourcePath = IPath.SEPARATOR + project.getName() + IPath.SEPARATOR + model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER);
- mainClassDataModel.setProperty(INewJavaClassDataModelProperties.SOURCE_FOLDER, projRelativeSourcePath);
- IJavaProject javaProject = JemProjectUtilities.getJavaProject(project);
- mainClassDataModel.setProperty(INewJavaClassDataModelProperties.JAVA_PACKAGE_FRAGMENT_ROOT, javaProject.getPackageFragmentRoots()[0]);
- mainClassDataModel.getDefaultOperation().execute(monitor, null);
- createManifestEntryForMainClass(monitor, model, project);
+
+ IContainer container = J2EEProjectUtilities.getSourceFolderOrFirst(project, null);
+ if( container != null ){
+ String projRelativeSourcePath = IPath.SEPARATOR + project.getName() + IPath.SEPARATOR + container.getName();
+ mainClassDataModel.setProperty(INewJavaClassDataModelProperties.SOURCE_FOLDER, projRelativeSourcePath);
+ mainClassDataModel.getDefaultOperation().execute(monitor, null);
+ createManifestEntryForMainClass(monitor, model, project);
+ }
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/IAppClientFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/IAppClientFacetInstallDataModelProperties.java
index 3436004..109f1ed 100644
--- a/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/IAppClientFacetInstallDataModelProperties.java
+++ b/plugins/org.eclipse.jst.j2ee/appclientcreation/org/eclipse/jst/j2ee/project/facet/IAppClientFacetInstallDataModelProperties.java
@@ -10,8 +10,15 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.project.facet;
+import org.eclipse.jst.j2ee.applicationclient.internal.creation.AppClientFacetProjectCreationDataModelProvider;
+
public interface IAppClientFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties {
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = AppClientFacetProjectCreationDataModelProvider.class;
+
/**
* Optional, type Boolean. the default value is <code>Boolean.TRUE</code>.If this is true and CREATE_DEFAULT_FILES is true, then a default main
* class will be generated during component creation.
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentExportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentExportOperation.java
index 706eeec..fb1f245 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentExportOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/AppClientComponentExportOperation.java
@@ -13,6 +13,8 @@
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchiveFactory;
import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonarchivePackage;
@@ -26,16 +28,20 @@
}
public void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
+ IProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, EXPORT_WORK);
try {
CommonarchiveFactory caf = ((CommonarchivePackage) EPackage.Registry.INSTANCE.getEPackage(CommonarchivePackage.eNS_URI)).getCommonarchiveFactory();
AppClientComponentLoadStrategyImpl ls = new AppClientComponentLoadStrategyImpl(getComponent());
ls.setExportSource(isExportSource());
setModuleFile(caf.openApplicationClientFile(ls, getDestinationPath().toOSString()));
+ ls.setProgressMonitor(subMonitor);
getModuleFile().saveAsNoReopen(getDestinationPath().toOSString());
} catch (SaveFailureException ex) {
throw ex;
} catch (Exception e) {
throw new SaveFailureException(AppClientArchiveOpsResourceHandler.ARCHIVE_OPERATION_OpeningArchive, e);
+ } finally {
+ subMonitor.done();
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentLoadStrategyImpl.java
index 31bf835..1242347 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentLoadStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentLoadStrategyImpl.java
@@ -32,7 +32,9 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jdt.core.IJavaProject;
@@ -42,9 +44,13 @@
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.j2ee.commonarchivecore.internal.File;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ResourceLoadException;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.FileIterator;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.FileIteratorImpl;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ContainerImpl;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategyImpl;
import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
import org.eclipse.wst.common.componentcore.ArtifactEdit;
import org.eclipse.wst.common.componentcore.UnresolveableURIException;
import org.eclipse.wst.common.componentcore.internal.ArtifactEditModel;
@@ -234,11 +240,23 @@
}
}
+ /**
+ * This is a cache of the IResource roots for all java source folders and is used by
+ * {@link #inJavaSrc(IVirtualResource)}.
+ */
+ private IResource[] sourceRoots = null;
+
protected void aggregateSourceFiles() {
try {
IVirtualFolder rootFolder = vComponent.getRootFolder();
IVirtualResource[] members = rootFolder.members();
- aggregateFiles(members);
+ IPackageFragmentRoot[] srcPkgs = J2EEProjectUtilities.getSourceContainers(vComponent.getProject());
+ sourceRoots = new IResource[srcPkgs.length];
+ for (int i = 0; i < srcPkgs.length; i++) {
+ sourceRoots[i] = srcPkgs[i].getCorrespondingResource();
+ }
+ inJavaSrc = false;
+ aggregateFiles(members);
} catch (CoreException e) {
Logger.getLogger().logError(e);
}
@@ -332,6 +350,11 @@
return fileAdded;
}
+ /**
+ * This is used to track whether {@link #aggregateFiles(IVirtualResource[])} is currently within a Java Source folder.
+ */
+ private boolean inJavaSrc = false;
+
protected boolean aggregateFiles(IVirtualResource[] virtualResources) throws CoreException {
boolean fileAdded = false;
for (int i = 0; i < virtualResources.length; i++) {
@@ -350,12 +373,15 @@
}
if (filesHolder.contains(uri))
continue;
-
+
if (virtualResources[i].getType() == IVirtualResource.FILE) {
if (!shouldInclude(uri))
continue;
IResource resource = virtualResources[i].getUnderlyingResource();
- if (resource.isDerived()) {
+ // want to ignore derived resources nested within Java src directories; this covers the case where
+ // a user has nested a Java output directory within a Java src directory (note: should ideally be
+ // respecting Java src path exclusion filters)
+ if (inJavaSrc && resource.isDerived()) {
continue;
}
cFile = createFile(uri);
@@ -363,24 +389,63 @@
filesHolder.addFile(cFile, resource);
fileAdded = true;
} else if (shouldInclude((IVirtualContainer) virtualResources[i])) {
- IVirtualResource[] nestedVirtualResources = ((IVirtualContainer) virtualResources[i]).members();
- aggregateFiles(nestedVirtualResources);
- if(!filesHolder.contains(uri)){
- if (!shouldInclude(uri))
- continue;
- IResource resource = virtualResources[i].getUnderlyingResource();
- if (resource.isDerived()) {
- continue;
+ boolean inJavaSrcAtThisLevel = inJavaSrc;
+ try {
+ if (!inJavaSrc) {
+ // if not already inside a Java src dir, check again
+ inJavaSrc = inJavaSrc(virtualResources[i]);
}
- cFile = createDirectory(uri);
- cFile.setLastModified(getLastModified(resource));
- filesHolder.addDirectory(cFile);
- fileAdded = true;
+ IVirtualResource[] nestedVirtualResources = ((IVirtualContainer) virtualResources[i]).members();
+ aggregateFiles(nestedVirtualResources);
+ if(!filesHolder.contains(uri)){
+ if (!shouldInclude(uri))
+ continue;
+ IResource resource = virtualResources[i].getUnderlyingResource();
+ if (inJavaSrc && resource.isDerived()) {
+ continue;
+ }
+ cFile = createDirectory(uri);
+ cFile.setLastModified(getLastModified(resource));
+ filesHolder.addDirectory(cFile);
+ fileAdded = true;
+ }
+ } finally {
+ inJavaSrc = inJavaSrcAtThisLevel;
}
}
}
return fileAdded;
}
+
+ /**
+ * Determines if the specified IVirtualResource maps to a IResource that is contained within a Java src root.
+ * @param virtualResource IVirtualResource to check.
+ * @param sourceRoots Current Java src roots.
+ * @return True if contained in a Java src root, false otherwise.
+ */
+ private boolean inJavaSrc(final IVirtualResource virtualResource) {
+ if (sourceRoots.length == 0) {
+ return false;
+ }
+ // all mapped resources must be associated with Java src for the resource to be considered in Java src
+ final IResource[] resources = virtualResource.getUnderlyingResources();
+ boolean inJavaSrc = false;
+ for (int i = 0; i < resources.length; i++) {
+ inJavaSrc = false;
+ for (int j = 0; j < sourceRoots.length; j++) {
+ if (sourceRoots[j].getFullPath().isPrefixOf(resources[i].getFullPath())) {
+ inJavaSrc = true;
+ break;
+ }
+ }
+ // if this one was not in Java src, can break
+ if (!inJavaSrc) {
+ break;
+ }
+ }
+
+ return inJavaSrc;
+ }
protected long getLastModified(IResource aResource) {
return aResource.getLocation().toFile().lastModified();
@@ -417,10 +482,7 @@
}
protected void addExternalFile(String uri, java.io.File externalDiskFile) {
- File aFile = getArchiveFactory().createFile();
- aFile.setURI(uri);
- aFile.setOriginalURI(uri);
- aFile.setLoadingContainer(getContainer());
+ File aFile = createFile(uri);
filesHolder.addFile(aFile, externalDiskFile);
}
@@ -475,6 +537,48 @@
return vComponent;
}
+ protected IProgressMonitor monitor = null;
+
+ public void setProgressMonitor(IProgressMonitor monitor){
+ this.monitor = monitor;
+ }
+
+ protected final int FILE_SAVE_WORK = 100;
+
+ public FileIterator getFileIterator() throws IOException {
+ return new FileIteratorImpl(getContainer().getFiles()){
+ protected SubProgressMonitor lastSubMon = null;
+ boolean firstVisit = true;
+
+ public File next() {
+ if(firstVisit){
+ firstVisit = false;
+ if(monitor != null){
+ monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Exporting_archive, new Object [] { getContainer().getURI() }), files.size() * FILE_SAVE_WORK);
+ }
+ }
+ if(lastSubMon != null){
+ lastSubMon.done();
+ lastSubMon = null;
+ } else if(monitor != null){
+ monitor.worked(FILE_SAVE_WORK);
+ }
+ File file = super.next();
+ if(monitor != null){
+ if(file.isContainer() && ComponentLoadStrategyImpl.class.isInstance(((ContainerImpl)file).getLoadStrategy())){
+ ComponentLoadStrategyImpl ls = (ComponentLoadStrategyImpl)((ContainerImpl)file).getLoadStrategy();
+ lastSubMon = new SubProgressMonitor(monitor, FILE_SAVE_WORK, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
+ ls.setProgressMonitor(lastSubMon);
+ } else {
+ monitor.subTask(file.getURI());
+ }
+ }
+ return file;
+ }
+ };
+
+ }
+
public void close() {
if(Thread.currentThread().toString().toLowerCase().indexOf("finalizer") != -1){
System.err.println("Opener of Archive didn't close! "+this);
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentSaveStrategyImpl.java
index 9bc8352..4418b40 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentSaveStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ComponentSaveStrategyImpl.java
@@ -109,8 +109,7 @@
public void save(File aFile, InputStream in) throws SaveFailureException {
try {
- String displayString = EJBArchiveOpsResourceHandler.IMPORT_OPERATION_STRING;
- progressMonitor.subTask(displayString + aFile.getURI());
+ progressMonitor.subTask(aFile.getURI());
IPath projectRelativePath = getOutputPathForFile(aFile);
if (aFile.isArchive()) {
@@ -125,6 +124,8 @@
} catch (Exception e) {
String errorString = EJBArchiveOpsResourceHandler.ARCHIVE_OPERATION_SaveFile + aFile.getName();
throw new SaveFailureException(errorString, e);
+ } finally {
+ progressMonitor.worked(1);
}
}
@@ -196,6 +197,7 @@
*/
protected void saveAsArchiveComponent(Archive archive, IPath projectRelativePath, InputStream in) throws Exception {
IFile iFile = saveToOutputPathIFile(projectRelativePath, in);
+ //TODO investigate removing this block and related variables and linkArchiveComponents(); see bugzilla 159160
if (shouldLinkAsComponentRef(archive)) {
IVirtualComponent archiveComponent = ComponentCore.createArchiveComponent(vComponent.getProject(), VirtualArchiveComponent.LIBARCHIVETYPE + iFile.getFullPath().toString());
if (archiveComponents == null) {
@@ -209,7 +211,7 @@
}
protected boolean shouldLinkAsComponentRef(Archive archive) {
- return true;
+ return false;
}
protected void linkArchiveComponents() {
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentExportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentExportOperation.java
index 9ea71bb..4754514 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentExportOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentExportOperation.java
@@ -14,6 +14,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jst.j2ee.commonarchivecore.internal.EARFile;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
@@ -29,6 +30,7 @@
}
protected void export() throws SaveFailureException, CoreException, InvocationTargetException, InterruptedException {
+ IProgressMonitor subMonitor = new SubProgressMonitor(progressMonitor, EXPORT_WORK);
EARArtifactEdit artifactEdit = null;
try {
artifactEdit = (EARArtifactEdit) ComponentUtilities.getArtifactEditForRead(getComponent());
@@ -36,6 +38,8 @@
String destination = getDestinationPath().toOSString();
archive.setURI(destination);
setModuleFile(archive);
+ ComponentLoadStrategyImpl ls = (ComponentLoadStrategyImpl)archive.getLoadStrategy();
+ ls.setProgressMonitor(subMonitor);
archive.saveAsNoReopen(destination);
} catch (SaveFailureException ex) {
throw ex;
@@ -45,15 +49,21 @@
if (null != artifactEdit) {
artifactEdit.dispose();
}
+ subMonitor.done();
}
}
protected void runNecessaryBuilders(IVirtualComponent component, IProgressMonitor monitor) throws CoreException {
- super.runNecessaryBuilders(component, monitor);
- IVirtualReference[] refs = component.getReferences();
- for (int i = 0; i < refs.length; i++) {
- IVirtualComponent refComp = refs[i].getReferencedComponent();
- super.runNecessaryBuilders(refComp, monitor);
+ try {
+ IVirtualReference[] refs = component.getReferences();
+ int work = (JAVA_BUILDER_WORK + LIB_BUILDER_WORK) / (refs.length + 1);
+ super.runNecessaryBuilders(component, new SubProgressMonitor(monitor, work));
+ for (int i = 0; i < refs.length; i++) {
+ IVirtualComponent refComp = refs[i].getReferencedComponent();
+ super.runNecessaryBuilders(refComp, new SubProgressMonitor(monitor, work));
+ }
+ } finally {
+ monitor.done();
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java
index dc90f5e..33c50f8 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentImportOperation.java
@@ -19,6 +19,7 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.j2ee.application.internal.operations.AddComponentToEnterpriseApplicationDataModelProvider;
import org.eclipse.jst.j2ee.application.internal.operations.IAddComponentToEnterpriseApplicationDataModelProperties;
@@ -41,10 +42,26 @@
protected EARArtifactEdit artifactEdit = null;
+ protected final int LINK_COMPONENTS_WORK = 10;
+ protected final int WEB_LIB_WORK = 10;
+ protected final int DISPOSE_WORK = 10;
+
public EARComponentImportOperation(IDataModel model) {
super(model);
}
+ protected int computeTotalWork() {
+ int baseWork = super.computeTotalWork() + WEB_LIB_WORK + DISPOSE_WORK;
+ List modelsToImport = (List) model.getProperty(IEARComponentImportDataModelProperties.HANDLED_PROJECT_MODELS_LIST);
+ IDataModel importModel = null;
+ for (int i = 0; i < modelsToImport.size(); i++) {
+ importModel = (IDataModel) modelsToImport.get(i);
+ Archive nestedArchive = (Archive) importModel.getProperty(IEARComponentImportDataModelProperties.FILE);
+ baseWork += LINK_COMPONENTS_WORK + PROJECT_CREATION_WORK + nestedArchive.getFiles().size();
+ }
+ return baseWork;
+ }
+
/**
* Subclasses must override to performs the workbench modification steps that are to be
* contained within a single logical workbench change.
@@ -89,6 +106,7 @@
}
}
}
+ monitor.worked(WEB_LIB_WORK);
List componentToAdd = new ArrayList();
Map componentToURIMap = new HashMap();
@@ -100,7 +118,7 @@
if (compCreationModel.isProperty(IJ2EEFacetProjectCreationDataModelProperties.MODULE_URI))
compCreationModel.setProperty(IJ2EEFacetProjectCreationDataModelProperties.MODULE_URI, nestedArchive.getURI());
try {
- importModel.getDefaultOperation().execute(monitor, info);
+ importModel.getDefaultOperation().execute(new SubProgressMonitor(monitor, PROJECT_CREATION_WORK + nestedArchive.getFiles().size()), info);
} catch (ExecutionException e) {
Logger.getLogger().logError(e);
}
@@ -113,7 +131,7 @@
addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, virtualComponent);
addComponentsDM.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, componentToAdd);
addComponentsDM.setProperty(IAddComponentToEnterpriseApplicationDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, componentToURIMap);
- addComponentsDM.getDefaultOperation().execute(monitor, info);
+ addComponentsDM.getDefaultOperation().execute(new SubProgressMonitor(monitor, LINK_COMPONENTS_WORK), info);
}
} finally {
if (null != artifactEdit) {
@@ -121,6 +139,7 @@
artifactEdit = null;
}
resetDisposeImportModels();
+ monitor.worked(DISPOSE_WORK);
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentLoadStrategyImpl.java
index cd618b1..fafa44d 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentLoadStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentLoadStrategyImpl.java
@@ -110,7 +110,7 @@
}
if (!isModule) {
if (referencedComponent.isBinary()) {
- String uri = diskFile.getName();
+ String uri = reference.getArchiveName();
addExternalFile(uri, diskFile);
} else if (J2EEProjectUtilities.isUtilityProject(referencedComponent.getProject())) {
try {
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentSaveStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentSaveStrategyImpl.java
index c0cb18e..f3e8c72 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentSaveStrategyImpl.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/EARComponentSaveStrategyImpl.java
@@ -38,7 +38,7 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
-public class EARComponentSaveStrategyImpl extends J2EEComponentSaveStrategyImpl {
+public class EARComponentSaveStrategyImpl extends ComponentSaveStrategyImpl {
protected Map createdComponentsMap;
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java
index af30a34..f85b8cd 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactExportOperation.java
@@ -29,6 +29,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.MultiRule;
import org.eclipse.jdt.core.JavaCore;
@@ -36,6 +37,7 @@
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties;
import org.eclipse.jst.j2ee.internal.plugin.LibCopyBuilder;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
@@ -56,17 +58,33 @@
public J2EEArtifactExportOperation(IDataModel model) {
super(model);
}
-
+
+ protected final int REFRESH_WORK = 100;
+ protected final int JAVA_BUILDER_WORK = 100;
+ protected final int LIB_BUILDER_WORK = 100;
+ protected final int EXPORT_WORK = 1000;
+ protected final int CLOSE_WORK = 10;
+
+ protected int computeTotalWork() {
+ int totalWork = REFRESH_WORK;
+ if (model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.RUN_BUILD)) {
+ totalWork += JAVA_BUILDER_WORK + LIB_BUILDER_WORK;
+ }
+ totalWork += EXPORT_WORK + CLOSE_WORK;
+ return totalWork;
+ }
+
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
setComponent((IVirtualComponent) model.getProperty(IJ2EEComponentExportDataModelProperties.COMPONENT));
setDestinationPath(new Path(model.getStringProperty(IJ2EEComponentExportDataModelProperties.ARCHIVE_DESTINATION)));
setExportSource(model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.EXPORT_SOURCE_FILES));
try {
+ monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Exporting_archive, new Object [] { getDestinationPath().lastSegment() }), computeTotalWork());
setProgressMonitor(monitor);
// defect 240999
- component.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ component.getProject().refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, REFRESH_WORK));
if (model.getBooleanProperty(IJ2EEComponentExportDataModelProperties.RUN_BUILD)) {
- runNecessaryBuilders(component, monitor);
+ runNecessaryBuilders(component, new SubProgressMonitor(monitor, JAVA_BUILDER_WORK + LIB_BUILDER_WORK));
}
export();
} catch (Exception e) {
@@ -74,8 +92,11 @@
//The module fil will be closed if the export succeeds
//Need to be careful not to close the archive twice because of ReferenceCounted Archives
moduleFile.close();
+ monitor.worked(CLOSE_WORK);
}
throw new ExecutionException(EJBArchiveOpsResourceHandler.Error_exporting__UI_ + archiveString(), e);
+ } finally {
+ monitor.done();
}
return OK_STATUS;
}
@@ -127,17 +148,22 @@
}
protected void runNecessaryBuilders(IVirtualComponent component, IProgressMonitor monitor) throws CoreException {
- if(!component.isBinary()){
- IProject project = component.getProject();
- IProjectDescription description = project.getDescription();
- ICommand javaBuilder = getJavaCommand(description);
- if (javaBuilder != null) {
- project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, JavaCore.BUILDER_ID, javaBuilder.getArguments(), monitor);
+ try{
+ monitor.beginTask(null, JAVA_BUILDER_WORK + LIB_BUILDER_WORK);
+ if(!component.isBinary()){
+ IProject project = component.getProject();
+ IProjectDescription description = project.getDescription();
+ ICommand javaBuilder = getJavaCommand(description);
+ if (javaBuilder != null) {
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, JavaCore.BUILDER_ID, javaBuilder.getArguments(), new SubProgressMonitor(monitor, JAVA_BUILDER_WORK));
+ }
+ ICommand libCopyBuilder = getLibCopyBuilder(description);
+ if (null != libCopyBuilder) {
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, LibCopyBuilder.BUILDER_ID, libCopyBuilder.getArguments(), new SubProgressMonitor(monitor, LIB_BUILDER_WORK));
+ }
}
- ICommand libCopyBuilder = getLibCopyBuilder(description);
- if (null != libCopyBuilder) {
- project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, LibCopyBuilder.BUILDER_ID, libCopyBuilder.getArguments(), monitor);
- }
+ } finally {
+ monitor.done();
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java
index fec00e7..bb03d45 100644
--- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EEArtifactImportOperation.java
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -31,6 +32,7 @@
import org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentImportDataModelProperties;
import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.internal.project.ProjectSupportResourceHandler;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsOp;
@@ -46,6 +48,7 @@
protected Archive moduleFile;
protected IVirtualComponent virtualComponent;
protected IAdaptable info;
+ protected final int PROJECT_CREATION_WORK = 30;
public J2EEArtifactImportOperation(IDataModel model) {
super(model);
@@ -55,6 +58,8 @@
try {
J2EEComponentClasspathUpdater.getInstance().pauseUpdates();
this.info = anInfo;
+ moduleFile = (Archive) model.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
+ monitor.beginTask(ProjectSupportResourceHandler.getString(ProjectSupportResourceHandler.Importing_archive, new Object [] { moduleFile.getURI() }), computeTotalWork());
doExecute(monitor);
return OK_STATUS;
} finally {
@@ -65,19 +70,25 @@
} finally {
J2EEComponentClasspathUpdater.getInstance().resumeUpdates();
model.dispose();
-
+ monitor.done();
}
}
}
+ protected int computeTotalWork() {
+ return PROJECT_CREATION_WORK + moduleFile.getFiles().size();
+ }
+
+ /**
+ * Subclasses overriding this method should also override {@link #computeTotalWork()}
+ * @param monitor
+ * @throws ExecutionException
+ */
protected void doExecute(IProgressMonitor monitor) throws ExecutionException {
- moduleFile = (Archive) model.getProperty(IJ2EEComponentImportDataModelProperties.FILE);
- monitor.beginTask(null, moduleFile.getFiles().size());
-
- virtualComponent = createVirtualComponent(model.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION), monitor);
+ virtualComponent = createVirtualComponent(model.getNestedModel(IJ2EEComponentImportDataModelProperties.NESTED_MODEL_J2EE_COMPONENT_CREATION), new SubProgressMonitor(monitor, PROJECT_CREATION_WORK));
try {
- importModuleFile(monitor);
+ importModuleFile(new SubProgressMonitor(monitor, moduleFile.getFiles().size()));
} catch (InvocationTargetException e) {
throw new ExecutionException(e.getMessage(), e);
} catch (InterruptedException e) {
@@ -93,10 +104,14 @@
}
protected IVirtualComponent createVirtualComponent(IDataModel aModel, IProgressMonitor monitor) throws ExecutionException {
- aModel.getDefaultOperation().execute(monitor, info);
- String projectName = aModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
- IProject project = ProjectUtilities.getProject(projectName);
- return ComponentCore.createComponent(project);
+ try {
+ aModel.getDefaultOperation().execute(monitor, info);
+ String projectName = aModel.getStringProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME);
+ IProject project = ProjectUtilities.getProject(projectName);
+ return ComponentCore.createComponent(project);
+ } finally {
+ monitor.done();
+ }
}
/**
@@ -116,8 +131,8 @@
*/
protected void importModuleFile(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
- monitor.worked(1);
- J2EEComponentSaveStrategyImpl aStrategy = (J2EEComponentSaveStrategyImpl) createSaveStrategy(virtualComponent);
+ monitor.beginTask(null, moduleFile.getFiles().size());
+ ComponentSaveStrategyImpl aStrategy = (ComponentSaveStrategyImpl) createSaveStrategy(virtualComponent);
aStrategy.setProgressMonitor(monitor);
aStrategy.setOverwriteHandler((IOverwriteHandler) model.getProperty(IJ2EEComponentImportDataModelProperties.OVERWRITE_HANDLER));
aStrategy.setDataModel(model);
@@ -127,6 +142,8 @@
throw new InterruptedException();
} catch (Exception ex) {
throw new WFTWrappedException(ex, EJBArchiveOpsResourceHandler.ERROR_IMPORTING_MODULE_FILE);
+ } finally {
+ monitor.done();
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/ClasspathModel.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/ClasspathModel.java
index e58c8bb..5359d7d 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/ClasspathModel.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/ClasspathModel.java
@@ -401,9 +401,11 @@
* Sets the manfest on the archive, updates the classpath selection, and notifies
*/
public void setManifest(ArchiveManifest manifest) {
+ if (archive != null){
archive.setManifest(manifest);
getClassPathSelection(); // Ensure the selection is initialized.
fireNotification(new ClasspathModelEvent(ClasspathModelEvent.MANIFEST_CHANGED));
+ }
}
public void selectEAR(int index) {
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/CreationConstants.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/CreationConstants.java
index 8f6cf92..ef9ecf1 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/CreationConstants.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/CreationConstants.java
@@ -10,12 +10,15 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.internal.common;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
+
public interface CreationConstants {
String DEFAULT_WEB_SOURCE_FOLDER = "src"; //$NON-NLS-1$
- String DEFAULT_EJB_SOURCE_FOLDER = "ejbModule";//$NON-NLS-1$
- String DEFAULT_CONNECTOR_SOURCE_FOLDER = "connectorModule";//$NON-NLS-1$
- String DEFAULT_APPCLIENT_SOURCE_FOLDER = "appClientModule";//$NON-NLS-1$
+ String DEFAULT_EJB_SOURCE_FOLDER = ProductManager.getProperty(IProductConstants.EJB_CONTENT_FOLDER);
+ String DEFAULT_CONNECTOR_SOURCE_FOLDER = ProductManager.getProperty(IProductConstants.JCA_CONTENT_FOLDER);
+ String DEFAULT_APPCLIENT_SOURCE_FOLDER = ProductManager.getProperty(IProductConstants.APP_CLIENT_CONTENT_FOLDER);
String EJB_CLIENT_NAME ="ClientProject";//$NON-NLS-1$
String CLIENT_JAR_URI="ClientJARURI";//$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java
index 28a5d3f..19aeaab 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathContainer.java
@@ -73,7 +73,7 @@
private static Map previousSelves = new Hashtable();
private class LastUpdate {
- private long dotClasspathTimeStamp = -1;
+ private long dotClasspathModificationStamp = -1;
private int refCount = 0;
private boolean[] isBinary = new boolean[refCount];
private IPath[] paths = new IPath[refCount];
@@ -93,8 +93,8 @@
}
IFile dotClasspath = javaProject.getProject().getFile(ProjectUtilities.DOT_CLASSPATH);
- long dotClasspathTimeStamp = dotClasspath.exists() ? dotClasspath.getLocalTimeStamp() : 0;
- if(dotClasspathTimeStamp != lastUpdate.dotClasspathTimeStamp){
+ long dotClasspathModificationStamp = dotClasspath.exists() ? dotClasspath.getModificationStamp() : 0;
+ if(dotClasspathModificationStamp != lastUpdate.dotClasspathModificationStamp){
return true;
}
@@ -155,7 +155,7 @@
}
IFile dotClasspath = javaProject.getProject().getFile(ProjectUtilities.DOT_CLASSPATH);
- lastUpdate.dotClasspathTimeStamp = dotClasspath.exists() ? dotClasspath.getLocalTimeStamp() : 0;
+ lastUpdate.dotClasspathModificationStamp = dotClasspath.exists() ? dotClasspath.getModificationStamp() : 0;
IVirtualComponent comp = null;
IVirtualReference ref = null;
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathUpdater.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathUpdater.java
index 55faa8b..688e6e5 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathUpdater.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/classpath/J2EEComponentClasspathUpdater.java
@@ -53,10 +53,14 @@
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeRootAdapter;
import org.eclipse.wst.common.componentcore.internal.impl.WTPModulesResourceFactory;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.internal.emf.utilities.ExtendedEcoreUtil;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
public class J2EEComponentClasspathUpdater implements IResourceChangeListener, IResourceDeltaVisitor {
@@ -453,19 +457,63 @@
case IResourceChangeEvent.POST_CHANGE:
scheduleJob = true;
event.getDelta().accept(this);
+ IResourceDelta[] d = event.getDelta().getAffectedChildren();
+ findNode(d);
+
break;
}
} catch (CoreException e) {
J2EEPlugin.getDefault().getLogger().logError(e);
- } finally {
+ }
+ finally {
resumeUpdates(scheduleJob);
}
}
+
+
+ public static void clearResourceTreeRootCache(WorkbenchComponent aModule) {
+
+ ResourceTreeRootAdapter resourceTreeAdapter = (ResourceTreeRootAdapter) ExtendedEcoreUtil
+ .getAdapter(aModule, aModule.eAdapters(),
+ ResourceTreeRootAdapter.DEPLOY_ADAPTER_TYPE);
+ if(null != resourceTreeAdapter) {
+ resourceTreeAdapter.setResourceTreeRoot(null);
+ }
+ resourceTreeAdapter = (ResourceTreeRootAdapter) ExtendedEcoreUtil
+ .getAdapter(aModule, aModule.eAdapters(),
+ ResourceTreeRootAdapter.SOURCE_ADAPTER_TYPE);
+ if(null != resourceTreeAdapter){
+ resourceTreeAdapter.setResourceTreeRoot(null);
+ }
+ }
+
/*
* Needs to notice changes to MANIFEST.MF in any J2EE projects, changes to
* .component in any J2EE Projects, and any archive changes in EAR projects
*/
+
+ public boolean findNode(IResourceDelta[] delta) {
+
+ for (int i = 0; i < delta.length; i++) {
+ if (delta[i].toString().indexOf(IJ2EEModuleConstants.COMPONENT_FILE_NAME) != -1) {
+ StructureEdit core = StructureEdit
+ .getStructureEditForRead(delta[i].getResource()
+ .getProject());
+ if(null != core){
+ WorkbenchComponent component = core.getComponent();
+ if(component != null){
+ clearResourceTreeRootCache(component);
+ }
+ }
+ } else {
+ findNode(delta[i].getAffectedChildren());
+ }
+ }
+
+ return true;
+ }
+
public boolean visit(IResourceDelta delta) {
IResource resource = delta.getResource();
switch (resource.getType()) {
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/JavaModelUtil.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/JavaModelUtil.java
index ec80d61..f1c5d79 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/JavaModelUtil.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/JavaModelUtil.java
@@ -19,32 +19,40 @@
import java.util.Arrays;
import java.util.HashSet;
-import java.util.Set;
+import java.util.Map;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICodeAssist;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IImportContainer;
-import org.eclipse.jdt.core.IImportDeclaration;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageDeclaration;
+import org.eclipse.jdt.core.IOpenable;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IParent;
+import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.WorkingCopyOwner;
import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstall2;
+import org.eclipse.jdt.launching.JavaRuntime;
//TODO this is a copy of the class in org.eclipse.jdt.ui and should be deleted once bugzilla 60567
// is addressed
@@ -55,220 +63,225 @@
* To change the template for this generated type comment go to Window - Preferences - Java - Code
* Generation - Code and Comments
*/
-public class JavaModelUtil {
+/**
+ * Utility methods for the Java Model.
+ */
+public final class JavaModelUtil {
+
/**
- * Finds a type by its qualified type name (dot separated).
+ * Only use this suffix for creating new .java files.
+ * In general, use one of the three *JavaLike*(..) methods in JavaCore or create
+ * a name from an existing compilation unit with {@link #getRenamedCUName(ICompilationUnit, String)}
+ * <p>
+ * Note: Unlike {@link JavaCore#getJavaLikeExtensions()}, this suffix includes a leading ".".
+ * </p>
*
- * @param jproject
- * The java project to search in
- * @param fullyQualifiedName
- * The fully qualified name (type name with enclosing type names and package (all
- * separated by dots))
- * @return The type found, or null if not existing
+ * @see JavaCore#getJavaLikeExtensions()
+ * @see JavaCore#isJavaLikeFileName(String)
+ * @see JavaCore#removeJavaLikeExtension(String)
+ * @see #getRenamedCUName(ICompilationUnit, String)
*/
+ public static final String DEFAULT_CU_SUFFIX= ".java"; //$NON-NLS-1$
+
+ /**
+ * Finds a type by its qualified type name (dot separated).
+ * @param jproject The java project to search in
+ * @param fullyQualifiedName The fully qualified name (type name with enclosing type names and package (all separated by dots))
+ * @return The type found, or null if not existing
+ */
public static IType findType(IJavaProject jproject, String fullyQualifiedName) throws JavaModelException {
//workaround for bug 22883
- IType type = jproject.findType(fullyQualifiedName);
+ IType type= jproject.findType(fullyQualifiedName);
if (type != null)
return type;
- IPackageFragmentRoot[] roots = jproject.getPackageFragmentRoots();
- for (int i = 0; i < roots.length; i++) {
- IPackageFragmentRoot root = roots[i];
- type = findType(root, fullyQualifiedName);
+ IPackageFragmentRoot[] roots= jproject.getPackageFragmentRoots();
+ for (int i= 0; i < roots.length; i++) {
+ IPackageFragmentRoot root= roots[i];
+ type= findType(root, fullyQualifiedName);
if (type != null && type.exists())
return type;
- }
+ }
return null;
}
-
- /**
- * Returns <code>true</code> if the given package fragment root is referenced. This means it
- * is own by a different project but is referenced by the root's parent. Returns
- * <code>false</code> if the given root doesn't have an underlying resource.
- */
- public static boolean isReferenced(IPackageFragmentRoot root) {
- IResource resource = root.getResource();
- if (resource != null) {
- IProject jarProject = resource.getProject();
- IProject container = root.getJavaProject().getProject();
- return !container.equals(jarProject);
- }
- return false;
+
+ /**
+ * Finds a type by its qualified type name (dot separated).
+ * @param jproject The java project to search in
+ * @param fullyQualifiedName The fully qualified name (type name with enclosing type names and package (all separated by dots))
+ * @param owner the working copy owner
+ * @return The type found, or null if not existing
+ */
+ public static IType findType(IJavaProject jproject, String fullyQualifiedName, WorkingCopyOwner owner) throws JavaModelException {
+ //workaround for bug 22883
+ IType type= jproject.findType(fullyQualifiedName, owner);
+ if (type != null)
+ return type;
+ IPackageFragmentRoot[] roots= jproject.getPackageFragmentRoots();
+ for (int i= 0; i < roots.length; i++) {
+ IPackageFragmentRoot root= roots[i];
+ type= findType(root, fullyQualifiedName);
+ if (type != null && type.exists())
+ return type;
+ }
+ return null;
}
+
- private static IType findType(IPackageFragmentRoot root, String fullyQualifiedName) throws JavaModelException {
- IJavaElement[] children = root.getChildren();
- for (int i = 0; i < children.length; i++) {
- IJavaElement element = children[i];
- if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
- IPackageFragment pack = (IPackageFragment) element;
- if (!fullyQualifiedName.startsWith(pack.getElementName()))
+
+ private static IType findType(IPackageFragmentRoot root, String fullyQualifiedName) throws JavaModelException{
+ IJavaElement[] children= root.getChildren();
+ for (int i= 0; i < children.length; i++) {
+ IJavaElement element= children[i];
+ if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT){
+ IPackageFragment pack= (IPackageFragment)element;
+ if (! fullyQualifiedName.startsWith(pack.getElementName()))
continue;
- IType type = findType(pack, fullyQualifiedName);
+ IType type= findType(pack, fullyQualifiedName);
if (type != null && type.exists())
return type;
}
- }
+ }
return null;
}
-
- private static IType findType(IPackageFragment pack, String fullyQualifiedName) throws JavaModelException {
- ICompilationUnit[] cus = pack.getCompilationUnits();
- for (int i = 0; i < cus.length; i++) {
- ICompilationUnit unit = cus[i];
- IType type = findType(unit, fullyQualifiedName);
+
+ private static IType findType(IPackageFragment pack, String fullyQualifiedName) throws JavaModelException{
+ ICompilationUnit[] cus= pack.getCompilationUnits();
+ for (int i= 0; i < cus.length; i++) {
+ ICompilationUnit unit= cus[i];
+ IType type= findType(unit, fullyQualifiedName);
if (type != null && type.exists())
return type;
}
return null;
}
-
- private static IType findType(ICompilationUnit cu, String fullyQualifiedName) throws JavaModelException {
- IType[] types = cu.getAllTypes();
- for (int i = 0; i < types.length; i++) {
- IType type = types[i];
+
+ private static IType findType(ICompilationUnit cu, String fullyQualifiedName) throws JavaModelException{
+ IType[] types= cu.getAllTypes();
+ for (int i= 0; i < types.length; i++) {
+ IType type= types[i];
if (getFullyQualifiedName(type).equals(fullyQualifiedName))
return type;
}
return null;
}
-
+
/**
- * Finds a type by package and type name.
- *
- * @param jproject
- * the java project to search in
- * @param pack
- * The package name
- * @param typeQualifiedName
- * the type qualified name (type name with enclosing type names (separated by dots))
- * @return the type found, or null if not existing
- * @deprecated Use IJavaProject.findType(String, String) instead
- */
- public static IType findType(IJavaProject jproject, String pack, String typeQualifiedName) throws JavaModelException {
- return jproject.findType(pack, typeQualifiedName);
- }
-
- /**
- * Finds a type container by container name. The returned element will be of type
- * <code>IType</code> or a <code>IPackageFragment</code>.<code>null</code> is returned
- * if the type container could not be found.
- *
- * @param jproject
- * The Java project defining the context to search
- * @param typeContainerName
- * A dot separarted name of the type container
+ * Finds a type container by container name.
+ * The returned element will be of type <code>IType</code> or a <code>IPackageFragment</code>.
+ * <code>null</code> is returned if the type container could not be found.
+ * @param jproject The Java project defining the context to search
+ * @param typeContainerName A dot separated name of the type container
* @see #getTypeContainerName(IType)
*/
public static IJavaElement findTypeContainer(IJavaProject jproject, String typeContainerName) throws JavaModelException {
// try to find it as type
- IJavaElement result = jproject.findType(typeContainerName);
+ IJavaElement result= jproject.findType(typeContainerName);
if (result == null) {
// find it as package
- IPath path = new Path(typeContainerName.replace('.', '/'));
- result = jproject.findElement(path);
+ IPath path= new Path(typeContainerName.replace('.', '/'));
+ result= jproject.findElement(path);
if (!(result instanceof IPackageFragment)) {
- result = null;
+ result= null;
}
-
+
}
return result;
- }
-
- /**
- * Finds a type in a compilation unit. Typical usage is to find the corresponding type in a
- * working copy.
- *
- * @param cu
- * the compilation unit to search in
- * @param typeQualifiedName
- * the type qualified name (type name with enclosing type names (separated by dots))
+ }
+
+ /**
+ * Finds a type in a compilation unit. Typical usage is to find the corresponding
+ * type in a working copy.
+ * @param cu the compilation unit to search in
+ * @param typeQualifiedName the type qualified name (type name with enclosing type names (separated by dots))
* @return the type found, or null if not existing
- */
+ */
public static IType findTypeInCompilationUnit(ICompilationUnit cu, String typeQualifiedName) throws JavaModelException {
- IType[] types = cu.getAllTypes();
- for (int i = 0; i < types.length; i++) {
- String currName = getTypeQualifiedName(types[i]);
+ IType[] types= cu.getAllTypes();
+ for (int i= 0; i < types.length; i++) {
+ String currName= getTypeQualifiedName(types[i]);
if (typeQualifiedName.equals(currName)) {
return types[i];
}
}
return null;
}
-
- /**
- * Finds a a member in a compilation unit. Typical usage is to find the corresponding member in
- * a working copy.
+
+ /**
+ * Returns the element of the given compilation unit which is "equal" to the
+ * given element. Note that the given element usually has a parent different
+ * from the given compilation unit.
*
- * @param cu
- * the compilation unit (eg. working copy) to search in
- * @param member
- * the member (eg. from the original)
- * @return the member found, or null if not existing
- */
- public static IMember findMemberInCompilationUnit(ICompilationUnit cu, IMember member) {
- IJavaElement[] elements = cu.findElements(member);
- if (elements != null && elements.length > 0) {
- return (IMember) elements[0];
- }
- return null;
- }
-
-
- /**
- * Returns the element of the given compilation unit which is "equal" to the given element. Note
- * that the given element usually has a parent different from the given compilation unit.
- *
- * @param cu
- * the cu to search in
- * @param element
- * the element to look for
+ * @param cu the cu to search in
+ * @param element the element to look for
* @return an element of the given cu "equal" to the given element
- */
+ */
public static IJavaElement findInCompilationUnit(ICompilationUnit cu, IJavaElement element) {
- IJavaElement[] elements = cu.findElements(element);
+ IJavaElement[] elements= cu.findElements(element);
if (elements != null && elements.length > 0) {
return elements[0];
}
return null;
}
-
+
/**
- * Returns the qualified type name of the given type using '.' as separators. This is a replace
- * for IType.getTypeQualifiedName() which uses '$' as separators. As '$' is also a valid
- * character in an id this is ambiguous. JavaCore PR: 1GCFUNT
+ * Returns the qualified type name of the given type using '.' as separators.
+ * This is a replace for IType.getTypeQualifiedName()
+ * which uses '$' as separators. As '$' is also a valid character in an id
+ * this is ambiguous. JavaCore PR: 1GCFUNT
*/
public static String getTypeQualifiedName(IType type) {
+ try {
+ if (type.isBinary() && !type.isAnonymous()) {
+ IType declaringType= type.getDeclaringType();
+ if (declaringType != null) {
+ return getTypeQualifiedName(declaringType) + '.' + type.getElementName();
+ }
+ }
+ } catch (JavaModelException e) {
+ // ignore
+ }
return type.getTypeQualifiedName('.');
}
-
+
/**
- * Returns the fully qualified name of the given type using '.' as separators. This is a replace
- * for IType.getFullyQualifiedTypeName which uses '$' as separators. As '$' is also a valid
- * character in an id this is ambiguous. JavaCore PR: 1GCFUNT
+ * Returns the fully qualified name of the given type using '.' as separators.
+ * This is a replace for IType.getFullyQualifiedTypeName
+ * which uses '$' as separators. As '$' is also a valid character in an id
+ * this is ambiguous. JavaCore PR: 1GCFUNT
*/
public static String getFullyQualifiedName(IType type) {
+ try {
+ if (type.isBinary() && !type.isAnonymous()) {
+ IType declaringType= type.getDeclaringType();
+ if (declaringType != null) {
+ return getFullyQualifiedName(declaringType) + '.' + type.getElementName();
+ }
+ }
+ } catch (JavaModelException e) {
+ // ignore
+ }
return type.getFullyQualifiedName('.');
}
-
+
/**
* Returns the fully qualified name of a type's container. (package name or enclosing type name)
*/
public static String getTypeContainerName(IType type) {
- IType outerType = type.getDeclaringType();
+ IType outerType= type.getDeclaringType();
if (outerType != null) {
- return outerType.getFullyQualifiedName('.');
+ return getFullyQualifiedName(outerType);
+ } else {
+ return type.getPackageFragment().getElementName();
}
- return type.getPackageFragment().getElementName();
}
-
-
+
+
/**
- * Concatenates two names. Uses a dot for separation. Both strings can be empty or
- * <code>null</code>.
+ * Concatenates two names. Uses a dot for separation.
+ * Both strings can be empty or <code>null</code>.
*/
public static String concatenateName(String name1, String name2) {
- StringBuffer buf = new StringBuffer();
+ StringBuffer buf= new StringBuffer();
if (name1 != null && name1.length() > 0) {
buf.append(name1);
}
@@ -277,16 +290,16 @@
buf.append('.');
}
buf.append(name2);
- }
+ }
return buf.toString();
}
-
+
/**
- * Concatenates two names. Uses a dot for separation. Both strings can be empty or
- * <code>null</code>.
+ * Concatenates two names. Uses a dot for separation.
+ * Both strings can be empty or <code>null</code>.
*/
public static String concatenateName(char[] name1, char[] name2) {
- StringBuffer buf = new StringBuffer();
+ StringBuffer buf= new StringBuffer();
if (name1 != null && name1.length > 0) {
buf.append(name1);
}
@@ -295,214 +308,152 @@
buf.append('.');
}
buf.append(name2);
- }
+ }
return buf.toString();
- }
-
+ }
+
/**
- * Evaluates if a member (possible from another package) is visible from elements in a package.
- *
- * @param member
- * The member to test the visibility for
- * @param pack
- * The package in focus
+ * Evaluates if a member (possible from another package) is visible from
+ * elements in a package.
+ * @param member The member to test the visibility for
+ * @param pack The package in focus
*/
public static boolean isVisible(IMember member, IPackageFragment pack) throws JavaModelException {
-
- int type = member.getElementType();
- if (type == IJavaElement.INITIALIZER || (type == IJavaElement.METHOD && member.getElementName().startsWith("<"))) { //$NON-NLS-1$
+
+ int type= member.getElementType();
+ if (type == IJavaElement.INITIALIZER || (type == IJavaElement.METHOD && member.getElementName().startsWith("<"))) { //$NON-NLS-1$
return false;
}
-
- int otherflags = member.getFlags();
- IType declaringType = member.getDeclaringType();
- if (Flags.isPublic(otherflags) || (declaringType != null && declaringType.isInterface())) {
+
+ int otherflags= member.getFlags();
+ IType declaringType= member.getDeclaringType();
+ if (Flags.isPublic(otherflags) || (declaringType != null && isInterfaceOrAnnotation(declaringType))) {
return true;
} else if (Flags.isPrivate(otherflags)) {
return false;
- }
-
- IPackageFragment otherpack = (IPackageFragment) findParentOfKind(member, IJavaElement.PACKAGE_FRAGMENT);
+ }
+
+ IPackageFragment otherpack= (IPackageFragment) member.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
return (pack != null && otherpack != null && isSamePackage(pack, otherpack));
}
-
+
/**
- * Evaluates if a member in the focus' element hierarchy is visible from elements in a package.
- *
- * @param member
- * The member to test the visibility for
- * @param pack
- * The package of the focus element focus
+ * Evaluates if a member in the focus' element hierarchy is visible from
+ * elements in a package.
+ * @param member The member to test the visibility for
+ * @param pack The package of the focus element focus
*/
public static boolean isVisibleInHierarchy(IMember member, IPackageFragment pack) throws JavaModelException {
- int type = member.getElementType();
- if (type == IJavaElement.INITIALIZER || (type == IJavaElement.METHOD && member.getElementName().startsWith("<"))) { //$NON-NLS-1$
+ int type= member.getElementType();
+ if (type == IJavaElement.INITIALIZER || (type == IJavaElement.METHOD && member.getElementName().startsWith("<"))) { //$NON-NLS-1$
return false;
}
-
- int otherflags = member.getFlags();
-
- IType declaringType = member.getDeclaringType();
- if (Flags.isPublic(otherflags) || Flags.isProtected(otherflags) || (declaringType != null && declaringType.isInterface())) {
+
+ int otherflags= member.getFlags();
+
+ IType declaringType= member.getDeclaringType();
+ if (Flags.isPublic(otherflags) || Flags.isProtected(otherflags) || (declaringType != null && isInterfaceOrAnnotation(declaringType))) {
return true;
} else if (Flags.isPrivate(otherflags)) {
return false;
- }
-
- IPackageFragment otherpack = (IPackageFragment) findParentOfKind(member, IJavaElement.PACKAGE_FRAGMENT);
+ }
+
+ IPackageFragment otherpack= (IPackageFragment) member.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
return (pack != null && pack.equals(otherpack));
}
-
-
+
+
/**
- * Returns the package fragment root of <code>IJavaElement</code>. If the given element is
- * already a package fragment root, the element itself is returned.
+ * Returns the package fragment root of <code>IJavaElement</code>. If the given
+ * element is already a package fragment root, the element itself is returned.
*/
public static IPackageFragmentRoot getPackageFragmentRoot(IJavaElement element) {
return (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
}
-
+
/**
- * Returns the parent of the supplied java element that conforms to the given parent type or
- * <code>null</code>, if such a parent doesn't exit.
- *
- * @deprecated Use element.getParent().getAncestor(kind);
- */
- public static IJavaElement findParentOfKind(IJavaElement element, int kind) {
- if (element != null && element.getParent() != null) {
- return element.getParent().getAncestor(kind);
- }
- return null;
- }
-
- /**
- * Finds a method in a type. This searches for a method with the same name and signature.
- * Parameter types are only compared by the simple name, no resolving for the fully qualified
- * type name is done. Constructors are only compared by parameters, not the name.
- *
- * @param name
- * The name of the method to find
- * @param paramTypes
- * The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
- * @param isConstructor
- * If the method is a constructor
+ * Finds a method in a type.
+ * This searches for a method with the same name and signature. Parameter types are only
+ * compared by the simple name, no resolving for the fully qualified type name is done.
+ * Constructors are only compared by parameters, not the name.
+ * @param name The name of the method to find
+ * @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
+ * @param isConstructor If the method is a constructor
* @return The first found method or <code>null</code>, if nothing found
*/
public static IMethod findMethod(String name, String[] paramTypes, boolean isConstructor, IType type) throws JavaModelException {
- return findMethod(name, paramTypes, isConstructor, type.getMethods());
- }
-
- /**
- * Finds a method by name. This searches for a method with a name and signature. Parameter types
- * are only compared by the simple name, no resolving for the fully qualified type name is done.
- * Constructors are only compared by parameters, not the name.
- *
- * @param name
- * The name of the method to find
- * @param paramTypes
- * The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
- * @param isConstructor
- * If the method is a constructor
- * @param methods
- * The methods to search in
- * @return The found method or <code>null</code>, if nothing found
- */
- public static IMethod findMethod(String name, String[] paramTypes, boolean isConstructor, IMethod[] methods) throws JavaModelException {
- for (int i = methods.length - 1; i >= 0; i--) {
+ IMethod[] methods= type.getMethods();
+ for (int i= 0; i < methods.length; i++) {
if (isSameMethodSignature(name, paramTypes, isConstructor, methods[i])) {
return methods[i];
}
}
return null;
}
-
-
+
/**
- * Finds a method declararion in a type's hierarchy. The search is top down, so this returns the
- * first declaration of the method in the hierarchy. This searches for a method with a name and
- * signature. Parameter types are only compared by the simple name, no resolving for the fully
- * qualified type name is done. Constructors are only compared by parameters, not the name.
- *
- * @param type
- * Searches in this type's supertypes.
- * @param name
- * The name of the method to find
- * @param paramTypes
- * The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
- * @param isConstructor
- * If the method is a constructor
- * @return The first method found or null, if nothing found
+ * @deprecated use {@link #findMethodInHierarchy(ITypeHierarchy, IType, String, String[], boolean)}
*/
- public static IMethod findMethodDeclarationInHierarchy(ITypeHierarchy hierarchy, IType type, String name, String[] paramTypes, boolean isConstructor) throws JavaModelException {
- IType[] superTypes = hierarchy.getAllSupertypes(type);
- for (int i = superTypes.length - 1; i >= 0; i--) {
- IMethod first = findMethod(name, paramTypes, isConstructor, superTypes[i]);
- if (first != null && !Flags.isPrivate(first.getFlags())) {
- // the order getAllSupertypes does make assumptions of the order of inner elements
- // -> search recursivly
- IMethod res = findMethodDeclarationInHierarchy(hierarchy, first.getDeclaringType(), name, paramTypes, isConstructor);
+ public static IMethod findMethodImplementationInHierarchy(ITypeHierarchy hierarchy, IType type, String name, String[] paramTypes, boolean isConstructor) throws JavaModelException {
+ return findMethodInHierarchy(hierarchy, type, name, paramTypes, isConstructor);
+ }
+
+ /**
+ * Finds a method in a type and all its super types. The super class hierarchy is searched first, then the super interfaces.
+ * This searches for a method with the same name and signature. Parameter types are only
+ * compared by the simple name, no resolving for the fully qualified type name is done.
+ * Constructors are only compared by parameters, not the name.
+ * NOTE: For finding overridden methods or for finding the declaring method, use {@link MethodOverrideTester}
+ * @param hierarchy The hierarchy containing the type
+ * @param type The type to start the search from
+ * @param name The name of the method to find
+ * @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
+ * @param isConstructor If the method is a constructor
+ * @return The first found method or <code>null</code>, if nothing found
+ */
+ public static IMethod findMethodInHierarchy(ITypeHierarchy hierarchy, IType type, String name, String[] paramTypes, boolean isConstructor) throws JavaModelException {
+ IMethod method= findMethod(name, paramTypes, isConstructor, type);
+ if (method != null) {
+ return method;
+ }
+ IType superClass= hierarchy.getSuperclass(type);
+ if (superClass != null) {
+ IMethod res= findMethodInHierarchy(hierarchy, superClass, name, paramTypes, isConstructor);
+ if (res != null) {
+ return res;
+ }
+ }
+ if (!isConstructor) {
+ IType[] superInterfaces= hierarchy.getSuperInterfaces(type);
+ for (int i= 0; i < superInterfaces.length; i++) {
+ IMethod res= findMethodInHierarchy(hierarchy, superInterfaces[i], name, paramTypes, false);
if (res != null) {
return res;
}
- return first;
}
}
- return null;
+ return method;
}
-
+
+
/**
- * Finds a method implementation in a type's classhierarchy. The search is bottom-up, so this
- * returns the nearest overridden method. Does not find methods in interfaces or abstract
- * methods. This searches for a method with a name and signature. Parameter types are only
- * compared by the simple name, no resolving for the fully qualified type name is done.
- * Constructors are only compared by parameters, not the name.
- *
- * @param type
- * Type to search the superclasses
- * @param name
- * The name of the method to find
- * @param paramTypes
- * The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
- * @param isConstructor
- * If the method is a constructor
- * @return The first method found or null, if nothing found
- */
- public static IMethod findMethodImplementationInHierarchy(ITypeHierarchy hierarchy, IType type, String name, String[] paramTypes, boolean isConstructor) throws JavaModelException {
- IType[] superTypes = hierarchy.getAllSuperclasses(type);
- for (int i = 0; i < superTypes.length; i++) {
- IMethod found = findMethod(name, paramTypes, isConstructor, superTypes[i]);
- if (found != null) {
- if (Flags.isAbstract(found.getFlags())) {
- return null;
- }
- return found;
- }
- }
- return null;
- }
-
- /**
- * Tests if a method equals to the given signature. Parameter types are only compared by the
- * simple name, no resolving for the fully qualified type name is done. Constructors are only
- * compared by parameters, not the name.
- *
- * @param name
- * Name of the method
- * @param paramTypes
- * The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
- * @param isConstructor
- * Specifies if the method is a constructor
- * @return Returns <code>true</code> if the method has the given name and parameter types and
- * constructor state.
+ * Tests if a method equals to the given signature.
+ * Parameter types are only compared by the simple name, no resolving for
+ * the fully qualified type name is done. Constructors are only compared by
+ * parameters, not the name.
+ * @param name Name of the method
+ * @param paramTypes The type signatures of the parameters e.g. <code>{"QString;","I"}</code>
+ * @param isConstructor Specifies if the method is a constructor
+ * @return Returns <code>true</code> if the method has the given name and parameter types and constructor state.
*/
public static boolean isSameMethodSignature(String name, String[] paramTypes, boolean isConstructor, IMethod curr) throws JavaModelException {
if (isConstructor || name.equals(curr.getElementName())) {
if (isConstructor == curr.isConstructor()) {
- String[] currParamTypes = curr.getParameterTypes();
+ String[] currParamTypes= curr.getParameterTypes();
if (paramTypes.length == currParamTypes.length) {
- for (int i = 0; i < paramTypes.length; i++) {
- String t1 = Signature.getSimpleName(Signature.toString(paramTypes[i]));
- String t2 = Signature.getSimpleName(Signature.toString(currParamTypes[i]));
+ for (int i= 0; i < paramTypes.length; i++) {
+ String t1= Signature.getSimpleName(Signature.toString(paramTypes[i]));
+ String t2= Signature.getSimpleName(Signature.toString(currParamTypes[i]));
if (!t1.equals(t2)) {
return false;
}
@@ -514,165 +465,129 @@
return false;
}
-
/**
- * Tests if two <code>IPackageFragment</code> s represent the same logical java package.
- *
+ * Tests if two <code>IPackageFragment</code>s represent the same logical java package.
* @return <code>true</code> if the package fragments' names are equal.
*/
public static boolean isSamePackage(IPackageFragment pack1, IPackageFragment pack2) {
return pack1.getElementName().equals(pack2.getElementName());
}
-
+
/**
* Checks whether the given type has a valid main method or not.
*/
public static boolean hasMainMethod(IType type) throws JavaModelException {
- IMethod[] methods = type.getMethods();
- for (int i = 0; i < methods.length; i++) {
+ IMethod[] methods= type.getMethods();
+ for (int i= 0; i < methods.length; i++) {
if (methods[i].isMainMethod()) {
return true;
}
}
return false;
}
-
+
/**
* Checks if the field is boolean.
*/
- public static boolean isBoolean(IField field) throws JavaModelException {
+ public static boolean isBoolean(IField field) throws JavaModelException{
return field.getTypeSignature().equals(Signature.SIG_BOOLEAN);
}
-
+
/**
- * Returns true if the element is on the build path of the given project
- *
- * @deprecated Use jproject.isOnClasspath(element);
+ * @return <code>true</code> iff the type is an interface or an annotation
*/
- public static boolean isOnBuildPath(IJavaProject jproject, IJavaElement element) {
- return jproject.isOnClasspath(element);
+ public static boolean isInterfaceOrAnnotation(IType type) throws JavaModelException {
+ return type.isInterface();
}
-
- /**
- * Tests if the given element is on the class path of its containing project. Handles the case
- * that the containing project isn't a Java project.
- */
- public static boolean isOnClasspath(IJavaElement element) {
- IJavaProject project = element.getJavaProject();
- if (!project.exists())
- return false;
- return project.isOnClasspath(element);
- }
-
+
/**
* Resolves a type name in the context of the declaring type.
*
- * @param refTypeSig
- * the type name in signature notation (for example 'QVector') this can also be an
- * array type, but dimensions will be ignored.
- * @param declaringType
- * the context for resolving (type where the reference was made in)
- * @return returns the fully qualified type name or build-in-type name. if a unresoved type
- * couldn't be resolved null is returned
+ * @param refTypeSig the type name in signature notation (for example 'QVector') this can also be an array type, but dimensions will be ignored.
+ * @param declaringType the context for resolving (type where the reference was made in)
+ * @return returns the fully qualified type name or build-in-type name. if a unresolved type couldn't be resolved null is returned
*/
public static String getResolvedTypeName(String refTypeSig, IType declaringType) throws JavaModelException {
- int arrayCount = Signature.getArrayCount(refTypeSig);
- char type = refTypeSig.charAt(arrayCount);
+ int arrayCount= Signature.getArrayCount(refTypeSig);
+ char type= refTypeSig.charAt(arrayCount);
if (type == Signature.C_UNRESOLVED) {
- int semi = refTypeSig.indexOf(Signature.C_SEMICOLON, arrayCount + 1);
- if (semi == -1) {
- throw new IllegalArgumentException();
+ String name= ""; //$NON-NLS-1$
+ int bracket= refTypeSig.indexOf(Signature.C_GENERIC_START, arrayCount + 1);
+ if (bracket > 0)
+ name= refTypeSig.substring(arrayCount + 1, bracket);
+ else {
+ int semi= refTypeSig.indexOf(Signature.C_SEMICOLON, arrayCount + 1);
+ if (semi == -1) {
+ throw new IllegalArgumentException();
+ }
+ name= refTypeSig.substring(arrayCount + 1, semi);
}
- String name = refTypeSig.substring(arrayCount + 1, semi);
-
- String[][] resolvedNames = declaringType.resolveType(name);
+ String[][] resolvedNames= declaringType.resolveType(name);
if (resolvedNames != null && resolvedNames.length > 0) {
- return concatenateName(resolvedNames[0][0], resolvedNames[0][1]);
+ return JavaModelUtil.concatenateName(resolvedNames[0][0], resolvedNames[0][1]);
}
return null;
+ } else {
+ return Signature.toString(refTypeSig.substring(arrayCount));
}
- return Signature.toString(refTypeSig.substring(arrayCount));
}
-
+
/**
* Returns if a CU can be edited.
*/
- public static boolean isEditable(ICompilationUnit cu) {
- IResource resource = toOriginal(cu).getResource();
+ public static boolean isEditable(ICompilationUnit cu) {
+ Assert.isNotNull(cu);
+ IResource resource= cu.getPrimary().getResource();
return (resource.exists() && !resource.getResourceAttributes().isReadOnly());
}
/**
- * Finds a qualified import for a type name.
+ * Returns the original if the given member. If the member is already
+ * an original the input is returned. The returned member might not exist
+ *
+ * @deprecated Replace by IMember#getPrimaryElement() if <code>member</code> is not part
+ * of a shared working copy owner. Also have a look at http://bugs.eclipse.org/bugs/show_bug.cgi?id=18568
*/
- public static IImportDeclaration findImport(ICompilationUnit cu, String simpleName) throws JavaModelException {
- IImportDeclaration[] existing = cu.getImports();
- for (int i = 0; i < existing.length; i++) {
- String curr = existing[i].getElementName();
- if (curr.endsWith(simpleName)) {
- int dotPos = curr.length() - simpleName.length() - 1;
- if ((dotPos == -1) || (dotPos > 0 && curr.charAt(dotPos) == '.')) {
- return existing[i];
- }
- }
+ public static IMember toOriginal(IMember member) {
+ if (member instanceof IMethod)
+ return toOriginalMethod((IMethod)member);
+
+ // TODO: remove toOriginalMethod(IMethod)
+
+ return (IMember) member.getPrimaryElement();
+ /*ICompilationUnit cu= member.getCompilationUnit();
+ if (cu != null && cu.isWorkingCopy())
+ return (IMember)cu.getOriginal(member);
+ return member;*/
+ }
+
+ /*
+ * TODO remove if toOriginal(IMember) can be removed
+ * XXX workaround for bug 18568
+ * http://bugs.eclipse.org/bugs/show_bug.cgi?id=18568
+ * to be removed once the bug is fixed
+ */
+ private static IMethod toOriginalMethod(IMethod method) {
+ ICompilationUnit cu= method.getCompilationUnit();
+ if (cu == null || isPrimary(cu)) {
+ return method;
}
- return null;
- }
-
- //private static boolean PRIMARY_ONLY = false;
-
-
-
- /**
- * Returns the original element if the given element is a working copy. If the cu is already an
- * original the input element is returned. The returned element might not exist
- */
- public static IJavaElement toOriginal(IJavaElement element) {
- return element.getPrimaryElement();
- }
-
- /**
- * @deprecated Inline this method.
- */
- public static IMember toWorkingCopy(IMember member) {
- return member;
- }
-
- /**
- * @deprecated Inline this method.
- */
- public static IPackageDeclaration toWorkingCopy(IPackageDeclaration declaration) {
- return declaration;
- }
-
- /**
- * @deprecated Inline this method.
- */
- public static IJavaElement toWorkingCopy(IJavaElement elem) {
- return elem;
- }
-
- /**
- * @deprecated Inline this method.
- */
- public static IImportContainer toWorkingCopy(IImportContainer container) {
- return container;
-
- }
-
- /**
- * @deprecated Inline this method.
- */
- public static IImportDeclaration toWorkingCopy(IImportDeclaration importDeclaration) {
- return importDeclaration;
- }
-
-
- /**
- * @deprecated Inline this method.
- */
- public static ICompilationUnit toWorkingCopy(ICompilationUnit cu) {
- return cu;
+ try{
+ //use the workaround only if needed
+ if (! method.getElementName().equals(method.getDeclaringType().getElementName()))
+ return (IMethod) method.getPrimaryElement();
+
+ IType originalType = (IType) toOriginal(method.getDeclaringType());
+ IMethod[] methods = originalType.findMethods(method);
+ boolean isConstructor = method.isConstructor();
+ for (int i=0; i < methods.length; i++) {
+ if (methods[i].isConstructor() == isConstructor)
+ return methods[i];
+ }
+ return null;
+ } catch (JavaModelException e){
+ return null;
+ }
}
/**
@@ -682,92 +597,301 @@
return cu.getOwner() == null;
}
-
/*
* http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
*
- * Reconciling happens in a separate thread. This can cause a situation where the Java element
- * gets disposed after an exists test has been done. So we should not log not present exceptions
- * when they happen in working copies.
+ * Reconciling happens in a separate thread. This can cause a situation where the
+ * Java element gets disposed after an exists test has been done. So we should not
+ * log not present exceptions when they happen in working copies.
*/
- public static boolean filterNotPresentException(CoreException exception) {
+ public static boolean isExceptionToBeLogged(CoreException exception) {
if (!(exception instanceof JavaModelException))
return true;
- JavaModelException je = (JavaModelException) exception;
+ JavaModelException je= (JavaModelException)exception;
if (!je.isDoesNotExist())
return true;
- IJavaElement[] elements = je.getJavaModelStatus().getElements();
- for (int i = 0; i < elements.length; i++) {
- IJavaElement element = elements[i];
- ICompilationUnit unit = (ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT);
+ IJavaElement[] elements= je.getJavaModelStatus().getElements();
+ for (int i= 0; i < elements.length; i++) {
+ IJavaElement element= elements[i];
+ // if the element is already a compilation unit don't log
+ // does not exist exceptions. See bug
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=75894
+ // for more details
+ if (element.getElementType() == IJavaElement.COMPILATION_UNIT)
+ continue;
+ ICompilationUnit unit= (ICompilationUnit)element.getAncestor(IJavaElement.COMPILATION_UNIT);
if (unit == null)
return true;
if (!unit.isWorkingCopy())
return true;
}
- return false;
+ return false;
}
- public static IType[] getAllSuperTypes(IType type, IProgressMonitor pm) throws JavaModelException {
- //workaround for 23656
- Set types = new HashSet(Arrays.asList(type.newSupertypeHierarchy(pm).getAllSupertypes(type)));
- IType objekt = type.getJavaProject().findType("java.lang.Object");//$NON-NLS-1$
- if (objekt != null)
- types.add(objekt);
- return (IType[]) types.toArray(new IType[types.size()]);
- }
-
- public static boolean isExcludedPath(IPath resourcePath, IPath[] exclusionPatterns) {
- char[] path = resourcePath.toString().toCharArray();
- for (int i = 0, length = exclusionPatterns.length; i < length; i++) {
- char[] pattern = exclusionPatterns[i].toString().toCharArray();
- if (CharOperation.pathMatch(pattern, path, true, '/')) {
- return true;
+ public static boolean isSuperType(ITypeHierarchy hierarchy, IType possibleSuperType, IType type) {
+ // filed bug 112635 to add this method to ITypeHierarchy
+ IType superClass= hierarchy.getSuperclass(type);
+ if (superClass != null && (possibleSuperType.equals(superClass) || isSuperType(hierarchy, possibleSuperType, superClass))) {
+ return true;
+ }
+ if (Flags.isInterface(hierarchy.getCachedFlags(possibleSuperType))) {
+ IType[] superInterfaces= hierarchy.getSuperInterfaces(type);
+ for (int i= 0; i < superInterfaces.length; i++) {
+ IType curr= superInterfaces[i];
+ if (possibleSuperType.equals(curr) || isSuperType(hierarchy, possibleSuperType, curr)) {
+ return true;
+ }
}
}
return false;
}
+
+ public static boolean isExcludedPath(IPath resourcePath, IPath[] exclusionPatterns) {
+ char[] path = resourcePath.toString().toCharArray();
+ for (int i = 0, length = exclusionPatterns.length; i < length; i++) {
+ char[] pattern= exclusionPatterns[i].toString().toCharArray();
+ if (CharOperation.pathMatch(pattern, path, true, '/')) {
+ return true;
+ }
+ }
+ return false;
+ }
/*
- * Returns whether the given resource path matches one of the exclusion patterns.
+ * Returns whether the given resource path matches one of the exclusion
+ * patterns.
*
* @see IClasspathEntry#getExclusionPatterns
*/
public final static boolean isExcluded(IPath resourcePath, char[][] exclusionPatterns) {
- if (exclusionPatterns == null)
- return false;
+ if (exclusionPatterns == null) return false;
char[] path = resourcePath.toString().toCharArray();
for (int i = 0, length = exclusionPatterns.length; i < length; i++)
if (CharOperation.pathMatch(exclusionPatterns[i], path, true, '/'))
return true;
return false;
- }
-
+ }
+
/**
* Force a reconcile of a compilation unit.
- *
* @param unit
*/
public static void reconcile(ICompilationUnit unit) throws JavaModelException {
- synchronized (unit) {
- unit.reconcile();
+ unit.reconcile(
+ ICompilationUnit.NO_AST,
+ false /* don't force problem detection */,
+ null /* use primary owner */,
+ null /* no progress monitor */);
+ }
+
+ /**
+ * Helper method that tests if an classpath entry can be found in a
+ * container. <code>null</code> is returned if the entry can not be found
+ * or if the container does not allows the configuration of source
+ * attachments
+ * @param jproject The container's parent project
+ * @param containerPath The path of the container
+ * @param libPath The path of the library to be found
+ * @return IClasspathEntry A classpath entry from the container of
+ * <code>null</code> if the container can not be modified.
+ */
+ public static IClasspathEntry getClasspathEntryToEdit(IJavaProject jproject, IPath containerPath, IPath libPath) throws JavaModelException {
+ IClasspathContainer container= JavaCore.getClasspathContainer(containerPath, jproject);
+ ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
+ if (container != null && initializer != null && initializer.canUpdateClasspathContainer(containerPath, jproject)) {
+ IClasspathEntry[] entries= container.getClasspathEntries();
+ for (int i= 0; i < entries.length; i++) {
+ IClasspathEntry curr= entries[i];
+ IClasspathEntry resolved= JavaCore.getResolvedClasspathEntry(curr);
+ if (resolved != null && libPath.equals(resolved.getPath())) {
+ return curr; // return the real entry
+ }
+ }
+ }
+ return null; // attachment not possible
+ }
+
+ /**
+ * Get all compilation units of a selection.
+ * @param javaElements the selected java elements
+ * @return all compilation units containing and contained in elements from javaElements
+ * @throws JavaModelException
+ */
+ public static ICompilationUnit[] getAllCompilationUnits(IJavaElement[] javaElements) throws JavaModelException {
+ HashSet result= new HashSet();
+ for (int i= 0; i < javaElements.length; i++) {
+ addAllCus(result, javaElements[i]);
+ }
+ return (ICompilationUnit[]) result.toArray(new ICompilationUnit[result.size()]);
+ }
+
+ private static void addAllCus(HashSet/*<ICompilationUnit>*/ collector, IJavaElement javaElement) throws JavaModelException {
+ switch (javaElement.getElementType()) {
+ case IJavaElement.JAVA_PROJECT:
+ IJavaProject javaProject= (IJavaProject) javaElement;
+ IPackageFragmentRoot[] packageFragmentRoots= javaProject.getPackageFragmentRoots();
+ for (int i= 0; i < packageFragmentRoots.length; i++)
+ addAllCus(collector, packageFragmentRoots[i]);
+ return;
+
+ case IJavaElement.PACKAGE_FRAGMENT_ROOT:
+ IPackageFragmentRoot packageFragmentRoot= (IPackageFragmentRoot) javaElement;
+ if (packageFragmentRoot.getKind() != IPackageFragmentRoot.K_SOURCE)
+ return;
+ IJavaElement[] packageFragments= packageFragmentRoot.getChildren();
+ for (int j= 0; j < packageFragments.length; j++)
+ addAllCus(collector, packageFragments[j]);
+ return;
+
+ case IJavaElement.PACKAGE_FRAGMENT:
+ IPackageFragment packageFragment= (IPackageFragment) javaElement;
+ collector.addAll(Arrays.asList(packageFragment.getCompilationUnits()));
+ return;
+
+ case IJavaElement.COMPILATION_UNIT:
+ collector.add(javaElement);
+ return;
+
+ default:
+ IJavaElement cu= javaElement.getAncestor(IJavaElement.COMPILATION_UNIT);
+ if (cu != null)
+ collector.add(cu);
}
}
- private static Boolean fgIsJDTCore_1_5 = null;
+
+ /**
+ * Sets all compliance settings in the given map to 5.0
+ */
+ public static void set50CompilanceOptions(Map map) {
+ setCompilanceOptions(map, JavaCore.VERSION_1_5);
+ }
+
+ public static void setCompilanceOptions(Map map, String compliance) {
+ if (JavaCore.VERSION_1_6.equals(compliance)) {
+ map.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_6);
+ map.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6);
+ map.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_6);
+ map.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
+ map.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
+ } else if (JavaCore.VERSION_1_5.equals(compliance)) {
+ map.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
+ map.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
+ map.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5);
+ map.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.ERROR);
+ map.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.ERROR);
+ } else if (JavaCore.VERSION_1_4.equals(compliance)) {
+ map.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4);
+ map.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
+ map.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_2);
+ map.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.WARNING);
+ map.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.WARNING);
+ } else if (JavaCore.VERSION_1_3.equals(compliance)) {
+ map.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_3);
+ map.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_3);
+ map.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_1);
+ map.put(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaCore.IGNORE);
+ map.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.IGNORE);
+ } else {
+ throw new IllegalArgumentException("Unsupported compliance: " + compliance); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @return returns if version 1 is less than version 2.
+ */
+ public static boolean isVersionLessThan(String version1, String version2) {
+ return version1.compareTo(version2) < 0;
+ }
+
+ public static boolean is50OrHigher(String compliance) {
+ return !isVersionLessThan(compliance, JavaCore.VERSION_1_5);
+ }
+
+ public static boolean is50OrHigher(IJavaProject project) {
+ return is50OrHigher(project.getOption(JavaCore.COMPILER_COMPLIANCE, true));
+ }
+
+ public static boolean is50OrHigherJRE(IJavaProject project) throws CoreException {
+ IVMInstall vmInstall= JavaRuntime.getVMInstall(project);
+ if (!(vmInstall instanceof IVMInstall2))
+ return true; // assume 5.0.
+
+ String compliance= getCompilerCompliance((IVMInstall2) vmInstall, null);
+ if (compliance == null)
+ return true; // assume 5.0
+ return compliance.startsWith(JavaCore.VERSION_1_5) || compliance.startsWith(JavaCore.VERSION_1_6);
+ }
+
+ public static String getCompilerCompliance(IVMInstall2 vMInstall, String defaultCompliance) {
+ String version= vMInstall.getJavaVersion();
+ if (version == null) {
+ return defaultCompliance;
+ } else if (version.startsWith(JavaCore.VERSION_1_6)) {
+ return JavaCore.VERSION_1_6;
+ } else if (version.startsWith(JavaCore.VERSION_1_5)) {
+ return JavaCore.VERSION_1_5;
+ } else if (version.startsWith(JavaCore.VERSION_1_4)) {
+ return JavaCore.VERSION_1_4;
+ } else if (version.startsWith(JavaCore.VERSION_1_3)) {
+ return JavaCore.VERSION_1_3;
+ } else if (version.startsWith(JavaCore.VERSION_1_2)) {
+ return JavaCore.VERSION_1_3;
+ } else if (version.startsWith(JavaCore.VERSION_1_1)) {
+ return JavaCore.VERSION_1_3;
+ }
+ return defaultCompliance;
+ }
/**
- * Return true if JRE 1.5 in enabled.
+ * Compute a new name for a compilation unit, given the name of the new main type.
+ * This query tries to maintain the existing extension (e.g. ".java").
+ *
+ * @param cu a compilation unit
+ * @param newMainName the new name of the cu's main type (without extension)
+ * @return the new name for the compilation unit
*/
- public static boolean isJDTCore_1_5() {
- if (fgIsJDTCore_1_5 == null) {
- fgIsJDTCore_1_5 = new Boolean(JavaCore.getDefaultOptions().containsKey("org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation")); //$NON-NLS-1$
+ public static String getRenamedCUName(ICompilationUnit cu, String newMainName) {
+ String oldName = cu.getElementName();
+ int i = oldName.lastIndexOf('.');
+ if (i != -1) {
+ return newMainName + oldName.substring(i);
+ } else {
+ return newMainName;
}
- return fgIsJDTCore_1_5.booleanValue();
+ }
+
+ public static boolean isImplicitImport(String qualifier, ICompilationUnit cu) {
+ if ("java.lang".equals(qualifier)) { //$NON-NLS-1$
+ return true;
+ }
+ String packageName= cu.getParent().getElementName();
+ if (qualifier.equals(packageName)) {
+ return true;
+ }
+ String typeName= JavaCore.removeJavaLikeExtension(cu.getElementName());
+ String mainTypeName= JavaModelUtil.concatenateName(packageName, typeName);
+ return qualifier.equals(mainTypeName);
}
-
-
-
+
+ /**
+ * If <code>true</code>, then element can safely be cast to any of
+ * {@link IParent}, {@link IOpenable}, {@link ISourceReference}, or {@link ICodeAssist}.
+ * @param element
+ * @return <code>true</code> iff element is an {@link ICompilationUnit} or an {@link IClassFile}
+ */
+ public static boolean isTypeContainerUnit(IJavaElement element) {
+ // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=125504
+ return element instanceof ICompilationUnit || element instanceof IClassFile;
+ }
+
+ public static IJavaElement getTypeContainerUnit(IMember member) {
+ ICompilationUnit cu= member.getCompilationUnit();
+ if (cu != null)
+ return cu;
+ else
+ return member.getClassFile();
+ }
}
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/NewJavaClassDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/NewJavaClassDataModelProvider.java
index b1277f7..d8ad200 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/NewJavaClassDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/NewJavaClassDataModelProvider.java
@@ -286,7 +286,7 @@
return WTPCommonPlugin.createErrorStatus(msg);
} else if (javaStatus.getSeverity() == IStatus.WARNING) {
String msg = J2EECommonMessages.ERR_JAVA_PACKAGE_NAME_WARNING + javaStatus.getMessage();
- return WTPCommonPlugin.createErrorStatus(msg);
+ return WTPCommonPlugin.createWarningStatus(msg);
}
}
// java package name is valid
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/NewJavaClassOperation.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/NewJavaClassOperation.java
index d896714..210ccfc 100644
--- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/NewJavaClassOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/NewJavaClassOperation.java
@@ -342,7 +342,9 @@
int size = interfaces.size();
for (int i = 0; i < size; i++) {
String interfaceName = (String) interfaces.get(i);
- importStatements.add(interfaceName);
+ if(!interfaceName.equals(JAVA_LANG_OBJECT) && !isSamePackage(pack, interfaceName)){
+ importStatements.add(interfaceName);
+ }
}
}
}
@@ -450,7 +452,7 @@
if (superClassType != null) {
IMethod[] methods = superClassType.getMethods();
for (int j = 0; j < methods.length; j++) {
- if (methods[j].isConstructor() && !Flags.isPrivate(methods[j].getFlags())) {
+ if (methods[j].isConstructor() && !Flags.isPrivate(methods[j].getFlags()) && !hasGenericParams(methods[j])) {
String methodStub = getMethodStub(methods[j], superclassName, className);
sb.append(methodStub);
}
@@ -479,6 +481,27 @@
return sb.toString();
}
+ private boolean hasGenericParams(IMethod method) {
+ try {
+ IType parentType = method.getDeclaringType();
+ String[] paramTypes = method.getParameterTypes();
+
+ int nP = paramTypes.length;
+ for (int i = 0; i < nP; i++) {
+ String type = paramTypes[i];
+ if (!isPrimitiveType(type)) {
+ type = JavaModelUtil.getResolvedTypeName(type, parentType);
+ if(type.indexOf(Signature.C_GENERIC_START, 0) != -1){
+ return true;
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ Logger.getLogger().log(e);
+ }
+ return false;
+ }
+
/**
* This method is intended for internal use only. This will retrieve method stubs for
* unimplemented methods in the superclass that will need to be created in the new class.
@@ -571,12 +594,28 @@
* @throws JavaModelException
*/
private String resolveAndAdd(String refTypeSig, IType declaringType) throws JavaModelException {
- String resolvedTypeName = JavaModelUtil.getResolvedTypeName(refTypeSig, declaringType);
- // Could type not be resolved and is import statement missing?
+ if(refTypeSig.indexOf(Signature.C_GENERIC_START, 0) != -1){
+ getImportStatements(refTypeSig, declaringType);
+ } else {
+ String resolvedTypeName = JavaModelUtil.getResolvedTypeName(refTypeSig, declaringType);
+ // Could type not be resolved and is import statement missing?
+ if (resolvedTypeName != null && !importStatements.contains(resolvedTypeName) && !resolvedTypeName.startsWith("java.lang")) { //$NON-NLS-1$
+ importStatements.add(resolvedTypeName);
+ }
+ }
+ return Signature.toString(refTypeSig);
+ }
+
+ private void getImportStatements(String signature, IType declaringType) throws JavaModelException{
+ String erasure = Signature.getTypeErasure(signature);
+ String resolvedTypeName = JavaModelUtil.getResolvedTypeName(erasure, declaringType);
if (resolvedTypeName != null && !importStatements.contains(resolvedTypeName) && !resolvedTypeName.startsWith("java.lang")) { //$NON-NLS-1$
importStatements.add(resolvedTypeName);
}
- return Signature.toString(refTypeSig);
+ String [] params = Signature.getTypeArguments(signature);
+ for(int i=0;i<params.length; i++){
+ getImportStatements(params[i], declaringType);
+ }
}
/**
@@ -763,7 +802,7 @@
return found;
}
// Check recursively
- return JavaModelUtil.findMethodImplementationInHierarchy(tH, thisType, methodName, parameterTypes, isConstructor);
+ return JavaModelUtil.findMethodInHierarchy(tH, thisType, methodName, parameterTypes, isConstructor);
}
/**
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java
index 5b29b39..6ecbc23 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/ClassPathSelection.java
@@ -392,35 +392,42 @@
IVirtualComponent referencedComponent = ref.getReferencedComponent();
boolean isBinary = referencedComponent.isBinary();
if( isBinary ){
+
+
/**
* Warning clean-up 12/05/2005
*/
//String uri = J2EEProjectUtilities.getResolvedPathForArchiveComponent(referencedComponent.getName()).toString();
- String unresolvedURI = "";
- try {
- unresolvedURI = ModuleURIUtil.getArchiveName(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)));
- } catch (UnresolveableURIException e) {
- e.printStackTrace();
- }
- URI archiveURI = URI.createURI(unresolvedURI);
-
- boolean alreadyInList = false;
- Iterator iter = getClasspathElements().iterator();
- while(iter.hasNext()){
- ClasspathElement tmpelement = (ClasspathElement)iter.next();
- if( tmpelement.getText().equals(archiveURI.lastSegment())){
- alreadyInList = true;
- break;
+ String unresolvedURI = ref.getArchiveName();
+ if(unresolvedURI == null){
+ try {
+ unresolvedURI = ModuleURIUtil.getArchiveName(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)));
+ } catch (UnresolveableURIException e) {
+ e.printStackTrace();
}
}
- if( !alreadyInList ){
- if( inManifest(cp, archiveURI.lastSegment())){
- element = createArchiveElement(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)), archiveURI.lastSegment(), archiveURI.lastSegment());
- addClasspathElement(element, unresolvedURI);
- }else{
- element = createArchiveElement(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)), archiveURI.lastSegment(), null);
- addClasspathElement(element, unresolvedURI);
+ if(unresolvedURI != null){
+ URI archiveURI = URI.createURI(unresolvedURI);
+
+ boolean alreadyInList = false;
+ Iterator iter = getClasspathElements().iterator();
+ while(iter.hasNext()){
+ ClasspathElement tmpelement = (ClasspathElement)iter.next();
+ if(unresolvedURI.endsWith(tmpelement.getText())){
+ alreadyInList = true;
+ break;
+ }
+ }
+
+ if( !alreadyInList ){
+ if( inManifest(cp, archiveURI.lastSegment())){
+ element = createArchiveElement(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)), archiveURI.lastSegment(), archiveURI.lastSegment());
+ addClasspathElement(element, unresolvedURI);
+ }else{
+ element = createArchiveElement(URI.createURI(ModuleURIUtil.getHandleString(referencedComponent)), archiveURI.lastSegment(), null);
+ addClasspathElement(element, unresolvedURI);
+ }
}
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java
index e946caa..a858470 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/EARComponentImportDataModelProvider.java
@@ -152,6 +152,7 @@
nestedModel = (IDataModel) projectModels.get(i);
nestedModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, propertyValue);
}
+ fixupJavaFacets();
}
}
@@ -181,6 +182,7 @@
if (getJ2EEVersion() < J2EEVersionConstants.VERSION_1_3)
setBooleanProperty(USE_ANNOTATIONS, false);
model.notifyPropertyChange(USE_ANNOTATIONS, IDataModel.ENABLE_CHG);
+ fixupJavaFacets();
} else if (UTILITY_LIST.equals(propertyName)) {
updateUtilityModels((List) propertyValue);
} else if (USE_ANNOTATIONS.equals(propertyName)) {
@@ -277,6 +279,15 @@
protected boolean forceResetOnPreserveMetaData() {
return false;
}
+
+ protected void fixupJavaFacets() {
+ List subProjects = getSelectedModels();
+ IDataModel subDataModel = null;
+ for (int i = 0; i < subProjects.size(); i++) {
+ subDataModel = (IDataModel) subProjects.get(i);
+ subDataModel.validateProperty(FACET_RUNTIME);
+ }
+ }
public IStatus validate(String propertyName) {
if (propertyName.equals(NESTED_PROJECTS_VALIDATION) || propertyName.equals(EAR_NAME_VALIDATION)) {
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java
index b998a5b..6761fea 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/internal/operations/J2EEArtifactImportDataModelProvider.java
@@ -259,40 +259,49 @@
}
}
+ /**
+ * Calling this method will fixup the JST facet version if it is incompatible with the selected runtime
+ * It should be called when the Server Runtime or the Archive properties are set.
+ * @return
+ */
protected IStatus validateVersionSupportedByServer(){
- if( model.isPropertySet(FILE)){
+ if( model.isPropertySet(FILE) && model.isPropertySet(IFacetProjectCreationDataModelProperties.FACET_RUNTIME)){
IDataModel projectModel = model.getNestedModel(NESTED_MODEL_J2EE_COMPONENT_CREATION);
FacetDataModelMap map = (FacetDataModelMap) projectModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
Collection projectFacets = (Collection)getProperty(FacetProjectCreationDataModelProvider.REQUIRED_FACETS_COLLECTION);
- IRuntime runtime = (IRuntime) getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
- for(Iterator iterator = projectFacets.iterator(); iterator.hasNext();){
- IDataModel facetDataModel = map.getFacetDataModel(((IProjectFacet)iterator.next()).getId());
- IProjectFacetVersion facetVersion = (IProjectFacetVersion)facetDataModel.getProperty(IFacetDataModelProperties.FACET_VERSION);
- if(facetVersion.getProjectFacet().getId().equals(IModuleConstants.JST_JAVA)){
- Set set = Collections.singleton(facetVersion.getProjectFacet());
- try {
- Set correctSet = runtime.getDefaultFacets(set);
- IProjectFacetVersion correctVersion = null;
- Iterator correctVersions = correctSet.iterator();
- while(correctVersions.hasNext() && correctVersion == null){
- IProjectFacetVersion version = (IProjectFacetVersion)correctVersions.next();
- if(version.getProjectFacet().getId().equals(IModuleConstants.JST_JAVA)){
- correctVersion = version;
+ IRuntime runtime = (IRuntime) getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
+ if(runtime != null){
+ for(Iterator iterator = projectFacets.iterator(); iterator.hasNext();){
+ IDataModel facetDataModel = map.getFacetDataModel(((IProjectFacet)iterator.next()).getId());
+ IProjectFacetVersion facetVersion = (IProjectFacetVersion)facetDataModel.getProperty(IFacetDataModelProperties.FACET_VERSION);
+ if(facetVersion.getProjectFacet().getId().equals(IModuleConstants.JST_JAVA)){
+ Set set = Collections.singleton(facetVersion.getProjectFacet());
+ try {
+ Set correctSet = runtime.getDefaultFacets(set);
+ IProjectFacetVersion correctVersion = null;
+ Iterator correctVersions = correctSet.iterator();
+ while(correctVersions.hasNext() && correctVersion == null){
+ IProjectFacetVersion version = (IProjectFacetVersion)correctVersions.next();
+ if(version.getProjectFacet().getId().equals(IModuleConstants.JST_JAVA)){
+ correctVersion = version;
+ }
}
+
+ if(correctVersion != null){
+ if(!facetVersion.equals(correctVersion)){
+ facetDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION, correctVersion);
+ facetVersion = correctVersion;
+ }
+ }
+ } catch (CoreException e) {
+ Logger.getLogger().logError(e);
}
-
- if(correctVersion != null){
- facetDataModel.setProperty(IFacetDataModelProperties.FACET_VERSION, correctVersion);
- facetVersion = correctVersion;
- }
- } catch (CoreException e) {
- Logger.getLogger().logError(e);
}
- }
-
- if(runtime != null && !runtime.supports(facetVersion)){
- return WTPCommonPlugin.createErrorStatus( J2EECreationResourceHandler.VERSION_NOT_SUPPORTED ); //$NON-NLS-1$
+
+ if(!runtime.supports(facetVersion)){
+ return WTPCommonPlugin.createErrorStatus( J2EECreationResourceHandler.VERSION_NOT_SUPPORTED ); //$NON-NLS-1$
+ }
}
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java
index 80bad0e..1bac554 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualComponent.java
@@ -33,12 +33,19 @@
import org.eclipse.wst.common.componentcore.internal.resources.VirtualFolder;
import org.eclipse.wst.common.componentcore.internal.util.IComponentImplFactory;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+import org.eclipse.wst.common.frameworks.internal.DoNotUseMeThisWillBeDeletedPost15;
public class EARVirtualComponent extends VirtualComponent implements IComponentImplFactory {
+ /**
+ * @deprecated
+ * @return
+ * @see DoNotUseMeThisWillBeDeletedPost15
+ */
protected IVirtualFolder defaultRootFolder;
public EARVirtualComponent() {
@@ -59,10 +66,7 @@
}
public IVirtualFolder createFolder(IProject aProject, IPath aRuntimePath) {
- if(aRuntimePath.segmentCount() == 0){
- return new EARVirtualRootFolder(aProject, aRuntimePath);
- }
- return new VirtualFolder(aProject, aRuntimePath);
+ return new EARVirtualRootFolder(aProject, aRuntimePath);
}
private static String getJarURI(final ReferencedComponent ref, final IVirtualComponent moduleComp) {
@@ -144,14 +148,16 @@
* @return
*/
private static List getLooseArchiveReferences(EARVirtualComponent earComponent, List hardReferences) {
- List dynamicReferences = null;
+ return getLooseArchiveReferences(earComponent, hardReferences, null, (EARVirtualRootFolder)earComponent.getRootFolder());
+ }
+
+ private static List getLooseArchiveReferences(EARVirtualComponent earComponent, List hardReferences, List dynamicReferences, EARVirtualRootFolder folder) {
try {
- IVirtualResource[] members = earComponent.defaultRootFolder.members();
+ IVirtualResource[] members = folder.superMembers();
for (int i = 0; i < members.length; i++) {
if (IVirtualResource.FILE == members[i].getType()) {
- String archiveName = members[i].getName();
- String lowerCase = archiveName.toLowerCase();
- if (lowerCase.endsWith(".jar") || lowerCase.endsWith(".rar") || lowerCase.endsWith(".war")) {
+ if(folder.isDynamicComponent((IVirtualFile)members[i])){
+ String archiveName = members[i].getRuntimePath().toString().substring(1);
boolean shouldInclude = true;
for (int j = 0; j < hardReferences.size() && shouldInclude; j++) {
String tempArchiveName = ((IVirtualReference) hardReferences.get(j)).getArchiveName();
@@ -170,6 +176,8 @@
dynamicReferences.add(dynamicRef);
}
}
+ } else if(IVirtualResource.FOLDER == members[i].getType()){
+ dynamicReferences = getLooseArchiveReferences(earComponent, hardReferences, dynamicReferences, (EARVirtualRootFolder)members[i]);
}
}
} catch (CoreException e) {
@@ -178,7 +186,6 @@
return dynamicReferences;
}
-
public IVirtualReference[] getReferences() {
List hardReferences = getHardReferences(this);
List dynamicReferences = getLooseArchiveReferences(this, hardReferences);
@@ -190,6 +197,11 @@
return (IVirtualReference[]) hardReferences.toArray(new IVirtualReference[hardReferences.size()]);
}
+ /**
+ * @deprecated
+ * @return
+ * @see DoNotUseMeThisWillBeDeletedPost15
+ */
public IVirtualFolder getDefaultRootFolder() {
return defaultRootFolder;
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualRootFolder.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualRootFolder.java
index 8403991..56a7e3a 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualRootFolder.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/componentcore/util/EARVirtualRootFolder.java
@@ -4,12 +4,15 @@
import java.util.List;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
import org.eclipse.wst.common.componentcore.internal.resources.VirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
+//TODO this should be renamed to EARVirtualFolder because it is not used only for the root.
public class EARVirtualRootFolder extends VirtualFolder {
public EARVirtualRootFolder(IProject aComponentProject, IPath aRuntimePath) {
@@ -18,22 +21,37 @@
public static String [] EXTENSIONS_TO_IGNORE = new String [] {".jar", ".zip", ".rar", ".war" };
+ public IVirtualResource[] superMembers() throws CoreException {
+ return superMembers(IResource.NONE);
+ }
+
+ public IVirtualResource[] superMembers(int memberFlags) throws CoreException {
+ return super.members(memberFlags);
+ }
+
+ public boolean isDynamicComponent(IVirtualFile vFile){
+ String archiveName = vFile.getName();
+ for(int j = 0; j<EXTENSIONS_TO_IGNORE.length; j++){
+ if(J2EEComponentClasspathUpdater.endsWithIgnoreCase(archiveName, EXTENSIONS_TO_IGNORE[j])){
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* For now, just rip out files with .jar, .rar, or .war file extensions, because these are
* the only files automatically added dyamically
*/
public IVirtualResource[] members(int memberFlags) throws CoreException {
- IVirtualResource[] members = super.members(memberFlags);
+ IVirtualResource[] members = superMembers(memberFlags);
List virtualResources = new ArrayList();
boolean shouldAdd = true;
for (int i = 0; i < members.length; i++) {
shouldAdd = true;
if (IVirtualResource.FILE == members[i].getType()) {
- String archiveName = members[i].getName();
- for(int j = 0; j<EXTENSIONS_TO_IGNORE.length && shouldAdd; j++){
- if(J2EEComponentClasspathUpdater.endsWithIgnoreCase(archiveName, EXTENSIONS_TO_IGNORE[j])){
- shouldAdd = false;
- }
+ if(isDynamicComponent((IVirtualFile)members[i])){
+ shouldAdd = false;
}
}
if (shouldAdd) {
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java
index 9ffe4bd..b95eb21 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/IEarFacetInstallDataModelProperties.java
@@ -10,11 +10,17 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.internal.earcreation;
+import org.eclipse.jst.j2ee.project.facet.EARFacetProjectCreationDataModelProvider;
import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetInstallDataModelProperties;
public interface IEarFacetInstallDataModelProperties extends IJ2EEFacetInstallDataModelProperties {
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = EARFacetProjectCreationDataModelProvider.class;
+
//TODO what is this???
public static final String CONTENT_DIR = "IEarFacetInstallDataModelProperties.CONTENT_DIR";//$NON-NLS-1$
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java
index ce202cc..34162f1 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/IUtilityFacetInstallDataModelProperties.java
@@ -10,9 +10,10 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.project.facet;
-
-
-
public interface IUtilityFacetInstallDataModelProperties extends IJ2EEModuleFacetInstallDataModelProperties {
+ /**
+ * This field should not be used. It is not part of the API and may be modified in the future.
+ */
+ public static Class _provider_class = UtilityFacetInstallDataModelProvider.class;
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java
index 4faa77a..7725a02 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/JavaProjectMigrationOperation.java
@@ -55,6 +55,8 @@
try {
udm.setProperty(IFacetDataModelProperties.FACET_PROJECT_NAME, model.getStringProperty(PROJECT_NAME));
udm.setProperty(IFacetDataModelProperties.FACET_VERSION_STR, "1.0"); //$NON-NLS-1$
+ udm.setProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI,
+ model.getStringProperty(PROJECT_NAME) + ".jar"); //$NON-NLS-1$
} catch (Exception e) {
Logger.getLogger().logError(e);
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java
index e13df82..2bff42e 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityFacetInstallDataModelProvider.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.project.facet;
+import org.eclipse.jst.j2ee.internal.plugin.IJ2EEModuleConstants;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -18,6 +19,9 @@
public Object getDefaultProperty(String propertyName) {
if (FACET_ID.equals(propertyName)) {
return J2EEProjectUtilities.UTILITY;
+ } else if (propertyName.equals(MODULE_URI)) {
+ String projectName = model.getStringProperty(FACET_PROJECT_NAME).replace(' ', '_');
+ return projectName + IJ2EEModuleConstants.JAR_EXT;
}
return super.getDefaultProperty(propertyName);
}
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java
index 7abb020..7750bb9 100644
--- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/project/facet/UtilityProjectCreationDataModelProvider.java
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
@@ -21,6 +22,7 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.ProductManager;
public class UtilityProjectCreationDataModelProvider extends J2EEFacetProjectCreationDataModelProvider {
@@ -32,6 +34,9 @@
super.init();
FacetDataModelMap map = (FacetDataModelMap) getProperty(FACET_DM_MAP);
IDataModel javaFacet = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
+ // If applicable, keep project structure optimized by making output directory the same as the content root
+ if (ProductManager.shouldUseSingleRootStructure())
+ javaFacet.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME, javaFacet.getStringProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME));
map.add(javaFacet);
IDataModel utilFacet = DataModelFactory.createDataModel(new UtilityFacetInstallDataModelProvider());
map.add(utilFacet);
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java
index aab3f15..e877f1f 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/componentcore/J2EEModuleVirtualComponent.java
@@ -23,6 +23,7 @@
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifestImpl;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil;
import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.componentcore.ComponentCore;
@@ -116,6 +117,10 @@
List dynamicReferences = null;
String [] manifestClasspath = getManifestClasspath(moduleComponent);
+ IVirtualReference foundRef = null;
+ String earArchiveURI = null; //The URI for this archive in the EAR
+ boolean simplePath = false;
+
if (manifestClasspath != null && manifestClasspath.length > 0) {
IProject[] earProjects = J2EEProjectUtilities.getAllProjectsInWorkspaceOfType(J2EEProjectUtilities.ENTERPRISE_APPLICATION);
IVirtualReference[] earRefs = null;
@@ -125,6 +130,9 @@
for (int j = 0; j < tempEarRefs.length && earRefs == null; j++) {
if (tempEarRefs[j].getReferencedComponent().equals(moduleComponent)) {
earRefs = tempEarRefs;
+ foundRef = tempEarRefs[j];
+ earArchiveURI = foundRef.getArchiveName();
+ simplePath = earArchiveURI != null ? earArchiveURI.lastIndexOf("/") == -1 : true; //$NON-NLS-1$
}
}
}
@@ -133,24 +141,38 @@
for (int i = 0; i < manifestClasspath.length; i++) {
boolean found = false;
for (int j = 0; j < earRefs.length && !found; j++) {
- String archiveName = earRefs[j].getArchiveName();
- if (null != archiveName && archiveName.equals(manifestClasspath[i])) {
- found = true;
- boolean shouldInclude = true;
- IVirtualComponent dynamicComponent = earRefs[j].getReferencedComponent();
- if(null != hardReferences){
- for (int k = 0; k < hardReferences.length && shouldInclude; k++) {
- if (hardReferences[k].getReferencedComponent().equals(dynamicComponent)) {
- shouldInclude = false;
+ if(foundRef != earRefs[j]){
+ String archiveName = earRefs[j].getArchiveName();
+ if (null != archiveName){
+ boolean shouldAdd = false;
+ if(simplePath && manifestClasspath[i].lastIndexOf("/") == -1){ //$NON-NLS-1$
+ shouldAdd = archiveName.equals(manifestClasspath[i]);
+ } else {
+ String earRelativeURI = ArchiveUtil.deriveEARRelativeURI(manifestClasspath[i], earArchiveURI);
+ if(null != earRelativeURI){
+ shouldAdd = earRelativeURI.equals(archiveName);
}
}
- }
- if (shouldInclude) {
- IVirtualReference dynamicReference = ComponentCore.createReference(moduleComponent, dynamicComponent);
- if (null == dynamicReferences) {
- dynamicReferences = new ArrayList();
+
+ if(shouldAdd){
+ found = true;
+ boolean shouldInclude = true;
+ IVirtualComponent dynamicComponent = earRefs[j].getReferencedComponent();
+ if(null != hardReferences){
+ for (int k = 0; k < hardReferences.length && shouldInclude; k++) {
+ if (hardReferences[k].getReferencedComponent().equals(dynamicComponent)) {
+ shouldInclude = false;
+ }
+ }
+ }
+ if (shouldInclude) {
+ IVirtualReference dynamicReference = ComponentCore.createReference(moduleComponent, dynamicComponent);
+ if (null == dynamicReferences) {
+ dynamicReferences = new ArrayList();
+ }
+ dynamicReferences.add(dynamicReference);
+ }
}
- dynamicReferences.add(dynamicReference);
}
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/AppClientBinaryComponentHelper.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/AppClientBinaryComponentHelper.java
index 0503d0b..574b3ca 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/AppClientBinaryComponentHelper.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/AppClientBinaryComponentHelper.java
@@ -10,12 +10,16 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.internal.componentcore;
+import java.io.IOException;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.j2ee.commonarchivecore.internal.ApplicationClientFile;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveTypeDiscriminator;
import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ApplicationClientFileImpl;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.AppClient12ImportStrategyImpl;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
public class AppClientBinaryComponentHelper extends EnterpriseBinaryComponentHelper {
@@ -73,6 +77,25 @@
count = 0;
super.close();
}
+
+ private EnterpriseBinaryComponentHelper helper = null;
+
+ public EnterpriseBinaryComponentHelper getEnterpriseBinaryComponentHelper() {
+ return helper;
+ }
+
+ public void setEnterpriseBinaryComponentHelper(EnterpriseBinaryComponentHelper helper) {
+ this.helper = helper;
+ }
+
+ protected LoadStrategy createLoadStrategyForReopen(Archive parent) throws IOException {
+ try {
+ return createBinaryLoadStrategy(getEnterpriseBinaryComponentHelper());
+ } catch (OpenFailureException e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
}
protected ArchiveTypeDiscriminator getDiscriminator() {
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/EJBBinaryComponentHelper.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/EJBBinaryComponentHelper.java
index e582af5..25e293a 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/EJBBinaryComponentHelper.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/EJBBinaryComponentHelper.java
@@ -10,12 +10,16 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.internal.componentcore;
+import java.io.IOException;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.EJBJarFile;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveTypeDiscriminator;
import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EJBJarFileImpl;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.EjbJar11ImportStrategyImpl;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
public class EJBBinaryComponentHelper extends EnterpriseBinaryComponentHelper {
@@ -73,6 +77,24 @@
count = 0;
super.close();
}
+
+ private EnterpriseBinaryComponentHelper helper = null;
+
+ public EnterpriseBinaryComponentHelper getEnterpriseBinaryComponentHelper() {
+ return helper;
+ }
+
+ public void setEnterpriseBinaryComponentHelper(EnterpriseBinaryComponentHelper helper) {
+ this.helper = helper;
+ }
+
+ protected LoadStrategy createLoadStrategyForReopen(Archive parent) throws IOException {
+ try {
+ return createBinaryLoadStrategy(getEnterpriseBinaryComponentHelper());
+ } catch (OpenFailureException e) {
+ throw new IOException(e.getMessage());
+ }
+ }
}
protected ArchiveTypeDiscriminator getDiscriminator() {
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/EnterpriseBinaryComponentHelper.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/EnterpriseBinaryComponentHelper.java
index 0982711..0ac7369 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/EnterpriseBinaryComponentHelper.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/EnterpriseBinaryComponentHelper.java
@@ -327,17 +327,8 @@
public synchronized IReferenceCountedArchive openArchive(EnterpriseBinaryComponentHelper helper) throws OpenFailureException {
ArchiveOptions options = helper.getArchiveOptions();
String archiveURI = helper.getArchiveURI();
- String filename = archiveURI.replace('/', java.io.File.separatorChar);
- java.io.File file = new java.io.File(filename);
- if (!file.exists()) {
- throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[] { archiveURI, file.getAbsolutePath() })));
- }
- try {
- BinaryZipFileLoadStrategy strategy = new BinaryZipFileLoadStrategy(file);
- options.setLoadStrategy(strategy);
- } catch (IOException ex) {
- throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.could_not_open_EXC_, (new Object[] { archiveURI })), ex);
- }
+
+ options.setLoadStrategy(createBinaryLoadStrategy(helper));
Archive anArchive = CommonarchiveFactory.eINSTANCE.primOpenArchive(options, archiveURI);
@@ -348,12 +339,28 @@
throw new OpenFailureException(discriminator.getUnableToOpenMessage());
}
IReferenceCountedArchive specificArchive = (IReferenceCountedArchive) discriminator.openArchive(anArchive);
+ specificArchive.setEnterpriseBinaryComponentHelper(helper);
specificArchive.initializeAfterOpen();
specificArchive.access();
componentsToArchives.put(helper.getComponent(), specificArchive);
return specificArchive;
}
}
+
+ protected static BinaryZipFileLoadStrategy createBinaryLoadStrategy(EnterpriseBinaryComponentHelper helper) throws OpenFailureException {
+ String archiveURI = helper.getArchiveURI();
+ String filename = archiveURI.replace('/', java.io.File.separatorChar);
+ java.io.File file = new java.io.File(filename);
+ if (!file.exists()) {
+ throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.file_not_found_EXC_, (new Object[] { archiveURI, file.getAbsolutePath() })));
+ }
+ try {
+ BinaryZipFileLoadStrategy strategy = new BinaryZipFileLoadStrategy(file);
+ return strategy;
+ } catch (IOException ex) {
+ throw new OpenFailureException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.could_not_open_EXC_, (new Object[] { archiveURI })), ex);
+ }
+ }
protected interface IReferenceCountedArchive extends Archive {
@@ -366,6 +373,10 @@
public void forceClose();
+ public void setEnterpriseBinaryComponentHelper(EnterpriseBinaryComponentHelper helper);
+
+ public EnterpriseBinaryComponentHelper getEnterpriseBinaryComponentHelper();
+
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/JCABinaryComponentHelper.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/JCABinaryComponentHelper.java
index 8cffb3e..d11299a 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/JCABinaryComponentHelper.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/JCABinaryComponentHelper.java
@@ -10,11 +10,15 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.internal.componentcore;
+import java.io.IOException;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.RARFile;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveTypeDiscriminator;
import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.RARFileImpl;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.RarImportStrategyImpl;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -73,6 +77,24 @@
count = 0;
super.close();
}
+
+ private EnterpriseBinaryComponentHelper helper = null;
+
+ public EnterpriseBinaryComponentHelper getEnterpriseBinaryComponentHelper() {
+ return helper;
+ }
+
+ public void setEnterpriseBinaryComponentHelper(EnterpriseBinaryComponentHelper helper) {
+ this.helper = helper;
+ }
+
+ protected LoadStrategy createLoadStrategyForReopen(Archive parent) throws IOException {
+ try {
+ return createBinaryLoadStrategy(getEnterpriseBinaryComponentHelper());
+ } catch (OpenFailureException e) {
+ throw new IOException(e.getMessage());
+ }
+ }
}
protected ArchiveTypeDiscriminator getDiscriminator() {
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/UtilityBinaryComponentHelper.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/UtilityBinaryComponentHelper.java
index 6d1cf30..968c976 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/UtilityBinaryComponentHelper.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/UtilityBinaryComponentHelper.java
@@ -1,5 +1,7 @@
package org.eclipse.jst.j2ee.internal.componentcore;
+import java.io.IOException;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
@@ -7,6 +9,7 @@
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveTypeDiscriminatorImpl;
import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.ImportStrategy;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
public class UtilityBinaryComponentHelper extends EnterpriseBinaryComponentHelper {
@@ -68,6 +71,24 @@
count = 0;
super.close();
}
+
+ private EnterpriseBinaryComponentHelper helper = null;
+
+ public EnterpriseBinaryComponentHelper getEnterpriseBinaryComponentHelper() {
+ return helper;
+ }
+
+ public void setEnterpriseBinaryComponentHelper(EnterpriseBinaryComponentHelper helper) {
+ this.helper = helper;
+ }
+
+ protected LoadStrategy createLoadStrategyForReopen(Archive parent) throws IOException {
+ try {
+ return createBinaryLoadStrategy(getEnterpriseBinaryComponentHelper());
+ } catch (OpenFailureException e) {
+ throw new IOException(e.getMessage());
+ }
+ }
}
protected ArchiveTypeDiscriminator getDiscriminator() {
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java
index 438121c..29eb071 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/componentcore/WebBinaryComponentHelper.java
@@ -10,11 +10,15 @@
*******************************************************************************/
package org.eclipse.jst.j2ee.internal.componentcore;
+import java.io.IOException;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import org.eclipse.jst.j2ee.commonarchivecore.internal.WARFile;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveTypeDiscriminator;
import org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl;
+import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -73,6 +77,24 @@
count = 0;
super.close();
}
+
+ private EnterpriseBinaryComponentHelper helper = null;
+
+ public EnterpriseBinaryComponentHelper getEnterpriseBinaryComponentHelper() {
+ return helper;
+ }
+
+ public void setEnterpriseBinaryComponentHelper(EnterpriseBinaryComponentHelper helper) {
+ this.helper = helper;
+ }
+
+ protected LoadStrategy createLoadStrategyForReopen(Archive parent) throws IOException {
+ try {
+ return createBinaryLoadStrategy(getEnterpriseBinaryComponentHelper());
+ } catch (OpenFailureException e) {
+ throw new IOException(e.getMessage());
+ }
+ }
}
protected ArchiveTypeDiscriminator getDiscriminator() {
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java
index bdf87db..8e47c76 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/J2EEProjectUtilities.java
@@ -80,6 +80,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.SimpleValidateEdit;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
@@ -279,10 +280,12 @@
private static void writeManifest(IProject aProject, IFile aFile, ArchiveManifest manifest) throws java.io.IOException {
if (aFile != null) {
- OutputStream out = new WorkbenchByteArrayOutputStream(aFile);
- manifest.writeSplittingClasspath(out);
- out.close();
- J2EEComponentClasspathUpdater.getInstance().queueUpdateModule(aProject);
+ if(SimpleValidateEdit.validateEdit(new IFile[] { aFile })){
+ OutputStream out = new WorkbenchByteArrayOutputStream(aFile);
+ manifest.writeSplittingClasspath(out);
+ out.close();
+ J2EEComponentClasspathUpdater.getInstance().queueUpdateModule(aProject);
+ }
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ProjectSupportResourceHandler.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ProjectSupportResourceHandler.java
index 66416f0..2533664 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ProjectSupportResourceHandler.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/internal/project/ProjectSupportResourceHandler.java
@@ -54,6 +54,8 @@
public static String Update_ClassPath__UI_;
public static String Set_ClassPath__UI_;
public static String Names_cannot_contain_whitespace_;
+ public static String Importing_archive;
+ public static String Exporting_archive;
static {
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetInstallDelegate.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetInstallDelegate.java
index 5eb43b1..ef2ac95 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetInstallDelegate.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetInstallDelegate.java
@@ -45,6 +45,8 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action.Type;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.project.facet.IProductConstants;
+import org.eclipse.wst.project.facet.ProductManager;
public abstract class J2EEFacetInstallDelegate {
@@ -139,5 +141,25 @@
final IVirtualComponent earComp = ComponentCore.createComponent( earProject );
addToEar( earComp, c, moduleURI );
}
+
+ /**
+ * This method will set the output property on the model element for the given component.
+ * If the single root structure is set for optimized use, the output folder will be the
+ * content root. Otherwise the default will be used. This may be overrided by specific
+ * J2EE modules to do more appropriate behaviour.
+ *
+ * @param model
+ * @param component
+ */
+ protected void setOutputFolder(IDataModel model, IVirtualComponent component) {
+ String outputFolder = null;
+ // If using single root structure, set output folder to be the content folder
+ if (ProductManager.shouldUseSingleRootStructure())
+ outputFolder = model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER);
+ // Otherwise just use the product default for java output path
+ else
+ outputFolder = ProductManager.getProperty(IProductConstants.OUTPUT_FOLDER);
+ component.setMetaProperty("java-output-path", outputFolder ); //$NON-NLS-1$
+ }
}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetProjectCreationDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetProjectCreationDataModelProvider.java
index aa604c3..9e1a5f9 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetProjectCreationDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEFacetProjectCreationDataModelProvider.java
@@ -5,7 +5,9 @@
import java.util.Set;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
@@ -162,7 +164,19 @@
String errorMessage = WTPCommonPlugin.getResourceString(WTPCommonMessages.ERR_EMPTY_MODULE_NAME);
return WTPCommonPlugin.createErrorStatus(errorMessage);
}
- return (ProjectCreationDataModelProviderNew.validateProjectName(earName));
+
+ IStatus status = ProjectCreationDataModelProviderNew.validateProjectName(earName);
+ //check for the deleted case, the project is deleted from the workspace but still exists in the
+ //file system.
+ if( status.isOK()){
+ IProject earProject = ProjectUtilities.getProject(getStringProperty(EAR_PROJECT_NAME));
+ if( !earProject.exists() ){
+ IPath path = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ path = path.append(earName);
+ status = ProjectCreationDataModelProviderNew.validateExisting(earName, path.toOSString());
+ }
+ }
+ return status;
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEModuleFacetInstallDataModelProvider.java b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEModuleFacetInstallDataModelProvider.java
index 4d902ca..e138ea4 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEModuleFacetInstallDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eecreation/org/eclipse/jst/j2ee/project/facet/J2EEModuleFacetInstallDataModelProvider.java
@@ -102,8 +102,12 @@
if (masterModel != null) {
FacetDataModelMap map = (FacetDataModelMap) masterModel.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP);
IDataModel javaModel = map.getFacetDataModel(IModuleConstants.JST_JAVA);
- if (javaModel != null)
+ if (javaModel != null) {
javaModel.setProperty(IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME, propertyValue);
+ // If applicable, react to the change in content folder to update the output folder for single root structures
+ if (ProductManager.shouldUseSingleRootStructure())
+ javaModel.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME,propertyValue);
+ }
}
} else if ((EAR_PROJECT_NAME.equals(propertyName) || ADD_TO_EAR.equals(propertyName)) && getBooleanProperty(ADD_TO_EAR)) {
IStatus status = validateEAR(model.getStringProperty(EAR_PROJECT_NAME));
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployOperation.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployOperation.java
index 82d90ba..c6cd40b 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployOperation.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deploy/J2EEDeployOperation.java
@@ -165,11 +165,11 @@
Throwable mainCause = null;
if (exceptionStatus instanceof MultiStatus) {
IStatus[] stati = ((MultiStatus) exceptionStatus).getChildren();
- for (int i = 0; 1 < stati.length; i++) {
+ for (int i = 0; i < stati.length; i++) {
addErrorStatus(stati[i], DeployerName, stati[i].getException());
}
}
- mainCause = (ex.getCause() != null) ? ex.getCause() : ex;
+ mainCause = (ex != null && ex.getCause() != null) ? ex.getCause() : ex;
//String errorNotes = (mainCause != null && mainCause.getMessage() != null) ? mainCause.getMessage() : "";
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java
index fd3f70a..fe5d697 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployableFactory.java
@@ -26,6 +26,7 @@
import org.eclipse.jst.j2ee.client.ApplicationClient;
import org.eclipse.jst.j2ee.componentcore.util.EARArtifactEdit;
import org.eclipse.jst.j2ee.ejb.EJBJar;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.jst.j2ee.jca.Connector;
import org.eclipse.jst.j2ee.webapplication.WebApp;
@@ -109,51 +110,60 @@
IVirtualReference[] references = component.getReferences();
for (int i=0; i<references.length; i++) {
IVirtualComponent moduleComponent = references[i].getReferencedComponent();
- // Is referenced component a J2EE binary module archive
+ // Is referenced component a J2EE binary module archive or binary utility project?
if (moduleComponent.isBinary()) {
- // Ensure module URI exists on EAR DD for binary archive
+ // Check if module URI exists on EAR DD for binary j2ee archive
Module j2eeModule = app.getFirstModule(references[i].getArchiveName());
- if (j2eeModule == null)
+ // If it is not a j2ee module and the component project is the ear, it is just an archive
+ // and we can ignore as it will be processed by the EAR deployable.members() method
+ if (j2eeModule == null && (moduleComponent.getProject() == component.getProject()))
continue;
- ArtifactEdit moduleEdit = null;
- try {
- String moduleVersion = null;
- String moduleType = null;
- if (j2eeModule.isEjbModule()) {
- moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.EJB);
- EJBJar ejbJar = (EJBJar) moduleEdit.getContentModelRoot();
- moduleType = J2EEProjectUtilities.EJB;
- moduleVersion = ejbJar.getVersion();
+
+ String moduleVersion = null;
+ String moduleType = null;
+ // Handle the binary J2EE module case
+ if(j2eeModule != null){
+ ArtifactEdit moduleEdit = null;
+ try {
+ if (j2eeModule.isEjbModule()) {
+ moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.EJB);
+ EJBJar ejbJar = (EJBJar) moduleEdit.getContentModelRoot();
+ moduleType = J2EEProjectUtilities.EJB;
+ moduleVersion = ejbJar.getVersion();
+ }
+ else if (j2eeModule.isWebModule()) {
+ moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.DYNAMIC_WEB);
+ WebApp webApp = (WebApp) moduleEdit.getContentModelRoot();
+ moduleType = J2EEProjectUtilities.DYNAMIC_WEB;
+ moduleVersion = webApp.getVersion();
+ }
+ else if (j2eeModule.isConnectorModule()) {
+ moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.JCA);
+ Connector connector = (Connector) moduleEdit.getContentModelRoot();
+ moduleType = J2EEProjectUtilities.JCA;
+ moduleVersion = connector.getVersion();
+ }
+ else if (j2eeModule.isJavaModule()) {
+ moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.APPLICATION_CLIENT);
+ ApplicationClient appClient = (ApplicationClient) moduleEdit.getContentModelRoot();
+ moduleType = J2EEProjectUtilities.APPLICATION_CLIENT;
+ moduleVersion = appClient.getVersion();
+ }
+ } finally {
+ if (moduleEdit!=null)
+ moduleEdit.dispose();
}
- else if (j2eeModule.isWebModule()) {
- moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.DYNAMIC_WEB);
- WebApp webApp = (WebApp) moduleEdit.getContentModelRoot();
- moduleType = J2EEProjectUtilities.DYNAMIC_WEB;
- moduleVersion = webApp.getVersion();
- }
- else if (j2eeModule.isConnectorModule()) {
- moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.JCA);
- Connector connector = (Connector) moduleEdit.getContentModelRoot();
- moduleType = J2EEProjectUtilities.JCA;
- moduleVersion = connector.getVersion();
- }
- else if (j2eeModule.isJavaModule()) {
- moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.APPLICATION_CLIENT);
- ApplicationClient appClient = (ApplicationClient) moduleEdit.getContentModelRoot();
- moduleType = J2EEProjectUtilities.APPLICATION_CLIENT;
- moduleVersion = appClient.getVersion();
- }
-
- IModule nestedModule = createModule(moduleComponent.getDeployedName(), moduleComponent.getDeployedName(), moduleType, moduleVersion, moduleComponent.getProject());
- if (nestedModule!=null) {
- J2EEFlexProjDeployable moduleDelegate = new J2EEFlexProjDeployable(moduleComponent.getProject(), moduleComponent);
- moduleDelegates.put(nestedModule, moduleDelegate);
- projectModules.add(nestedModule);
- moduleDelegate.getURI(nestedModule);
- }
- } finally {
- if (moduleEdit!=null)
- moduleEdit.dispose();
+ } else { // Handle the binary utility component outside the EAR case.
+ moduleVersion = J2EEProjectUtilities.UTILITY;
+ moduleType = J2EEVersionConstants.VERSION_1_0_TEXT;
+ }
+
+ IModule nestedModule = createModule(moduleComponent.getDeployedName(), moduleComponent.getDeployedName(), moduleType, moduleVersion, moduleComponent.getProject());
+ if (nestedModule!=null) {
+ J2EEFlexProjDeployable moduleDelegate = new J2EEFlexProjDeployable(moduleComponent.getProject(), moduleComponent);
+ moduleDelegates.put(nestedModule, moduleDelegate);
+ projectModules.add(nestedModule);
+ moduleDelegate.getURI(nestedModule);
}
}
}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java
index 5eb3538..7382e96 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEFlexProjDeployable.java
@@ -14,6 +14,7 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Properties;
@@ -45,6 +46,9 @@
import org.eclipse.jst.server.core.IWebModule;
import org.eclipse.wst.common.componentcore.ArtifactEdit;
import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.ComponentResource;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
import org.eclipse.wst.common.componentcore.internal.util.ComponentUtilities;
import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -61,9 +65,12 @@
* J2EE module superclass.
*/
public class J2EEFlexProjDeployable extends ComponentDeployable implements IJ2EEModule, IEnterpriseApplication, IApplicationClientModule, IConnectorModule, IEJBModule, IWebModule {
- private static final IPath WEB_CLASSES_PATH = new Path("WEB-INF").append("classes"); //$NON-NLS-1$ //$NON-NLS-2$
- private static IPath WEBLIB = new Path("/WEB-INF/lib"); //$NON-NLS-1$
+ private static final IPath WEB_CLASSES_PATH = new Path(J2EEConstants.WEB_INF_CLASSES);
+ private static IPath WEBLIB = new Path(J2EEConstants.WEB_INF_LIB).makeAbsolute();
private IPackageFragmentRoot[] cachedSourceContainers;
+ private IContainer[] cachedOutputContainers;
+ private HashMap cachedOutputMappings;
+ private HashMap cachedSourceOutputPairs;
/**
* Constructor for J2EEFlexProjDeployable.
@@ -109,7 +116,9 @@
* @return a possibly-empty array of Java output folders
*/
public IContainer[] getJavaOutputFolders() {
- return getJavaOutputFolders(getProject());
+ if (cachedOutputContainers == null)
+ cachedOutputContainers = getJavaOutputFolders(getProject());
+ return cachedOutputContainers;
}
public IContainer[] getJavaOutputFolders(IProject project) {
@@ -144,18 +153,22 @@
public IModuleResource[] members() throws CoreException {
members.clear();
+ // Handle binary components
if (component instanceof J2EEModuleVirtualArchiveComponent)
return getBinaryModuleMembers();
+ // If j2ee project structure is a single root structure, just return optimized members
+ if (isSingleRootStructure())
+ return getOptimizedMembers();
+
cachedSourceContainers = J2EEProjectUtilities.getSourceContainers(getProject());
try {
IPath javaPath = Path.EMPTY;
if (J2EEProjectUtilities.isDynamicWebProject(component.getProject()))
javaPath = WEB_CLASSES_PATH;
- IVirtualComponent vc = ComponentCore.createComponent(getProject());
- if (vc != null) {
- IVirtualFolder vFolder = vc.getRootFolder();
+ if (component != null) {
+ IVirtualFolder vFolder = component.getRootFolder();
IModuleResource[] mr = getMembers(vFolder, Path.EMPTY);
int size = mr.length;
for (int j = 0; j < size; j++) {
@@ -166,6 +179,9 @@
IContainer[] javaCont = getJavaOutputFolders();
int size = javaCont.length;
for (int i = 0; i < size; i++) {
+ //If the java output is in the scope of the virtual component, ignore to avoid duplicates
+ if (ComponentCore.createResources(javaCont[i]).length > 0)
+ continue;
IModuleResource[] mr = getMembers(javaCont[i], javaPath, javaPath, javaCont);
int size2 = mr.length;
for (int j = 0; j < size2; j++) {
@@ -173,9 +189,9 @@
}
}
- if (vc != null) {
- addUtilMembers(vc);
- List consumableMembers = getConsumableReferencedMembers(vc);
+ if (component != null) {
+ addUtilMembers(component);
+ List consumableMembers = getConsumableReferencedMembers(component);
if (!consumableMembers.isEmpty())
members.addAll(consumableMembers);
}
@@ -185,6 +201,9 @@
return mr;
} finally {
cachedSourceContainers = null;
+ cachedOutputContainers = null;
+ cachedOutputMappings = null;
+ cachedSourceOutputPairs = null;
}
}
@@ -406,20 +425,44 @@
return contextRoot;
}
- protected boolean isFileInSourceContainer(IFile file) {
- boolean result = false;
+ /**
+ * Find the source container, if any, for the given file.
+ *
+ * @param file
+ * @return IPackageFragmentRoot sourceContainer for IFile
+ */
+ protected IPackageFragmentRoot getSourceContainer(IFile file) {
if (file == null)
- return false;
+ return null;
IPackageFragmentRoot[] srcContainers = getSourceContainers();
for (int i=0; i<srcContainers.length; i++) {
IPath srcPath = srcContainers[i].getPath();
- result = srcPath.isPrefixOf(file.getFullPath());
- if (result)
- break;
+ if (srcPath.isPrefixOf(file.getFullPath()))
+ return srcContainers[i];
}
- return result;
+ return null;
}
-
+
+ /**
+ * Either returns value from cache or stores result as value in cache for the corresponding
+ * output container for the given source container.
+ *
+ * @param sourceContainer
+ * @return IContainer output container for given source container
+ */
+ protected IContainer getOutputContainer(IPackageFragmentRoot sourceContainer) {
+ if (sourceContainer == null)
+ return null;
+
+ HashMap pairs = getCachedSourceOutputPairs();
+ IContainer output = (IContainer) pairs.get(sourceContainer);
+ if (output == null) {
+ output = J2EEProjectUtilities.getOutputContainer(getProject(), sourceContainer);
+ pairs.put(sourceContainer,output);
+ }
+ return output;
+ }
+
private IPackageFragmentRoot[] getSourceContainers() {
if (cachedSourceContainers != null)
return cachedSourceContainers;
@@ -532,4 +575,248 @@
}
return (IVirtualReference[]) result.toArray(new IVirtualReference[result.size()]);
}
+
+ /**
+ * Returns <code>true</code> if this module has a simple structure based on a
+ * single root folder, and <code>false</code> otherwise.
+ * <p>
+ * In a single root structure, all files that are contained within the root folder
+ * are part of the module, and are already in the correct module structure. No
+ * module resources exist outside of this single folder.
+ *
+ * For J2EE, this method will check if the project is already in J2EE spec standard output form.
+ * The project must follow certain rules, but in general, the project's content roots must be source folders
+ * and the output folder must also be the the content root folder.
+ * </p>
+ *
+ * @return <code>true</code> if this module has a single root structure, and
+ * <code>false</code> otherwise
+ */
+ public boolean isSingleRootStructure() {
+ StructureEdit edit = null;
+ try {
+ edit = StructureEdit.getStructureEditForRead(getProject());
+ if (edit == null || edit.getComponent() == null)
+ return false;
+ WorkbenchComponent wbComp = edit.getComponent();
+ List resourceMaps = wbComp.getResources();
+
+ if (J2EEProjectUtilities.isEARProject(getProject())) {
+ // Always return false for EARs so that members for EAR are always calculated and j2ee modules
+ // are filtered out
+ return false;
+ } else if (J2EEProjectUtilities.isDynamicWebProject(getProject())) {
+ // If there are any web lib jar references, this is not a standard project
+ IVirtualReference[] references = ((J2EEModuleVirtualComponent)component).getNonManifestReferences();
+ for (int i=0; i<references.length; i++) {
+ if (references[i].getReferencedComponent().isBinary())
+ return false;
+ }
+ // Ensure there are only basic component resource mappings -- one for the content folder
+ // and any for src folders mapped to WEB-INF/classes
+ if (hasDefaultWebResourceMappings(resourceMaps)) {
+ // Verify only one java output folder
+ if (getJavaOutputFolders().length==1) {
+ // Verify the java output folder is to <content root>/WEB-INF/classes
+ IPath javaOutputPath = getJavaOutputFolders()[0].getProjectRelativePath();
+ IPath compRootPath = component.getRootFolder().getUnderlyingFolder().getProjectRelativePath();
+ if (compRootPath.append(J2EEConstants.WEB_INF_CLASSES).equals(javaOutputPath))
+ return true;
+ }
+ }
+ return false;
+ } else if (J2EEProjectUtilities.isEJBProject(getProject()) || J2EEProjectUtilities.isJCAProject(getProject())
+ || J2EEProjectUtilities.isApplicationClientProject(getProject()) || J2EEProjectUtilities.isUtilityProject(getProject())) {
+ // Ensure there are only source folder component resource mappings to the root content folder
+ if (isRootResourceMapping(resourceMaps,false)) {
+ // Verify only one java outputfolder
+ if (getJavaOutputFolders().length==1) {
+ // At this point for utility projects, this project is optimized, we can just use the output folder
+ if (J2EEProjectUtilities.isUtilityProject(getProject()))
+ return true;
+ // Verify the java output folder is the same as one of the content roots
+ IPath javaOutputPath = getJavaOutputFolders()[0].getProjectRelativePath();
+ IContainer[] rootFolders = component.getRootFolder().getUnderlyingFolders();
+ for (int i=0; i<rootFolders.length; i++) {
+ IPath compRootPath = rootFolders[i].getProjectRelativePath();
+ if (javaOutputPath.equals(compRootPath))
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ return true;
+ } finally {
+ if (edit !=null)
+ edit.dispose();
+ }
+ }
+
+ /**
+ * Ensure that any component resource mappings are for source folders and
+ * that they map to the root content folder
+ *
+ * @param resourceMaps
+ * @return boolean
+ */
+ private boolean isRootResourceMapping(List resourceMaps, boolean isForEAR) {
+ // If the list is empty, return false
+ if (resourceMaps.size()<1)
+ return false;
+
+ for (int i=0; i<resourceMaps.size(); i++) {
+ ComponentResource resourceMap = (ComponentResource) resourceMaps.get(i);
+ // Verify it maps to "/" for the content root
+ if (!resourceMap.getRuntimePath().equals(Path.ROOT))
+ return false;
+ // If this is not for an EAR, verify it is also a src container
+ if (!isForEAR) {
+ IPath sourcePath = getProject().getFullPath().append(resourceMap.getSourcePath());
+ if (!isSourceContainer(sourcePath))
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Checks if the path argument is to a source container for the project.
+ *
+ * @param a workspace relative full path
+ * @return is path a source container?
+ */
+ private boolean isSourceContainer(IPath path) {
+ IPackageFragmentRoot[] srcContainers = getSourceContainers();
+ for (int i=0; i<srcContainers.length; i++) {
+ if (srcContainers[i].getPath().equals(path))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Ensure the default web setup is correct with one resource map and any number of java
+ * resource maps to WEB-INF/classes
+ *
+ * @param resourceMaps
+ * @return boolean
+ */
+ private boolean hasDefaultWebResourceMappings(List resourceMaps) {
+ int rootValidMaps = 0;
+ int javaValidRoots = 0;
+
+ // If there aren't at least 2 maps, return false
+ if (resourceMaps.size()<2)
+ return false;
+
+ IPath webInfClasses = new Path(J2EEConstants.WEB_INF_CLASSES).makeAbsolute();
+ for (int i=0; i<resourceMaps.size(); i++) {
+ ComponentResource resourceMap = (ComponentResource) resourceMaps.get(i);
+ IPath sourcePath = getProject().getFullPath().append(resourceMap.getSourcePath());
+
+ // Verify if the map is for the content root
+ if (resourceMap.getRuntimePath().equals(Path.ROOT)) {
+ rootValidMaps++;
+ // Verify if the map is for a java src folder and is mapped to "WEB-INF/classes"
+ } else if (resourceMap.getRuntimePath().equals(webInfClasses) && isSourceContainer(sourcePath)) {
+ javaValidRoots++;
+ // Otherwise we bail because we have a non optimized map
+ } else {
+ return false;
+ }
+ }
+ // Make sure only one of the maps is the content root, and that at least one is for the java folder
+ return rootValidMaps==1 && javaValidRoots>0;
+ }
+
+ /**
+ * This method is added for performance reasons.
+ * It assumes the virtual component is not using any flexible features and is in a standard J2EE format
+ * with one component root folder and an output folder the same as its content folder. This will bypass
+ * the virtual component API and just return the module resources as they are on disk.
+ *
+ * @return array of ModuleResources
+ * @throws CoreException
+ */
+ private IModuleResource[] getOptimizedMembers() throws CoreException {
+ if (component != null) {
+ // For java utility modules, we can just use the output container, at this point we know there is only one
+ if (J2EEProjectUtilities.isUtilityProject(getProject())) {
+ return getModuleResources(Path.EMPTY, getJavaOutputFolders()[0]);
+ }
+ // For J2EE modules, we use the contents of the content root
+ else {
+ IVirtualFolder vFolder = component.getRootFolder();
+ return getModuleResources(Path.EMPTY, vFolder.getUnderlyingFolder());
+ }
+ }
+ return new IModuleResource[] {};
+ }
+
+ /**
+ * This method will return from cache or add to cache whether or not an output container
+ * is mapped in the virtual component.
+ *
+ * @param outputContainer
+ * @return if output container is mapped
+ */
+ private boolean isOutputContainerMapped(IContainer outputContainer) {
+ if (outputContainer == null)
+ return false;
+
+ HashMap outputMaps = getCachedOutputMappings();
+ Boolean result = (Boolean) outputMaps.get(outputContainer);
+ if (result == null) {
+ // If there are any component resources for the container, we know it is mapped
+ if (ComponentCore.createResources(outputContainer).length > 0)
+ result = Boolean.TRUE;
+ // Otherwise it is not mapped
+ else
+ result = Boolean.FALSE;
+ // Cache the result in the map for this output container
+ outputMaps.put(outputContainer, result);
+ }
+ return result.booleanValue();
+ }
+
+ /**
+ * Lazy initialize the cached output mappings
+ * @return HashMap
+ */
+ private HashMap getCachedOutputMappings() {
+ if (cachedOutputMappings==null)
+ cachedOutputMappings = new HashMap();
+ return cachedOutputMappings;
+ }
+
+ /**
+ * Lazy initialize the cached source - output pairings
+ * @return HashMap
+ */
+ private HashMap getCachedSourceOutputPairs() {
+ if (cachedSourceOutputPairs==null)
+ cachedSourceOutputPairs = new HashMap();
+ return cachedSourceOutputPairs;
+ }
+
+ /**
+ * This file should be added to the members list from the virtual component maps only if:
+ * a) it is not in a source folder
+ * b) it is in a source folder, and the corresponding output folder is a mapped component resource
+ *
+ * @return boolean should file be added to members
+ */
+ protected boolean shouldAddComponentFile(IFile file) {
+ IPackageFragmentRoot sourceContainer = getSourceContainer(file);
+ // If the file is not in a source container, return true
+ if (sourceContainer==null) {
+ return true;
+ // Else if it is a source container and the output container is mapped in the component, return true
+ // Otherwise, return false.
+ } else {
+ IContainer outputContainer = getOutputContainer(sourceContainer);
+ return outputContainer!=null && isOutputContainerMapped(outputContainer);
+ }
+ }
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEModuleConstants.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEModuleConstants.java
index 5174b5d..6facc62 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEModuleConstants.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/IJ2EEModuleConstants.java
@@ -28,4 +28,5 @@
public static final String JST_JCA_TEMPLATE = "template.jst.connector"; //$NON-NLS-1$
public static final String JST_WEB_TEMPLATE = "template.jst.web"; //$NON-NLS-1$
public static final String WST_WEB_TEMPLATE = "template.wst.web"; //$NON-NLS-1$
+ public static final String JST_COMPONENT_FILE = "org.eclipse.wst.common.component";//$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java
index 38920bd..bfe3e1d 100644
--- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java
+++ b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java
@@ -38,6 +38,8 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -48,6 +50,7 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jem.util.UIContextDetermination;
+import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jem.workbench.utility.JemProjectUtilities;
import org.eclipse.jst.j2ee.application.ApplicationFactory;
import org.eclipse.jst.j2ee.application.ApplicationPackage;
@@ -506,7 +509,17 @@
public void stop(BundleContext context) throws Exception {
super.stop(context);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(J2EEComponentClasspathUpdater.getInstance());
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(J2EEComponentClasspathUpdater.getInstance());
+ try {
+ org.eclipse.core.runtime.Platform.getJobManager().join( J2EEElementChangedListener.PROJECT_COMPONENT_UPDATE_JOB_FAMILY,
+ new NullProgressMonitor() );
+ } catch (OperationCanceledException e) {
+ Logger.getLogger().logError(e.getMessage());
+ } catch (InterruptedException e) {
+ Logger.getLogger().logError(e.getMessage());
+ }
+
}
/*
diff --git a/plugins/org.eclipse.jst.j2ee/property_files/projectsupport.properties b/plugins/org.eclipse.jst.j2ee/property_files/projectsupport.properties
index 6134592..a4c23be 100644
--- a/plugins/org.eclipse.jst.j2ee/property_files/projectsupport.properties
+++ b/plugins/org.eclipse.jst.j2ee/property_files/projectsupport.properties
@@ -43,3 +43,5 @@
Catalog_Lib_Directory__UI_=Catalog Lib Directory:
Sychronize_Class_Path_UI_=Sychronize Class Path
UNABLE_TO_LOAD_MODULE_ERROR_=UNABLE_TO_LOAD_MODULE_ERROR_
+Importing_archive=Importing archive ''{0}''.
+Exporting_archive=Exporting archive ''{0}''.
diff --git a/plugins/org.eclipse.jst.servlet.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.servlet.ui/META-INF/MANIFEST.MF
index 1deb5b0..3b46bd8 100644
--- a/plugins/org.eclipse.jst.servlet.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.servlet.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.servlet.ui; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.2.qualifier
Bundle-Activator: org.eclipse.jst.servlet.ui.internal.plugin.ServletUIPlugin
Bundle-Vendor: %pluginVendor
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/ConvertToWebModuleTypeAction.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/ConvertToWebModuleTypeAction.java
index 5d8bffe..2f54e6e 100644
--- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/ConvertToWebModuleTypeAction.java
+++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/actions/ConvertToWebModuleTypeAction.java
@@ -21,7 +21,10 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
+import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties;
+import org.eclipse.jst.common.project.facet.JavaFacetInstallDataModelProvider;
import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties;
import org.eclipse.jst.j2ee.web.project.facet.WebFacetInstallDataModelProvider;
@@ -36,6 +39,7 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.project.facet.ProductManager;
import org.eclipse.wst.web.ui.internal.Logger;
/**
* Convert a simple static web project to a J2EE Dynamic Web Project
@@ -124,12 +128,22 @@
IFacetedProject.Action uninstall = new IFacetedProject.Action(IFacetedProject.Action.Type.UNINSTALL, facetedProject.getInstalledVersion(webFacet), null);
IDataModel webModelCfg = DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
webModelCfg.setBooleanProperty(IWebFacetInstallDataModelProperties.ADD_TO_EAR, false);
+
+ IDataModel javaModelCfg = null;
+ if (ProductManager.shouldUseSingleRootStructure()){
+ javaModelCfg = DataModelFactory.createDataModel(new JavaFacetInstallDataModelProvider());
+ String webRoot = webModelCfg.getStringProperty(IWebFacetInstallDataModelProperties.CONFIG_FOLDER);
+ javaModelCfg.setProperty(IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME,
+ webRoot+"/"+ J2EEConstants.WEB_INF_CLASSES); //$NON-NLS-1$
+ }
+
IFacetedProject.Action install = new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL,webFv,webModelCfg);
- IFacetedProject.Action javaInstall = new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL, javaFv, null);
+ IFacetedProject.Action javaInstall = new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL, javaFv, javaModelCfg);
Set set = new HashSet();
set.add(uninstall);
set.add(install);
set.add(javaInstall);
+
facetedProject.modify(set, new NullProgressMonitor());
}
}
\ No newline at end of file
diff --git a/plugins/org.eclipse.wst.web/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.web/META-INF/MANIFEST.MF
index ac1f6dd..ab7ecd8 100644
--- a/plugins/org.eclipse.wst.web/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.web/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.wst.web; singleton:=true
-Bundle-Version: 1.1.1.qualifier
+Bundle-Version: 1.1.2.qualifier
Bundle-Activator: org.eclipse.wst.web.internal.WSTWebPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/IProductConstants.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/IProductConstants.java
index 58b8d9a..27b8524 100644
--- a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/IProductConstants.java
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/IProductConstants.java
@@ -14,8 +14,13 @@
public static final String APPLICATION_CONTENT_FOLDER = "earContent"; //$NON-NLS-1$
public static final String WEB_CONTENT_FOLDER = "webContent"; //$NON-NLS-1$
+ public static final String EJB_CONTENT_FOLDER = "ejbContent"; //$NON-NLS-1$
+ public static final String APP_CLIENT_CONTENT_FOLDER = "appClientContent"; //$NON-NLS-1$
+ public static final String JCA_CONTENT_FOLDER = "jcaContent"; //$NON-NLS-1$
+ public static final String DEFAULT_SOURCE_FOLDER = "defaultSource"; //$NON-NLS-1$
public static final String ADD_TO_EAR_BY_DEFAULT = "addToEarByDefault"; //$NON-NLS-1$
public static final String OUTPUT_FOLDER = "outputFolder"; //$NON-NLS-1$
+ public static final String USE_SINGLE_ROOT_STRUCTURE = "useSingleRootStructure"; //$NON-NLS-1$
/**
* Alters the final perspective used by the following new project wizards
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ProductManager.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ProductManager.java
index 371b818..853b6c2 100644
--- a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ProductManager.java
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/project/facet/ProductManager.java
@@ -19,8 +19,13 @@
*/
private static final String APPLICATION_CONTENT_FOLDER = "EarContent"; //$NON-NLS-1$
private static final String WEB_CONTENT_FOLDER = "WebContent"; //$NON-NLS-1$
+ private static final String EJB_CONTENT_FOLDER = "ejbModule"; //$NON-NLS-1$
+ private static final String APP_CLIENT_CONTENT_FOLDER = "appClientModule"; //$NON-NLS-1$
+ private static final String JCA_CONTENT_FOLDER = "connectorModule"; //$NON-NLS-1$
+ private static final String DEFAULT_SOURCE_FOLDER = "src"; //$NON-NLS-1$
private static final String ADD_TO_EAR_BY_DEFAULT = "false"; //$NON-NLS-1$
private static final String OUTPUT_FOLDER = "build/classes"; //$NON-NLS-1$
+ private static final String USE_SINGLE_ROOT_STRUCTURE = "false"; //$NON-NLS-1$
private static final String FINAL_PERSPECTIVE = "org.eclipse.jst.j2ee.J2EEPerspective"; //$NON-NLS-1$
private static final char RUNTIME_SEPARATOR = ':';
private static final String[] DEFAULT_RUNTIME_KEYS =
@@ -46,8 +51,18 @@
return APPLICATION_CONTENT_FOLDER;
else if (key.equals(IProductConstants.WEB_CONTENT_FOLDER))
return WEB_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.EJB_CONTENT_FOLDER))
+ return EJB_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.APP_CLIENT_CONTENT_FOLDER))
+ return APP_CLIENT_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.JCA_CONTENT_FOLDER))
+ return JCA_CONTENT_FOLDER;
+ else if (key.equals(IProductConstants.DEFAULT_SOURCE_FOLDER))
+ return DEFAULT_SOURCE_FOLDER;
else if (key.equals(IProductConstants.ADD_TO_EAR_BY_DEFAULT))
return ADD_TO_EAR_BY_DEFAULT;
+ else if (key.equals(IProductConstants.USE_SINGLE_ROOT_STRUCTURE))
+ return USE_SINGLE_ROOT_STRUCTURE;
else if (key.equals(IProductConstants.OUTPUT_FOLDER))
return OUTPUT_FOLDER;
else if (key.equals(IProductConstants.FINAL_PERSPECTIVE_APPCLIENT))
@@ -72,6 +87,11 @@
String value = getProperty(IProductConstants.ADD_TO_EAR_BY_DEFAULT);
return Boolean.valueOf(value).booleanValue();
}
+
+ public static boolean shouldUseSingleRootStructure() {
+ String value = getProperty(IProductConstants.USE_SINGLE_ROOT_STRUCTURE);
+ return Boolean.valueOf(value).booleanValue();
+ }
public static List/*<IRuntime>*/ getDefaultRuntimes() {
List theRuntimes = null;
diff --git a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/ComponentDeployable.java b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/ComponentDeployable.java
index b8d299b..3a7a9be 100644
--- a/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/ComponentDeployable.java
+++ b/plugins/org.eclipse.wst.web/static_web_project/org/eclipse/wst/web/internal/deployables/ComponentDeployable.java
@@ -217,7 +217,7 @@
addMembersToModuleFolder(mf, mr);
} else {
IFile f = (IFile) res[j].getUnderlyingResource();
- if (!isFileInSourceContainer(f)) {
+ if (shouldAddComponentFile(f)) {
ModuleFile mf = new ModuleFile(f, f.getName(), path, f.getModificationStamp() + f.getLocalTimeStamp());
list.add(mf);
}
@@ -243,8 +243,16 @@
}
return parent;
}
- protected boolean isFileInSourceContainer(IFile file) {
- return false;
+
+ /**
+ * This method is meant to be overridden by subclasses. Return whether or not to add this file
+ * to the members list.
+ *
+ * @param file
+ * @return boolean should add file?
+ */
+ protected boolean shouldAddComponentFile(IFile file) {
+ return true;
}
/**
@@ -337,15 +345,18 @@
IVirtualReference reference = components[i];
IVirtualComponent virtualComp = reference.getReferencedComponent();
if (shouldIncludeUtilityComponent(virtualComp,components,edit)) {
- IPath archivePath = ((VirtualArchiveComponent)virtualComp).getWorkspaceRelativePath();
ModuleFile mf = null;
+ String archiveName = reference.getArchiveName();
+ IPath archivePath = ((VirtualArchiveComponent)virtualComp).getWorkspaceRelativePath();
if (archivePath != null) { //In Workspace
IFile utilFile = ResourcesPlugin.getWorkspace().getRoot().getFile(archivePath);
- mf = new ModuleFile(utilFile, utilFile.getName(), reference.getRuntimePath().makeRelative());
+ String name = null != archiveName ? archiveName : utilFile.getName();
+ mf = new ModuleFile(utilFile, name, reference.getRuntimePath().makeRelative());
}
else {
File extFile = ((VirtualArchiveComponent)virtualComp).getUnderlyingDiskFile();
- mf = new ModuleFile(extFile, extFile.getName(), reference.getRuntimePath().makeRelative());
+ String name = null != archiveName ? archiveName : extFile.getName();
+ mf = new ModuleFile(extFile, name, reference.getRuntimePath().makeRelative());
}
if (mf == null)
continue;