Various Patches
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategyImpl.java index 407fe66..ab9bed5 100644 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategyImpl.java +++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/ApplicationClientProjectLoadStrategyImpl.java
@@ -15,6 +15,7 @@ import java.util.ArrayList; import java.util.List; +import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.jst.j2ee.applicationclient.creation.ApplicationClientNatureRuntime; @@ -43,10 +44,10 @@ /** * getModuleFolderName method comment. */ - public java.lang.String getModuleFolderName() { + public IContainer getModuleContainer() { try { ApplicationClientNatureRuntime enr = ApplicationClientNatureRuntime.getRuntime(project); - return enr.getModuleServerRoot().getName(); + return enr.getModuleServerRoot(); } catch (Exception e) { throw new ArchiveRuntimeException(e.getMessage(), e); }
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategyImpl.java index 0cff3fe..29764a4 100644 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategyImpl.java +++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/J2EELoadStrategyImpl.java
@@ -23,6 +23,7 @@ import org.eclipse.core.internal.resources.ProjectDescription; import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; @@ -53,8 +54,8 @@ protected WorkbenchURIConverter projectMetaURIConverter; protected WorkbenchURIConverter projectURIConverter; protected Set visitedURIs; - protected boolean exportSource = false; - protected boolean includeProjectMetaFiles = false; + private boolean exportSource = false; + private boolean includeProjectMetaFiles = false; protected List sourceFolders; /** @@ -190,55 +191,76 @@ return PROJECT_FILE_URI.equals(uri) || CLASSPATH_FILE_URI.equals(uri); } - public abstract String getModuleFolderName(); + public abstract IContainer getModuleContainer(); protected IPath getOutputPathForFile(IPath aPath) throws Exception { - if (isProjectMetaFile(aPath.toString())) { if (includeProjectMetaFiles) return aPath; return null; } - int charIndex = 0; - ArrayList tokens = new ArrayList(); - String pathString = aPath.toString(); - - for (int i = 0; i < pathString.length(); i++) { - if (pathString.charAt(i) == '/') { - tokens.add(pathString.substring(charIndex, i)); - charIndex = ++i; + IContainer moduleContainer = getModuleContainer(); + IPath moduleContainerPath = moduleContainer.getProjectRelativePath(); + //check if the file is an output folder file + if (aPath.segmentCount() > moduleContainerPath.segmentCount() && aPath.removeLastSegments(aPath.segmentCount() - moduleContainerPath.segmentCount()).equals(moduleContainerPath)) { + IPath tempPath = aPath.removeFirstSegments(moduleContainerPath.segmentCount()); + if (moduleContainer.exists(tempPath)) { + return tempPath; } } - - int indexOfModule = -1; - IContainer outputFolder = ProjectUtilities.getJavaProjectOutputContainer(getProject()); - // check if file is an output folder file - if (tokens.contains(getModuleFolderName())) { - indexOfModule = tokens.indexOf(getModuleFolderName()); - // make sure the path exists, if not, we should check source folders - if (!outputFolder.exists(aPath.removeFirstSegments(indexOfModule + 1))) - indexOfModule = -1; - } - // check if file is a source folder file - if (indexOfModule == -1) { - List localSourceFolders = getSourceFoldersNames(); - if (localSourceFolders != null) { - for (int j = 0; j < localSourceFolders.size(); j++) { - if (!tokens.isEmpty()) { - if (((String) tokens.get(0)).equals(localSourceFolders.get(j))) { - indexOfModule = tokens.indexOf(localSourceFolders.get(j)); - break; - } - continue; - } - } + //if this file is in a source folder, find the source folder + //and remove the source folder portion from the path + List lSourceFolders = getSourceFolders(); + for (int i = 0; i < lSourceFolders.size(); i++) { + IPath folderPath = ((IFolder) lSourceFolders.get(i)).getProjectRelativePath(); + if (aPath.segmentCount() > folderPath.segmentCount() && aPath.removeLastSegments(aPath.segmentCount() - folderPath.segmentCount()).equals(folderPath)) { + return aPath.removeFirstSegments(folderPath.segmentCount()); } } - if (indexOfModule > -1) - return aPath.removeFirstSegments(indexOfModule + 1); return null; } + // int charIndex = 0; + + // ArrayList tokens = new ArrayList(); + // String pathString = aPath.toString(); + // + // for (int i = 0; i < pathString.length(); i++) { + // if (pathString.charAt(i) == '/') { + // tokens.add(pathString.substring(charIndex, i)); + // charIndex = ++i; + // } + // } + + // int indexOfModule = -1; + // IContainer outputFolder = ProjectUtilities.getJavaProjectOutputContainer(getProject()); + // check if file is an output folder file + + // if (tokens.contains(getModuleFolderName())) { + // indexOfModule = tokens.indexOf(getModuleFolderName()); + // // make sure the path exists, if not, we should check source folders + // if (!outputFolder.exists(aPath.removeFirstSegments(indexOfModule + 1))) + // indexOfModule = -1; + // } + // check if file is a source folder file + // if (indexOfModule == -1) { + // List localSourceFolders = getSourceFoldersNames(); + // if (localSourceFolders != null) { + // for (int j = 0; j < localSourceFolders.size(); j++) { + // if (!tokens.isEmpty()) { + // if (((String) tokens.get(0)).equals(localSourceFolders.get(j))) { + // indexOfModule = tokens.indexOf(localSourceFolders.get(j)); + // break; + // } + // continue; + // } + // } + // } + // } + // if (indexOfModule > -1) + // return aPath.removeFirstSegments(indexOfModule + 1); + // return null; + // } /** * Insert the method's description here. Creation date: (7/19/2001 3:58:31 PM) *
diff --git a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectLoadStrategyImpl.java b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectLoadStrategyImpl.java index a47b7e8..9474f65 100644 --- a/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectLoadStrategyImpl.java +++ b/plugins/org.eclipse.jst.j2ee/archiveops/org/eclipse/jst/j2ee/internal/archive/operations/JavaProjectLoadStrategyImpl.java
@@ -35,7 +35,6 @@ // IProject project; protected IJavaProject javaProject; protected List sourceContainers = null; - protected String moduleFolderName; public static final String JAVA_EXTENSION = "java"; //$NON-NLS-1$ public static final String CLASS_EXTENSION = "class"; //$NON-NLS-1$ @@ -53,10 +52,8 @@ } - public String getModuleFolderName() { - if (moduleFolderName == null) - moduleFolderName = ProjectUtilities.getJavaProjectOutputContainer(getProject()).getProjectRelativePath().segment(0); - return moduleFolderName; + public IContainer getModuleContainer() { + return ProjectUtilities.getJavaProjectOutputContainer(getProject()); } /* @@ -90,7 +87,7 @@ protected IPath getOutputPathForFile(IPath aPath) throws Exception { if (isProjectMetaFile(aPath.toString())) { - if (includeProjectMetaFiles) + if (shouldIncludeProjectMetaFiles()) return aPath; return null; } @@ -105,7 +102,7 @@ IPath result = aPath.removeFirstSegments(containerPath.segmentCount()); //The next three lines cover the case where you have the project as source //and a folder as the output - if (isProjectMetaFile(result.toString()) && !includeProjectMetaFiles) + if (isProjectMetaFile(result.toString()) && !shouldIncludeProjectMetaFiles()) return null; return result; } @@ -128,7 +125,7 @@ String ext = path.getFileExtension(); if (isJava(ext)) - return exportSource; + return isExportSource(); return true; }
diff --git a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/JARDependencyOperation.java b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/JARDependencyOperation.java index f8c445e..daf4b1d 100644 --- a/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/JARDependencyOperation.java +++ b/plugins/org.eclipse.jst.j2ee/common/org/eclipse/jst/j2ee/internal/common/operations/JARDependencyOperation.java
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jst.j2ee.application.operations.ClassPathSelection; import org.eclipse.jst.j2ee.application.operations.UpdateManifestDataModel; import org.eclipse.jst.j2ee.application.operations.UpdateManifestOperation; import org.eclipse.jst.j2ee.internal.common.ClasspathModel; @@ -106,7 +107,9 @@ } break; case JARDependencyDataModel.JAR_MANIPULATION_INVERT : - model.getClassPathSelection().invertClientJARSelection(dataModel.getReferencedProject(), dataModel.getOppositeProject()); + ClassPathSelection classPathSelection = model.getClassPathSelection(); + if (classPathSelection != null) + classPathSelection.invertClientJARSelection(dataModel.getReferencedProject(), dataModel.getOppositeProject()); break; } if (model.isDirty())
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/operations/EnterpriseApplicationImportDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/operations/EnterpriseApplicationImportDataModel.java index 3418cd6..fabc383 100644 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/operations/EnterpriseApplicationImportDataModel.java +++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/operations/EnterpriseApplicationImportDataModel.java
@@ -149,7 +149,7 @@ public static void importArchive(String earFileName, String earProjectName) { EnterpriseApplicationImportDataModel dataModel = new EnterpriseApplicationImportDataModel(); dataModel.setProperty(FILE_NAME, earFileName); - dataModel.setProperty(PROJECT_NAME, earFileName); + dataModel.setProperty(PROJECT_NAME, earProjectName); try { dataModel.getDefaultOperation().run(null); } catch (InvocationTargetException e) {
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/operations/J2EEArtifactImportDataModel.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/operations/J2EEArtifactImportDataModel.java index 04e8ad0..15e911b 100644 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/operations/J2EEArtifactImportDataModel.java +++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/application/operations/J2EEArtifactImportDataModel.java
@@ -251,8 +251,11 @@ if (null != archiveFile && getBooleanProperty(DEFAULT_PROJECT_NAME)) { Path path = new Path(archiveFile.getURI()); String defaultProjectName = path.segment(path.segmentCount() - 1); - if (defaultProjectName.indexOf(".") > 0) { //$NON-NLS-1$ - defaultProjectName = defaultProjectName.substring(0, defaultProjectName.indexOf(".")); //$NON-NLS-1$ + if (defaultProjectName.indexOf('.') > 0) { + defaultProjectName = defaultProjectName.substring(0, defaultProjectName.lastIndexOf('.')); + if (defaultProjectName.indexOf('.') > 0) { + defaultProjectName = defaultProjectName.replace('.', '_'); + } } if (!getBooleanProperty(OVERWRITE_PROJECT)) { String baseName = defaultProjectName;
diff --git a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARNatureRuntime.java b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARNatureRuntime.java index 3c8f18f..1cd9f36 100644 --- a/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARNatureRuntime.java +++ b/plugins/org.eclipse.jst.j2ee/earproject/org/eclipse/jst/j2ee/internal/earcreation/EARNatureRuntime.java
@@ -418,7 +418,7 @@ EAREditModel model = (EAREditModel) getCacheEditModel(); ModuleMapping map = model.getModuleMapping(aModule); - if (map != null) { + if (map != null && map.getProjectName() != null && map.getProjectName().length() > 0 ) { return J2EEPlugin.getWorkspace().getRoot().getProject(map.getProjectName()); }
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployable.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployable.java index 4d37aea..1355e1b 100644 --- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployable.java +++ b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/deployables/J2EEDeployable.java
@@ -84,4 +84,11 @@ return nature != null && ((J2EEModuleNature) nature).isBinaryProject(); return false; } + + public Object getAdapter(Class adapter) { + if (getModule() == null) + initialize(this); + return this; + } + } \ No newline at end of file
diff --git a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java index 936e592..48361f9 100644 --- a/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java +++ b/plugins/org.eclipse.jst.j2ee/j2eeplugin/org/eclipse/jst/j2ee/internal/plugin/J2EEPlugin.java
@@ -72,7 +72,7 @@ public static final String UI_PLUGIN_ID = "org.eclipse.jst.j2ee.ui"; //$NON-NLS-1$ protected final IPath iconsFolder = new Path(getDescriptor().getInstallURL().getFile()).append("icons"); //$NON-NLS-1$ // LibDir Change Listener - public static final String LIBDIRCHANGE_BUILDER_ID = UI_PLUGIN_ID + ".LibDirBuilder"; //$NON-NLS-1$ + public static final String LIBDIRCHANGE_BUILDER_ID = "org.eclipse.jst.j2ee.web.LibDirBuilder"; //$NON-NLS-1$ // LibCopy builder ID public static final String LIBCOPY_BUILDER_ID = PLUGIN_ID + ".LibCopyBuilder"; //$NON-NLS-1$ // Validation part of the plugin
diff --git a/plugins/org.eclipse.jst.j2ee/plugin.xml b/plugins/org.eclipse.jst.j2ee/plugin.xml index 31e796a..efd5d60 100644 --- a/plugins/org.eclipse.jst.j2ee/plugin.xml +++ b/plugins/org.eclipse.jst.j2ee/plugin.xml
@@ -465,21 +465,21 @@ <extension point="org.eclipse.wst.server.core.moduleArtifactAdapters"> - <moduleObjectAdapter + <moduleArtifactAdapter objectClass="org.eclipse.jst.j2ee.application.Application" class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseApplicationDeployableObjectAdapter" id="com.ibm.wtp.server.j2ee.ear1"> - </moduleObjectAdapter> - <moduleObjectAdapter + </moduleArtifactAdapter> + <moduleArtifactAdapter objectClass="org.eclipse.core.resources.IProject" class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseApplicationDeployableObjectAdapter" id="com.ibm.wtp.server.j2ee.ear2"> - </moduleObjectAdapter> - <moduleObjectAdapter + </moduleArtifactAdapter> + <moduleArtifactAdapter objectClass="org.eclipse.core.resources.IFile" class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseApplicationDeployableObjectAdapter" id="com.ibm.wtp.server.j2ee.ear3"> - </moduleObjectAdapter> + </moduleArtifactAdapter> </extension> <!-- =============================================================== --> <!-- Purpose: Define the default deployable project factory --> @@ -488,9 +488,9 @@ <extension point="org.eclipse.wst.server.core.moduleFactories"> <moduleFactory - label="%appClient12DeployableLabel" + projects="true" - icon="icons/full/obj16/appclient_12_deploy.gif" + class="org.eclipse.jst.j2ee.internal.deployables.ApplicationClientDeployableFactory" id="com.ibm.wtp.server.j2ee.appclient"> <moduleType @@ -499,9 +499,9 @@ </moduleType> </moduleFactory> <moduleFactory - label="%ear12DeployableLabel" + projects="true" - icon="icons/full/obj16/12_ear_deploy.gif" + class="org.eclipse.jst.j2ee.internal.deployables.EnterpriseApplicationDeployableFactory" id="com.ibm.wtp.server.j2ee.application"> <moduleType @@ -511,8 +511,7 @@ </moduleFactory> <moduleFactory projects="true" - icon="icons/full/obj16/jarproject_deploy.gif" - index="20" + class="org.eclipse.jst.j2ee.internal.deployables.LooseArchiveDeployableFactory" id="com.ibm.wtp.server.looseArchive"> <moduleType