diff options
author | dgiormov | 2012-02-01 10:56:13 +0000 |
---|---|---|
committer | dgiormov | 2012-02-01 10:56:13 +0000 |
commit | 05f6570e40d3de76c4e0810928cc343a396a16af (patch) | |
tree | 91174a42012cdb5aaeefd7dd5c9a7239494ba3c0 | |
parent | 52c9c48f78c5663bd0b5341f680e35ff35c832bc (diff) | |
download | webtools.javaee-05f6570e40d3de76c4e0810928cc343a396a16af.tar.gz webtools.javaee-05f6570e40d3de76c4e0810928cc343a396a16af.tar.xz webtools.javaee-05f6570e40d3de76c4e0810928cc343a396a16af.zip |
[330753] web.xml content gets deleted when adding servlets via the servlet wizards, Fix will take the web.xml location from the virtual model instead of computing the location from the file system.
2 files changed, 7 insertions, 8 deletions
diff --git a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java index 3273f8422..c417e0b8b 100644 --- a/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java +++ b/plugins/org.eclipse.jst.jee/jeecreation/org/eclipse/jst/jee/model/internal/JEE5ModelProvider.java @@ -51,6 +51,7 @@ import org.eclipse.wst.common.componentcore.ComponentCore; import org.eclipse.wst.common.componentcore.internal.impl.ModuleURIUtil; import org.eclipse.wst.common.componentcore.internal.impl.PlatformURLModuleConnection; import org.eclipse.wst.common.componentcore.internal.impl.WTPResourceFactoryRegistry; +import org.eclipse.wst.common.componentcore.resources.IVirtualFile; import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; import org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateInputProvider; @@ -159,15 +160,12 @@ public class JEE5ModelProvider implements IModelProvider, ResourceStateInputProv String modelPathURI = innerModelPath.toString(); URI uri = URI.createURI(modelPathURI); - IPath projURIPath = new Path("");//$NON-NLS-1$ - projURIPath = projURIPath.append(container.getProjectRelativePath()); - projURIPath = projURIPath.addTrailingSeparator(); - projURIPath = projURIPath.append(innerModelPath); - URI projURI = URI.createURI(projURIPath.toString()); + IVirtualFile dd = container.getFile(innerModelPath); + URI projURI = URI.createURI(dd.getProjectRelativePath().toString()); + XMLResourceImpl res = null; try { - if (proj.getFile(projURI.toString()).exists()) - { + if (dd.exists()) { res = (XMLResourceImpl) resSet.getResource(getModuleURI(uri),true); addManagedResource(res); } else {//First find in resource set, then create if not found new Empty Resource. diff --git a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassWizardPage.java b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassWizardPage.java index 07d996150..47c924756 100644 --- a/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassWizardPage.java +++ b/plugins/org.eclipse.jst.servlet.ui/servlet_ui/org/eclipse/jst/servlet/ui/internal/wizard/NewWebClassWizardPage.java @@ -62,6 +62,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.wst.common.componentcore.ComponentCore; import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; +import org.eclipse.wst.common.componentcore.resources.IVirtualFile; 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; @@ -203,7 +204,7 @@ public abstract class NewWebClassWizardPage extends NewJavaClassWizardPage { IVirtualComponent component = ComponentCore.createComponent(project); if(component.getRootFolder() != null && component.getRootFolder().getUnderlyingFolder() != null){ - IFile ddXmlFile = component.getRootFolder().getUnderlyingFolder().getFile(new Path(J2EEConstants.WEBAPP_DD_URI)); + IVirtualFile ddXmlFile = component.getRootFolder().getFile(new Path(J2EEConstants.WEBAPP_DD_URI)); if (!ddXmlFile.exists()) { // add a flag into the model to create the DD at the beginning of the operation |