Bug 95613 [Import/Export] importing existing projects from zip does not work
in 0513 I am trying to get some existing projects into my workspace. I want them actually imported (i.e., copied) into the workspace location. It appears that the only theoretical way of doing this is zip it up and then import from the zip. Ok, so I zipped them up in a structure that looks like foo.zip bar/ .project ... project stuff ... fred/ .project ... project stuff ... ... When I import existing projects from that zip I get a workspace project sturcture like workspace/ bar/ .project bar/ .project ... project stuff ... fred/ .project fred/ .project ... project stuff ... ... The directory sturcture from the ziup is not being trimmed.
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/ZipLeveledStructureProvider.java
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
/**
 * This class provides information regarding the context structure and content
 * of specified zip file entry objects.
 * 
 * @since 3.1
 */
public class ZipLeveledStructureProvider implements
		ILeveledImportStructureProvider {
	private ZipFile zipFile;
	private ZipEntry root = new ZipEntry("/");
	private Map children;
	private Map directoryEntryCache = new HashMap();
	private int stripLevel;
	/**
	 * Creates a <code>ZipFileStructureProvider</code>, which will operate on
	 * the passed zip file.
	 * 
	 * @param sourceFile
	 *            The source file to create the ZipLeveledStructureProvider