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 21912 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]
fix
bug95613.patch (text/plain), 6.88 KB, created by
Aaron Luchko
on 2005-05-27 19:19:21 EDT
(
hide
)
Description:
fix
Filename:
MIME Type:
Creator:
Aaron Luchko
Created:
2005-05-27 19:19:21 EDT
Size:
6.88 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.1 >diff -u -r1.1 TarLeveledStructureProvider.java >--- src/org/eclipse/ui/internal/wizards/datatransfer/TarLeveledStructureProvider.java 25 Apr 2005 20:26:40 -0000 1.1 >+++ src/org/eclipse/ui/internal/wizards/datatransfer/TarLeveledStructureProvider.java 27 May 2005 23:11:54 -0000 >@@ -58,26 +58,12 @@ > } > > /** >- * 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) { >+ protected boolean createContainer(IPath pathname) { > if (directoryEntryCache.containsKey(pathname)) >- return; >+ return false; > > TarEntry parent; > if (pathname.segmentCount() == 1) >@@ -89,7 +75,12 @@ > 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 true; > } > > /** >@@ -104,7 +95,8 @@ > parent = (TarEntry) directoryEntryCache.get(pathname > .removeLastSegments(1)); > >- addToChildren(parent, entry); >+ List childList = (List) children.get(parent); >+ childList.add(entry); > } > > /* >@@ -185,21 +177,27 @@ > */ > 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(); >- int pathSegmentCount = path.segmentCount(); >- >- for (int i = 1; i < pathSegmentCount; i++) >- createContainer(path.uptoSegment(i)); >+ IPath path = new Path(entry.getName()).addTrailingSeparator(); >+ int pathSegmentCount = path.segmentCount(); >+ >+ // 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 >+ for (int i = 1; i < pathSegmentCount; i++) >+ if (!createContainer(path.uptoSegment(i))) >+ break; >+ >+ if (entry.getFileType() == TarEntry.DIRECTORY) >+ createContainer(path); >+ else > createFile(entry); >- } > } > } >- >+ > /* > * (non-Javadoc) Method declared on IImportStructureProvider > */ >Index: src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java,v >retrieving revision 1.11 >diff -u -r1.11 WizardProjectsImportPage.java >--- src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java 17 May 2005 12:01:15 -0000 1.11 >+++ src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java 27 May 2005 23:11:55 -0000 >@@ -831,7 +831,7 @@ > monitor.subTask(NLS.bind( > DataTransferMessages.WizardProjectsImportPage_CheckingMessage, > provider.getLabel(entry))); >- List children = provider.getChildren(entry); //$NON-NLS-1$ >+ List children = provider.getChildren(entry); > if (children == null) { > children = new ArrayList(1); > } >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.1 >diff -u -r1.1 ZipLeveledStructureProvider.java >--- src/org/eclipse/ui/internal/wizards/datatransfer/ZipLeveledStructureProvider.java 25 Apr 2005 20:26:40 -0000 1.1 >+++ src/org/eclipse/ui/internal/wizards/datatransfer/ZipLeveledStructureProvider.java 27 May 2005 23:11:55 -0000 >@@ -59,26 +59,14 @@ > } > > /** >- * 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. >+ * @param pathname The path representing the container >+ * @return true if an element was created, false if this element already existed > */ >- protected void createContainer(IPath pathname) { >+ protected boolean createContainer(IPath pathname) { > if (directoryEntryCache.containsKey(pathname)) >- return; >+ return false; > > ZipEntry parent; > if (pathname.segmentCount() == 1) >@@ -89,7 +77,12 @@ > > 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 true; > } > > /** >@@ -104,7 +97,8 @@ > parent = (ZipEntry) directoryEntryCache.get(pathname > .removeLastSegments(1)); > >- addToChildren(parent, entry); >+ List childList = (List) children.get(parent); >+ childList.add(entry); > } > > /* >@@ -192,17 +186,23 @@ > 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(); >+ int pathSegmentCount = path.segmentCount(); > >- for (int i = 1; i < pathSegmentCount; i++) >- createContainer(path.uptoSegment(i)); >+ // 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 >+ for (int i = 1; i < pathSegmentCount; i++) >+ if (!createContainer(path.uptoSegment(i))) >+ break; >+ >+ if (entry.isDirectory()) >+ createContainer(path); >+ else > 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