diff options
Diffstat (limited to 'plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal')
5 files changed, 46 insertions, 29 deletions
diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategyImpl.java index 7cf293b4c..89cb81f21 100644 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategyImpl.java +++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WTProjectLoadStrategyImpl.java @@ -43,7 +43,7 @@ import com.ibm.wtp.emf.workbench.WorkbenchURIConverterImpl; public class WTProjectLoadStrategyImpl extends org.eclipse.jst.j2ee.internal.archive.operations.J2EELoadStrategyImpl { private final static String SOURCE_DIR = "source"; //$NON-NLS-1$ - public static final String WEBSETTINGS_FILE_URI = ".websettings"; //$NON-NLS-1$ + public static final String WEBSETTINGS_FILE_URI = ".j2ee"; //$NON-NLS-1$ /** * flag which indicates whether or not to export compiled JSP files (compiled files exist in diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebModuleImportDataModel.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebModuleImportDataModel.java index cf3fd3a16..5266f654b 100644 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebModuleImportDataModel.java +++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/archive/operations/WebModuleImportDataModel.java @@ -107,9 +107,9 @@ public final class WebModuleImportDataModel extends J2EEModuleImportDataModel { if (getBooleanProperty(PRESERVE_PROJECT_METADATA)) { WARFileImpl warFile = (WARFileImpl) getArchiveFile(); if (null != warFile) { - if (warFile.containsFile(".websettings")) { //$NON-NLS-1$ + if (warFile.containsFile(".j2ee")) { //$NON-NLS-1$ try { - webContentName = WebSettings.getWebContentDirectory(warFile.getInputStream(".websettings")); //$NON-NLS-1$ + webContentName = WebSettings.getWebContentDirectory(warFile.getInputStream(".j2ee")); //$NON-NLS-1$ } catch (FileNotFoundException e) { } catch (IOException e) { } diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java index 710f89f1d..ba6ad4fd2 100644 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java +++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/J2EEWebNatureRuntime.java @@ -7,7 +7,6 @@ package org.eclipse.jst.j2ee.internal.web.operations; */ import java.io.ByteArrayInputStream; import java.io.InputStream; -import java.util.Map; import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IContainer; @@ -42,7 +41,6 @@ import org.eclipse.jst.j2ee.internal.project.IWebNatureConstants; import org.eclipse.jst.j2ee.internal.project.J2EEModuleNature; import org.eclipse.jst.j2ee.internal.web.archive.operations.WTProjectLoadStrategyImpl; import org.eclipse.jst.j2ee.internal.web.plugin.WebPlugin; -import org.eclipse.jst.j2ee.internal.webservices.WebServiceEditModel; import org.eclipse.jst.j2ee.web.taglib.ITaglibRegistry; import org.eclipse.jst.j2ee.webapplication.WebApp; import org.eclipse.jst.j2ee.webapplication.WebAppResource; @@ -1025,16 +1023,18 @@ public class J2EEWebNatureRuntime extends J2EEModuleNature implements IDynamicWe * increments the use count of this model. When you are done accessing the model, call * releaseAccess()! */ - public WebServiceEditModel getWebServiceEditModelForRead(Object accessorKey, Map params) { - return (WebServiceEditModel) getEditModelForRead(WEB_SERVICE_EDIT_MODEL_ID, accessorKey, params); - } + // TODO WebServices for M3 +// public WebServiceEditModel getWebServiceEditModelForRead(Object accessorKey, Map params) { +// return (WebServiceEditModel) getEditModelForRead(WEB_SERVICE_EDIT_MODEL_ID, accessorKey, params); +// } /** * Return an editing model used to edit web service resources. Important!!! Calling this method * increments the use count of this model. When you are done accessing the model, call * releaseAccess()! */ - public WebServiceEditModel getWebServiceEditModelForWrite(Object accessorKey, Map params) { - return (WebServiceEditModel) getEditModelForWrite(WEB_SERVICE_EDIT_MODEL_ID, accessorKey, params); - } + // TODO WebServices for M3 +// public WebServiceEditModel getWebServiceEditModelForWrite(Object accessorKey, Map params) { +// return (WebServiceEditModel) getEditModelForWrite(WEB_SERVICE_EDIT_MODEL_ID, accessorKey, params); +// } }
\ No newline at end of file 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 710ec2e30..bde1342e8 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 @@ -40,7 +40,8 @@ import com.ibm.wtp.common.logger.proxy.Logger; import com.ibm.wtp.emf.workbench.ProjectUtilities; public class WebPropertiesUtil { - private static final char[] BAD_CHARS = {'/', '\\', ':'}; + //private static final char[] BAD_CHARS = {'/', '\\', ':'}; + private static final char[] BAD_CHARS = {':'}; /** * Update the Web Content folder to a new value if it is different. This applies to both Static @@ -70,11 +71,12 @@ public class WebPropertiesUtil { webContentName = J2EEWebNatureRuntimeUtilities.getDefaultJ2EEWebContentName(); } } - String webNatureOrigName = webNature.getRootPublishableFolder().getName(); - if (webNatureOrigName.equals(webContentName)) + + IPath newPath = new Path(webContentName); + if (webNature.getRootPublishableFolder().equals(newPath)) return false; - if (project.exists(new Path(webContentName))) { + if (project.exists(newPath)) { IStatus status = new Status(IStatus.ERROR, "org.eclipse.jst.j2ee", IStatus.OK, ProjectSupportResourceHandler.getString("Could_not_rename_____2", new Object[]{webContentName}), null); //$NON-NLS-1$ //$NON-NLS-2$ throw new CoreException(status); } @@ -96,8 +98,9 @@ public class WebPropertiesUtil { public static void updateWebContentNamePropertiesOnly(IProject project, String webContentName, IProgressMonitor progressMonitor) throws CoreException { IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(project); - String webNatureOrigName = webNature.getRootPublishableFolder().getName(); - if (webNatureOrigName.equals(webContentName)) + IPath newPath = new Path(webContentName); + // String webNatureOrigName = webNature.getRootPublishableFolder().getName(); + if (webNature.getRootPublishableFolder().equals(newPath)) return; if (!webNature.getModuleServerRootName().equals(webContentName)) { @@ -110,32 +113,29 @@ public class WebPropertiesUtil { IClasspathEntry[] newClasspath = new IClasspathEntry[classpath.length]; for (int i = 0; i < classpath.length; i++) { - if (classpath[i].getEntryKind() == IClasspathEntry.CPE_LIBRARY) { - IClasspathEntry library = classpath[i]; IPath libpath = library.getPath(); - if (webNature.getModuleServerRoot().getFullPath().isPrefixOf(libpath)) { - IPath prunedPath = libpath.removeFirstSegments(2); + IPath modServerRootPath = webNature.getModuleServerRoot().getFullPath(); + if (modServerRootPath.isPrefixOf(libpath)) { + IPath prunedPath = libpath.removeFirstSegments(modServerRootPath.segmentCount()); IPath relWebContentPath = new Path(webContentName + "/" + prunedPath.toString()); //$NON-NLS-1$ IResource absWebContentPath = project.getFile(relWebContentPath); IPath srcAttachmentPath = library.getSourceAttachmentPath(); - prunedPath = srcAttachmentPath.removeFirstSegments(2); + if(null != srcAttachmentPath){ + prunedPath = srcAttachmentPath.removeFirstSegments(modServerRootPath.segmentCount()); + } IResource absWebContentSrcAttachmentPath = project.getFile(relWebContentPath); newClasspath[i] = JavaCore.newLibraryEntry(absWebContentPath.getFullPath(), absWebContentSrcAttachmentPath.getFullPath(), library.getSourceAttachmentRootPath(), library.isExported()); } else { - newClasspath[i] = classpath[i]; - } } else { - newClasspath[i] = classpath[i]; - } } @@ -165,8 +165,26 @@ public class WebPropertiesUtil { IBaseWebNature webNature = J2EEWebNatureRuntimeUtilities.getRuntime(project); IPath newPath = new Path(webContentName); if (!project.exists(newPath)) { + if (newPath.segmentCount() > 1) { + for (int i = newPath.segmentCount() - 1; i > 0; i--) { + IPath tempPath = newPath.removeLastSegments(i); + IFolder tempFolder = project.getFolder(tempPath); + if (!tempFolder.exists()) { + tempFolder.create(true, true, null); + } + } + } + newPath = project.getFullPath().append(newPath); IContainer webContentRoot = webNature.getModuleServerRoot(); + IPath oldPath = webContentRoot.getProjectRelativePath(); webContentRoot.move(newPath, IResource.FORCE | IResource.KEEP_HISTORY, new SubProgressMonitor(progressMonitor, 1)); + for (int i = 0; i < oldPath.segmentCount(); i++) { + IPath tempPath = oldPath.removeLastSegments(i); + IFolder tempFolder = project.getFolder(tempPath); + if (tempFolder.exists() && tempFolder.members().length == 0) { + tempFolder.delete(true, true, null); + } + } } } @@ -331,8 +349,7 @@ public class WebPropertiesUtil { /******************************************************************************************* * // JZ - fix to defect 204264, "/" is valid in context root if (name.indexOf("//") != -1) { * //$NON-NLS-1$ errorMessage = "// are invalid characters in a resource name"; return - * errorMessage; - * } + * errorMessage; } ******************************************************************************************/ if (name.trim().equals(name)) { diff --git a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettingsMigrator.java b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettingsMigrator.java index 0126b32af..42a3ee6d7 100644 --- a/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettingsMigrator.java +++ b/plugins/org.eclipse.jst.j2ee.web/webproject/org/eclipse/jst/j2ee/internal/web/operations/WebSettingsMigrator.java @@ -43,7 +43,7 @@ import com.ibm.wtp.emf.workbench.ProjectUtilities; */ public class WebSettingsMigrator implements IMigrator { protected J2EESettings j2eeSettings; - protected String WEBSETINGS_KEY = "websettings"; //$NON-NLS-1$ + protected String WEBSETINGS_KEY = "j2eesettings"; //$NON-NLS-1$ /** * |