Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 26870 Details for
Bug 96704
[Import/Export] Import doesn't import empty directories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
fixed patch
bug96704.patch (text/plain), 6.97 KB, created by
Aaron Luchko
on 2005-09-06 17:12:15 EDT
(
hide
)
Description:
fixed patch
Filename:
MIME Type:
Creator:
Aaron Luchko
Created:
2005-09-06 17:12:15 EDT
Size:
6.97 KB
patch
obsolete
>Index: src/org/eclipse/ui/internal/wizards/datatransfer/TarLeveledStructureProvider.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/TarLeveledStructureProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 TarLeveledStructureProvider.java >--- src/org/eclipse/ui/internal/wizards/datatransfer/TarLeveledStructureProvider.java 15 Jun 2005 18:41:25 -0000 1.3 >+++ src/org/eclipse/ui/internal/wizards/datatransfer/TarLeveledStructureProvider.java 6 Sep 2005 20:29:05 -0000 >@@ -56,38 +56,31 @@ > } > > /** >- * 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; >+ * Creates a new container tar entry with the specified name, iff it has >+ * not already been created. If the parent of the given element does not >+ * already exist it will be recursively created as well. >+ * @param pathname The path representing the container >+ * @return The element represented by this pathname (it may have already existed) >+ */ >+ protected TarEntry createContainer(IPath pathname) { >+ TarEntry existingEntry = (TarEntry) directoryEntryCache.get(pathname); >+ if (existingEntry != null) >+ return existingEntry; > > TarEntry parent; > if (pathname.segmentCount() == 1) > parent = root; > else >- parent = (TarEntry) directoryEntryCache.get(pathname >- .removeLastSegments(1)); >- >+ parent = createContainer(pathname.removeLastSegments(1)); > TarEntry newEntry = new TarEntry(pathname.toString()); > newEntry.setFileType(TarEntry.DIRECTORY); > directoryEntryCache.put(pathname, newEntry); >- addToChildren(parent, newEntry); >+ List childList = new ArrayList(); >+ children.put(newEntry, childList); >+ >+ List parentChildList = (List) children.get(parent); >+ parentChildList.add(newEntry); >+ return newEntry; > } > > /** >@@ -102,7 +95,8 @@ > parent = (TarEntry) directoryEntryCache.get(pathname > .removeLastSegments(1)); > >- addToChildren(parent, entry); >+ List childList = (List) children.get(parent); >+ childList.add(entry); > } > > /* >@@ -183,21 +177,26 @@ > */ > protected void initialize() { > children = new HashMap(1000); >- >+ >+ children.put(root, new ArrayList()); > Enumeration entries = tarFile.entries(); > while (entries.hasMoreElements()) { > TarEntry entry = (TarEntry) entries.nextElement(); >- if (entry.getFileType() == TarEntry.FILE) { >- IPath path = new Path(entry.getName()).addTrailingSeparator(); >+ IPath path = new Path(entry.getName()).addTrailingSeparator(); >+ >+ if (entry.getFileType() == TarEntry.DIRECTORY) >+ createContainer(path); >+ else >+ { >+ // Ensure the container structure for all levels above this is initialized >+ // Once we hit a higher-level container that's already added we need go no further > int pathSegmentCount = path.segmentCount(); >- >- for (int i = 1; i < pathSegmentCount; i++) >- createContainer(path.uptoSegment(i)); >+ createContainer(path.uptoSegment(pathSegmentCount - 1)); > createFile(entry); > } > } > } >- >+ > /* > * (non-Javadoc) Method declared on IImportStructureProvider > */ >Index: src/org/eclipse/ui/internal/wizards/datatransfer/ZipLeveledStructureProvider.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/ZipLeveledStructureProvider.java,v >retrieving revision 1.2 >diff -u -r1.2 ZipLeveledStructureProvider.java >--- src/org/eclipse/ui/internal/wizards/datatransfer/ZipLeveledStructureProvider.java 9 Jun 2005 00:37:16 -0000 1.2 >+++ src/org/eclipse/ui/internal/wizards/datatransfer/ZipLeveledStructureProvider.java 6 Sep 2005 20:29:08 -0000 >@@ -58,37 +58,30 @@ > } > > /** >- * 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; >+ * Creates a new container zip entry with the specified name, iff it has >+ * not already been created. If the parent of the given element does not >+ * already exist it will be recursively created as well. >+ * @param pathname The path representing the container >+ * @return The element represented by this pathname (it may have already existed) >+ */ >+ protected ZipEntry createContainer(IPath pathname) { >+ ZipEntry existingEntry = (ZipEntry) directoryEntryCache.get(pathname); >+ if (existingEntry != null) >+ return existingEntry; > > ZipEntry parent; > if (pathname.segmentCount() == 1) > parent = root; > else >- parent = (ZipEntry) directoryEntryCache.get(pathname >- .removeLastSegments(1)); >- >+ parent = createContainer(pathname.removeLastSegments(1)); > ZipEntry newEntry = new ZipEntry(pathname.toString()); > directoryEntryCache.put(pathname, newEntry); >- addToChildren(parent, newEntry); >+ List childList = new ArrayList(); >+ children.put(newEntry, childList); >+ >+ List parentChildList = (List) children.get(parent); >+ parentChildList.add(newEntry); >+ return newEntry; > } > > /** >@@ -103,7 +96,8 @@ > parent = (ZipEntry) directoryEntryCache.get(pathname > .removeLastSegments(1)); > >- addToChildren(parent, entry); >+ List childList = (List) children.get(parent); >+ childList.add(entry); > } > > /* >@@ -191,15 +185,20 @@ > protected void initialize() { > children = new HashMap(1000); > >+ children.put(root, new ArrayList()); > 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(); >+ IPath path = new Path(entry.getName()).addTrailingSeparator(); > >- for (int i = 1; i < pathSegmentCount; i++) >- createContainer(path.uptoSegment(i)); >+ if (entry.isDirectory()) >+ createContainer(path); >+ else >+ { >+ // Ensure the container structure for all levels above this is initialized >+ // Once we hit a higher-level container that's already added we need go no further >+ int pathSegmentCount = path.segmentCount(); >+ createContainer(path.uptoSegment(pathSegmentCount - 1)); > createFile(entry); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 96704
:
21912
| 26870 |
29613
|
29615
|
29617