diff options
author | kchan | 2007-07-25 17:45:36 +0000 |
---|---|---|
committer | kchan | 2007-07-25 17:45:36 +0000 |
commit | d7ed59931bceae47dac46d93640b77116791120b (patch) | |
tree | f0d6ccfa1c3ce0f9c14a267efb1c12813fd43549 /bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common | |
parent | 724eae3ab1d92694ed04528b518a072a32498741 (diff) | |
download | webtools.webservices-d7ed59931bceae47dac46d93640b77116791120b.tar.gz webtools.webservices-d7ed59931bceae47dac46d93640b77116791120b.tar.xz webtools.webservices-d7ed59931bceae47dac46d93640b77116791120b.zip |
[194434] Check for existance of project and EAR at specified location.
Diffstat (limited to 'bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common')
2 files changed, 31 insertions, 2 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java index ec3795d4b..bba32af1e 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/DefaultingUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2007 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 @@ -10,12 +10,14 @@ * yyyymmdd bug Email and other contact information * -------- -------- ----------------------------------------------------------- * 20060427 138058 joan@ca.ibm.com - Joan Haggarty + * 20070723 194434 kathy@ca.ibm.com - Kathy Chan, Check for non-existing EAR with content not deleted *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.common; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IStatus; +import org.eclipse.jem.util.emf.workbench.ProjectUtilities; import org.eclipse.jst.ws.internal.common.J2EEUtils; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; @@ -73,8 +75,27 @@ public class DefaultingUtils { } } + + String baseEARName = projectName + ResourceUtils.getDefaultEARExtension(); + String earName = baseEARName; + + boolean foundEAR = false; + int i = 1; + + while (!foundEAR) { + // 194434 - Check for non-existing EAR with contents that's not deleted previously + IStatus canCreateEARStatus = J2EEUtils.canCreateEAR(ProjectUtilities.getProject(earName)); + if (canCreateEARStatus.isOK()) { + foundEAR = true; + } else { + earName = baseEARName + i; + i++; + } + } + + //Step 2 - return project name with EAR on the end - return projectName + ResourceUtils.getDefaultEARExtension(); + return earName; } //Step 3 - return the default EAR project name diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java index 31ae8f6e8..fe9ab22f2 100644 --- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java +++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java @@ -19,6 +19,7 @@ * 20060427 138058 joan@ca.ibm.com - Joan Haggarty * 20060905 156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson + * 20070723 194434 kathy@ca.ibm.com - Kathy Chan, Check for non-existing EAR with content not deleted *******************************************************************************/ package org.eclipse.jst.ws.internal.consumption.ui.common; @@ -410,6 +411,13 @@ public class ValidationUtils if (needEar) { IProject project = ProjectUtilities.getProject(projectName); IProject ep = ProjectUtilities.getProject(earProjectName); + + // 194434 - Check for non-existing EAR with contents that's not deleted previously + IStatus canCreateEARStatus = J2EEUtils.canCreateEAR(ep); + if (!canCreateEARStatus.isOK()) { + return canCreateEARStatus; + } + if (project.exists() && ep.exists()) { if (!J2EEUtils.isComponentAssociated(ep, project)) { IStatus associateStatus = J2EEUtils.canAssociateProjectToEAR(project, ep); |