[271802] Need a hook for adoptors to disable classpath attribute org.eclipse.jst.component.dependency
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 f24bfd0..840f27c 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
@@ -44,7 +44,6 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase; import org.eclipse.jem.util.logger.proxy.Logger; -import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil; import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants; import org.eclipse.jst.j2ee.commonarchivecore.internal.File; import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ResourceLoadException; @@ -55,6 +54,7 @@ import org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil; import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent; import org.eclipse.jst.j2ee.internal.J2EEConstants; +import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyEnablement; import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyManifestUtil; import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent; import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; @@ -209,7 +209,7 @@ filesHolder = new FilesHolder(); exception = new Exception(); this.includeClasspathComponents = includeClasspathComponents; - if (includeClasspathComponents && ClasspathDependencyUtil.isAllowClasspathComponentDependency()) { + if (includeClasspathComponents && ClasspathDependencyEnablement.isAllowClasspathComponentDependency()) { this.manifestFile = vComponent.getRootFolder().getFile(new Path(J2EEConstants.MANIFEST_URI)); saveJavaClasspathReferences(); }
diff --git a/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/classpathdep/ClasspathDependencyUtil.java b/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/classpathdep/ClasspathDependencyUtil.java index d58e53a..6c796e6 100644 --- a/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/classpathdep/ClasspathDependencyUtil.java +++ b/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/classpathdep/ClasspathDependencyUtil.java
@@ -33,6 +33,7 @@ import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent; import org.eclipse.jst.j2ee.internal.J2EEVersionConstants; +import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyEnablement; import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator; import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent; import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator.ClasspathDependencyValidatorData; @@ -54,21 +55,6 @@ public class ClasspathDependencyUtil implements IClasspathDependencyConstants { /** - * This flag is used to control the enablement of the Classpath Dependency - * functionality. The default value is true which enables this functionality. - * Setting this value to false will disable the functionality. - */ - private static boolean allowClasspathComponentDependnecy = true; - - public static void setAllowClasspathComponentDependency(boolean allow){ - allowClasspathComponentDependnecy = allow; - } - - public static boolean isAllowClasspathComponentDependency(){ - return allowClasspathComponentDependnecy; - } - - /** * This is equivalent to calling getRawComponentClasspathDependencies(javaProject, DependencyAttributeType.CLASSPATH_COMPONENT_DEPENDENCY); * * @deprecated use {@link #getRawComponentClasspathDependencies(IJavaProject, org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants.DependencyAttributeType)} @@ -92,7 +78,7 @@ * @throws CoreException Thrown if an error is encountered accessing the unresolved classpath. */ public static Map getRawComponentClasspathDependencies(final IJavaProject javaProject, DependencyAttributeType attributeType) throws CoreException { - if (javaProject == null || !isAllowClasspathComponentDependency()) { + if (javaProject == null || !ClasspathDependencyEnablement.isAllowClasspathComponentDependency()) { return Collections.EMPTY_MAP; } final Map referencedRawEntries = new HashMap(); @@ -120,7 +106,7 @@ public static List getPotentialComponentClasspathDependencies(final IJavaProject javaProject) throws CoreException { final List potentialRawEntries = new ArrayList(); - if (javaProject == null || !javaProject.getProject().isAccessible() || !isAllowClasspathComponentDependency()) { + if (javaProject == null || !javaProject.getProject().isAccessible() || !ClasspathDependencyEnablement.isAllowClasspathComponentDependency()) { return Collections.EMPTY_LIST; } final IProject project = javaProject.getProject(); @@ -273,7 +259,7 @@ * @throws CoreException Thrown if an error is encountered accessing the unresolved classpath. */ public static Map getComponentClasspathDependencies(final IJavaProject javaProject, final boolean isWebApp, final boolean onlyValid) throws CoreException { - if(!isAllowClasspathComponentDependency()){ + if(!ClasspathDependencyEnablement.isAllowClasspathComponentDependency()){ return Collections.EMPTY_MAP; } @@ -583,7 +569,7 @@ * @return The IClasspathAttribute that holds the special WTP attribute or null if one was not found. */ public static IClasspathAttribute checkForComponentDependencyAttribute(final IClasspathEntry entry, final DependencyAttributeType attributeType) { - if (entry == null || !isAllowClasspathComponentDependency()) { + if (entry == null || !ClasspathDependencyEnablement.isAllowClasspathComponentDependency()) { return null; } final IClasspathAttribute[] attributes = entry.getExtraAttributes();
diff --git a/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/internal/classpathdep/ClasspathDependencyEnablement.java b/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/internal/classpathdep/ClasspathDependencyEnablement.java new file mode 100644 index 0000000..5d193ba --- /dev/null +++ b/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/internal/classpathdep/ClasspathDependencyEnablement.java
@@ -0,0 +1,20 @@ +package org.eclipse.jst.j2ee.internal.classpathdep; + +public class ClasspathDependencyEnablement { + + /** + * This flag is used to control the enablement of the Classpath Dependency + * functionality. The default value is true which enables this functionality. + * Setting this value to false will disable the functionality. + */ + private static boolean allowClasspathComponentDependnecy = true; + + public static void setAllowClasspathComponentDependency(boolean allow){ + allowClasspathComponentDependnecy = allow; + } + + public static boolean isAllowClasspathComponentDependency(){ + return allowClasspathComponentDependnecy; + } + +}
diff --git a/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/internal/classpathdep/ClasspathDependencyValidator.java b/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/internal/classpathdep/ClasspathDependencyValidator.java index ea910c8..923f779 100644 --- a/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/internal/classpathdep/ClasspathDependencyValidator.java +++ b/plugins/org.eclipse.jst.j2ee/classpathdep/org/eclipse/jst/j2ee/internal/classpathdep/ClasspathDependencyValidator.java
@@ -72,7 +72,7 @@ public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException { - if(!ClasspathDependencyUtil.isAllowClasspathComponentDependency()){ + if(!ClasspathDependencyEnablement.isAllowClasspathComponentDependency()){ return OK_STATUS; } _reporter = reporter;
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 25a372a..5a9ecab 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
@@ -38,6 +38,7 @@ import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest; import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent; import org.eclipse.jst.j2ee.internal.J2EEConstants; +import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyEnablement; import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; import org.eclipse.wst.common.componentcore.ComponentCore; @@ -645,7 +646,7 @@ classPathWLPSelection.addClasspathElement(element, unresolvedURI); } } - if(ClasspathDependencyUtil.isAllowClasspathComponentDependency()){ + if(ClasspathDependencyEnablement.isAllowClasspathComponentDependency()){ // Add elements for raw classpath entries (either already tagged or potentially taggable) try { classPathWLPSelection.createClasspathEntryElements(component, WEBLIB, WEBINF_CLASSES);
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 5ce9220..0ab23bb 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
@@ -57,6 +57,7 @@ import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent; import org.eclipse.jst.j2ee.internal.archive.operations.ComponentLoadStrategyImpl; import org.eclipse.jst.j2ee.internal.archive.operations.EARComponentLoadStrategyImpl; +import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyEnablement; import org.eclipse.jst.j2ee.internal.plugin.J2EEPlugin; import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; import org.eclipse.jst.j2ee.model.IModelProvider; @@ -660,7 +661,7 @@ //createClasspathComponentDependencyElements(comp); // Add elements for raw classpath entries (either already tagged or potentially taggable) - if(ClasspathDependencyUtil.isAllowClasspathComponentDependency()){ + if(ClasspathDependencyEnablement.isAllowClasspathComponentDependency()){ try { createClasspathEntryElements(component, IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH, IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_COMPONENT_PATH); } catch (CoreException ce) {
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 5077f69..cb4e474 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
@@ -34,6 +34,7 @@ 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.classpathdep.ClasspathDependencyEnablement; import org.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyVirtualComponent; import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; import org.eclipse.jst.j2ee.project.EarUtilities; @@ -177,7 +178,7 @@ } private IVirtualReference[] getJavaClasspathReferences(IVirtualReference[] hardReferences) { - if(!ClasspathDependencyUtil.isAllowClasspathComponentDependency()){ + if(!ClasspathDependencyEnablement.isAllowClasspathComponentDependency()){ return new IVirtualReference[0]; } final IProject project = getProject();