diff options
author | kchan | 2005-10-06 20:41:25 +0000 |
---|---|---|
committer | kchan | 2005-10-06 20:41:25 +0000 |
commit | 977c20a9b3fe3dbe87f360dc73fa9275adbd03c4 (patch) | |
tree | 692c51993a11768793f4d682dc54ee9a13fb664a /bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org | |
parent | 6ad9ab51e1de05dc04a695e0edbc5dde30ab4984 (diff) | |
download | webtools.webservices-977c20a9b3fe3dbe87f360dc73fa9275adbd03c4.tar.gz webtools.webservices-977c20a9b3fe3dbe87f360dc73fa9275adbd03c4.tar.xz webtools.webservices-977c20a9b3fe3dbe87f360dc73fa9275adbd03c4.zip |
[111841] Removing use of StructureEdit.
Diffstat (limited to 'bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org')
-rw-r--r-- | bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/util/ClasspathUtils.java | 135 |
1 files changed, 59 insertions, 76 deletions
diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/util/ClasspathUtils.java b/bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/util/ClasspathUtils.java index 9a07b9dcb..bfce400a9 100644 --- a/bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/util/ClasspathUtils.java +++ b/bundles/org.eclipse.jst.ws.axis.consumption.ui/src/org/eclipse/jst/ws/internal/axis/consumption/ui/util/ClasspathUtils.java @@ -29,7 +29,6 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jst.ws.internal.common.J2EEUtils; import org.eclipse.wst.common.componentcore.ComponentCore; import org.eclipse.wst.common.componentcore.internal.StructureEdit; -import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent; import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; import org.eclipse.wst.common.componentcore.resources.IVirtualResource; @@ -81,78 +80,69 @@ public class ClasspathUtils { private String[] getClasspath(IProject project, boolean isDependent, String inputModule) { -// inputModule is valid only if it's not a dependent project +// inputModule is valid only if it's not a dependent project String[] moduleClasspath = new String[0]; ArrayList projectClasspath = new ArrayList(); boolean needJavaClasspath = false; - StructureEdit mc = null; IFolder webModuleServerRoot = null; IFolder webModuleClasses = null; - try { - String module; - IVirtualComponent comp = ComponentCore.createComponent(project); - if (comp != null) { - mc = StructureEdit.getStructureEditForRead(project); - WorkbenchComponent wbc = mc.getComponent(); - module = wbc.getName(); - // get the module's classpath - - if (J2EEUtils.isEARComponent(comp)) { - moduleClasspath = getClasspathForEARProject(project, module); - } else if (J2EEUtils.isWebComponent(comp)) { - webModuleServerRoot = StructureEdit.getOutputContainerRoot(wbc); - if (webModuleServerRoot != null) { - webModuleClasses = webModuleServerRoot.getFolder(WEBINF).getFolder(DIR_CLASSES); - if (webModuleClasses != null) - moduleClasspath = new String[] { webModuleClasses.getLocation().toOSString() }; - } - } else if (J2EEUtils.isJavaComponent(comp)) { - needJavaClasspath = true; - webModuleServerRoot = StructureEdit.getOutputContainerRoot(wbc); - if (webModuleServerRoot != null) { - moduleClasspath = new String[] { webModuleServerRoot.getLocation().toOSString() }; - } + IVirtualComponent comp = ComponentCore.createComponent(project); + if (comp != null) { + // get the module's classpath + + if (J2EEUtils.isEARComponent(comp)) { + moduleClasspath = getClasspathForEARProject(project, comp.getName()); + } else if (J2EEUtils.isWebComponent(comp)) { + webModuleServerRoot = StructureEdit.getOutputContainerRoot(comp); + if (webModuleServerRoot != null) { + webModuleClasses = webModuleServerRoot.getFolder(WEBINF).getFolder(DIR_CLASSES); + if (webModuleClasses != null) + moduleClasspath = new String[] { webModuleClasses.getLocation().toOSString() }; } - - // add module classpath to project classpath - for (int j = 0; j < moduleClasspath.length; j++) { - projectClasspath.add(moduleClasspath[j]); + } else if (J2EEUtils.isJavaComponent(comp)) { + needJavaClasspath = true; + webModuleServerRoot = StructureEdit.getOutputContainerRoot(comp); + if (webModuleServerRoot != null) { + moduleClasspath = new String[] { webModuleServerRoot.getLocation().toOSString() }; } - - if (!isDependent) { - if (J2EEUtils.isWebComponent(comp)) { - needJavaClasspath = true; - moduleClasspath = getWEBINFLib(project, inputModule); - for (int j = 0; j < moduleClasspath.length; j++) { - projectClasspath.add(moduleClasspath[j]); - } + } + + // add module classpath to project classpath + for (int j = 0; j < moduleClasspath.length; j++) { + projectClasspath.add(moduleClasspath[j]); + } + + if (!isDependent) { + if (J2EEUtils.isWebComponent(comp)) { + needJavaClasspath = true; + moduleClasspath = getWEBINFLib(project, inputModule); + for (int j = 0; j < moduleClasspath.length; j++) { + projectClasspath.add(moduleClasspath[j]); } } - - } else { - needJavaClasspath = true; } - // If there are Web or Java module in the project, get the project's Java classpath - if (needJavaClasspath) { - String[] javaClasspath; - try { - IJavaProject javaProj = (IJavaProject) project.getNature(JavaCore.NATURE_ID); - if (javaProj != null) { - javaClasspath = getClasspathForJavaProject(javaProj); - for (int j = 0; j < javaClasspath.length; j++) { - projectClasspath.add(javaClasspath[j]); - } + } else { + needJavaClasspath = true; + } + + // If there are Web or Java module in the project, get the project's Java classpath + if (needJavaClasspath) { + String[] javaClasspath; + try { + IJavaProject javaProj = (IJavaProject) project.getNature(JavaCore.NATURE_ID); + if (javaProj != null) { + javaClasspath = getClasspathForJavaProject(javaProj); + for (int j = 0; j < javaClasspath.length; j++) { + projectClasspath.add(javaClasspath[j]); } - } catch (CoreException e) { - // not able to get Java classpath, just ignore - } - } - } finally { - if (mc != null) - mc.dispose(); + } + } catch (CoreException e) { + // not able to get Java classpath, just ignore + } } + return (String[]) projectClasspath.toArray(new String[projectClasspath.size()]); } @@ -160,24 +150,17 @@ public class ClasspathUtils { private String[] getUtilityJarClasspath(IProject project) { String[] moduleClasspath = new String[0]; ArrayList utilityJarsClasspath = new ArrayList(); - StructureEdit mc = null; - try { - String module; - mc = StructureEdit.getStructureEditForRead(project); - WorkbenchComponent wbc = mc.getComponent(); - IVirtualComponent comp = ComponentCore.createComponent(project); - module = wbc.getName(); - if (J2EEUtils.isEARComponent(comp)) { - moduleClasspath = getClasspathForEARProject(project, module); - for (int j = 0; j < moduleClasspath.length; j++) { - utilityJarsClasspath.add(moduleClasspath[j]); - } - } - - } finally { - if (mc != null) - mc.dispose(); + + String module; + IVirtualComponent comp = ComponentCore.createComponent(project); + module = comp.getName(); + if (J2EEUtils.isEARComponent(comp)) { + moduleClasspath = getClasspathForEARProject(project, module); + for (int j = 0; j < moduleClasspath.length; j++) { + utilityJarsClasspath.add(moduleClasspath[j]); + } } + return (String[]) utilityJarsClasspath.toArray(new String[utilityJarsClasspath.size()]); } |