rpms/eclipse/devel eclipse-importArchivedProj.patch, NONE, 1.1 eclipse.spec, 1.111, 1.112
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Apr 22 15:29:43 UTC 2005
Update of /cvs/dist/rpms/eclipse/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv14898
Modified Files:
eclipse.spec
Added Files:
eclipse-importArchivedProj.patch
Log Message:
- Import archived projects (e.o#82988)
eclipse-importArchivedProj.patch:
internal/wizards/datatransfer/ArchiveFileManipulations.java | 164 ++
internal/wizards/datatransfer/DataTransferMessages.java | 5
internal/wizards/datatransfer/ILeveledImportStructureProvider.java | 90 +
internal/wizards/datatransfer/TarFileStructureProvider.java | 199 --
internal/wizards/datatransfer/TarLeveledStructureProvider.java | 234 +++
internal/wizards/datatransfer/WizardArchiveFileResourceImportPage1.java | 98 -
internal/wizards/datatransfer/WizardProjectsImportPage.java | 706 +++++++---
internal/wizards/datatransfer/ZipLeveledStructureProvider.java | 215 +++
internal/wizards/datatransfer/messages.properties | 4
wizards/datatransfer/ImportOperation.java | 7
10 files changed, 1293 insertions(+), 429 deletions(-)
--- NEW FILE eclipse-importArchivedProj.patch ---
Index: src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java,v
retrieving revision 1.4
diff -u -r1.4 DataTransferMessages.java
--- src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java 11 Apr 2005 21:11:56 -0000 1.4
+++ src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java 12 Apr 2005 16:57:36 -0000
@@ -6,6 +6,8 @@
*
* Contributors:
* IBM - Initial API and implementation
+ * Red Hat, Inc - WizardProjectsImportPage[_ArchiveSelectTitle,
+ * _SelectArchiveDialogTitle]
**********************************************************************/
package org.eclipse.ui.internal.wizards.datatransfer;
@@ -86,7 +88,8 @@
public static String WizardExternalProjectImportPage_directoryLabel;
public static String WizardProjectsImportPage_ImportProjectsDescription;
public static String WizardProjectsImportPage_CheckingMessage;
-
+ public static String WizardProjectsImportPage_ArchiveSelectTitle;
+ public static String WizardProjectsImportPage_SelectArchiveDialogTitle;
// --- Export Wizards ---
public static String DataTransfer_export;
Index: src/org/eclipse/ui/internal/wizards/datatransfer/TarFileStructureProvider.java
===================================================================
RCS file: src/org/eclipse/ui/internal/wizards/datatransfer/TarFileStructureProvider.java
diff -N src/org/eclipse/ui/internal/wizards/datatransfer/TarFileStructureProvider.java
--- src/org/eclipse/ui/internal/wizards/datatransfer/TarFileStructureProvider.java 25 Feb 2005 20:41:16 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.wizards.datatransfer;
-
-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 org.eclipse.core.resources.ResourceAttributes;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
-
-/**
- * This class provides information regarding the context structure and
- * content of specified tar file entry objects.
- */
-public class TarFileStructureProvider implements IImportStructureProvider {
- private TarFile tarFile;
-
- private TarEntry root = new TarEntry("/");//$NON-NLS-1$
-
- private Map children;
-
- private Map directoryEntryCache = new HashMap();
-
- /**
- * Creates a <code>TarFileStructureProvider</code>, which will operate
- * on the passed tar file.
- *
- * @param sourceFile the source TarFile
- */
- public TarFileStructureProvider(TarFile sourceFile) {
- super();
- tarFile = sourceFile;
- root.setFileType(TarEntry.DIRECTORY);
- }
-
- /**
- * Adds the specified child to the internal collection of the parent's children.
- */
- protected void addToChildren(TarEntry parent, TarEntry child) {
- List childList = (List) children.get(parent);
- if (childList == null) {
- childList = new ArrayList();
- children.put(parent, childList);
- }
-
- childList.add(child);
- }
-
- /**
- * Creates a new container tar entry with the specified name, iff
- * it has not already been created.
- */
- protected void createContainer(IPath pathname) {
- if (directoryEntryCache.containsKey(pathname))
- return;
-
- TarEntry parent;
- if (pathname.segmentCount() == 1)
- parent = root;
- else
- parent = (TarEntry) directoryEntryCache.get(pathname
- .removeLastSegments(1));
-
- TarEntry newEntry = new TarEntry(pathname.toString());
- newEntry.setFileType(TarEntry.DIRECTORY);
- directoryEntryCache.put(pathname, newEntry);
- addToChildren(parent, newEntry);
- }
-
- /**
- * Creates a new tar file entry with the specified name.
- */
- protected void createFile(TarEntry entry) {
- IPath pathname = new Path(entry.getName());
- TarEntry parent;
- if (pathname.segmentCount() == 1)
- parent = root;
- else
- parent = (TarEntry) directoryEntryCache.get(pathname
- .removeLastSegments(1));
-
- addToChildren(parent, entry);
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public List getChildren(Object element) {
- if (children == null)
- initialize();
-
- return ((List) children.get(element));
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public InputStream getContents(Object element) {
- try {
- return tarFile.getInputStream((TarEntry) element);
- } catch (TarException e) {
- return null;
- } catch (IOException e) {
- return null;
- }
- }
-
- /**
- * Returns the resource attributes for this file.
- *
- * @param element
- * @return the attributes of the file
- */
- public ResourceAttributes getResourceAttributes(Object element) {
- ResourceAttributes attributes = new ResourceAttributes();
- TarEntry entry = (TarEntry) element;
- attributes.setExecutable((entry.getMode() & 0100) != 0);
- attributes.setReadOnly((entry.getMode() & 0200) == 0);
- return attributes;
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public String getFullPath(Object element) {
- return ((TarEntry) element).getName();
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public String getLabel(Object element) {
- if (element.equals(root))
- return ((TarEntry) element).getName();
-
- return new Path(((TarEntry) element).getName()).lastSegment();
- }
-
- /**
- * Returns the entry that this importer uses as the root sentinel.
- *
- * @return TarEntry entry
- */
- public TarEntry getRoot() {
- return root;
- }
-
- /**
- * Returns the tar file that this provider provides structure for.
- *
- * @return TarFile file
[...1924 lines suppressed...]
+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.
+ */
+public class ZipLeveledStructureProvider implements ILeveledImportStructureProvider {
+ private ZipFile zipFile;
+
+ private ZipEntry root = new ZipEntry("/");//$NON-NLS-1$
+
+ 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 around
+ */
+ public ZipLeveledStructureProvider(ZipFile sourceFile) {
+ super();
+ zipFile = sourceFile;
+ stripLevel = 0;
+ }
+
+ /**
+ * Adds the specified child to the internal collection of the parent's children.
+ */
+ protected void addToChildren(ZipEntry parent, ZipEntry child) {
+ List childList = (List) children.get(parent);
+ if (childList == null) {
+ childList = new ArrayList();
+ children.put(parent, childList);
+ }
+
+ childList.add(child);
+ }
+
+ /**
+ * Creates a new container zip entry with the specified name, iff
+ * it has not already been created.
+ */
+ protected void createContainer(IPath pathname) {
+ if (directoryEntryCache.containsKey(pathname))
+ return;
+
+ ZipEntry parent;
+ if (pathname.segmentCount() == 1)
+ parent = root;
+ else
+ parent = (ZipEntry) directoryEntryCache.get(pathname
+ .removeLastSegments(1));
+
+ ZipEntry newEntry = new ZipEntry(pathname.toString());
+ directoryEntryCache.put(pathname, newEntry);
+ addToChildren(parent, newEntry);
+ }
+
+ /**
+ * Creates a new file zip entry with the specified name.
+ */
+ protected void createFile(ZipEntry entry) {
+ IPath pathname = new Path(entry.getName());
+ ZipEntry parent;
+ if (pathname.segmentCount() == 1)
+ parent = root;
+ else
+ parent = (ZipEntry) directoryEntryCache.get(pathname
+ .removeLastSegments(1));
+
+ addToChildren(parent, entry);
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IImportStructureProvider
+ */
+ public List getChildren(Object element) {
+ if (children == null)
+ initialize();
+
+ return ((List) children.get(element));
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IImportStructureProvider
+ */
+ public InputStream getContents(Object element) {
+ try {
+ return zipFile.getInputStream((ZipEntry) element);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ /*
+ * Strip the leading directories from the path
+ */
+ private String stripPath(String path) {
+ String pathOrig = new String(path);
+ for (int i = 0; i < stripLevel; i++)
+ {
+ int firstSep = path.indexOf(File.separatorChar);
+ // If the first character was a seperator we must strip to the next seperator as well
+ if (firstSep == 0)
+ {
+ path = path.substring(1);
+ firstSep = path.indexOf(File.separatorChar);
+ }
+ // No seperator wasw present so we're in a higher directory right now
+ if (firstSep == -1)
+ return pathOrig;
+ path = path.substring(firstSep);
+ }
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IImportStructureProvider
+ */
+ public String getFullPath(Object element) {
+ return stripPath(((ZipEntry) element).getName());
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IImportStructureProvider
+ */
+ public String getLabel(Object element) {
+ if (element.equals(root))
+ return ((ZipEntry) element).getName();
+
+ return stripPath(new Path(((ZipEntry) element).getName()).lastSegment());
+ }
+
+ /**
+ * Returns the entry that this importer uses as the root sentinel.
+ *
+ * @return java.util.zip.ZipEntry
+ */
+ public Object getRoot() {
+ return root;
+ }
+
+ /**
+ * Returns the zip file that this provider provides structure for.
+ * @return The zip file
+ */
+ public ZipFile getZipFile() {
+ return zipFile;
+ }
+
+ /**
+ * Initializes this object's children table based on the contents of
+ * the specified source file.
+ */
+ protected void initialize() {
+ children = new HashMap(1000);
+
+ Enumeration entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = (ZipEntry) entries.nextElement();
+ if (!entry.isDirectory()) {
+ IPath path = new Path(entry.getName()).addTrailingSeparator();
+ int pathSegmentCount = path.segmentCount();
+
+ for (int i = 1; i < pathSegmentCount; i++)
+ createContainer(path.uptoSegment(i));
+ createFile(entry);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IImportStructureProvider
+ */
+ public boolean isFolder(Object element) {
+ return ((ZipEntry) element).isDirectory();
+ }
+
+ public void setStrip(int level) {
+ stripLevel = level;
+ }
+
+ public int getStrip() {
+ return stripLevel;
+ }
+}
Index: eclipse.spec
===================================================================
RCS file: /cvs/dist/rpms/eclipse/devel/eclipse.spec,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- eclipse.spec 22 Apr 2005 13:04:18 -0000 1.111
+++ eclipse.spec 22 Apr 2005 15:29:41 -0000 1.112
@@ -85,6 +85,8 @@
Patch21: %{name}-gnuformatterjdtui.patch
# https://bugs.eclipse.org/bugs/show_bug.cgi?id=90630
Patch22: %{name}-updatehomedir.patch
+#https://bugs.eclipse.org/bugs/show_bug.cgi?id=82988
+Patch23: %{name}-importArchivedProj.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: ant
@@ -274,6 +276,9 @@
pushd plugins/org.eclipse.update.ui
%patch22 -p0
popd
+pushd plugins/org.eclipse.ui.ide
+%patch23 -p0
+popd
%if %{gcj_support}
# Fedora splash screen.
@@ -1030,6 +1035,9 @@
%{_datadir}/%{name}/plugins/org.eclipse.platform.source.linux.gtk.*_3.1.0
%changelog
+* Fri Apr 22 2005 Aaron Luchko <aluchko at redhat.com> 3.1.0_fc-0.M6.10
+- Import archived projects (e.o#82988)
+
* Fri Apr 22 2005 Andrew Overholt <overholt at redhat.com> 3.1.0_fc-0.M6.10
- Add Requires(post,postun): java-1.4.2-gcj-compat for each sub-package and use
full path (Joe Orton).
More information about the fedora-cvs-commits
mailing list