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 188350 Details for
Bug 278402
[Import/Export] Export project does not export empty folders
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]
patch_for_3.6_maintenance
archive_export.txt (text/plain), 3.60 KB, created by
Chuck Bridgham
on 2011-02-04 14:00:23 EST
(
hide
)
Description:
patch_for_3.6_maintenance
Filename:
MIME Type:
Creator:
Chuck Bridgham
Created:
2011-02-04 14:00:23 EST
Size:
3.60 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/internal/wizards/datatransfer/ArchiveFileExportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/ArchiveFileExportOperation.java,v >retrieving revision 1.10 >diff -u -r1.10 ArchiveFileExportOperation.java >--- src/org/eclipse/ui/internal/wizards/datatransfer/ArchiveFileExportOperation.java 1 Jun 2010 19:22:30 -0000 1.10 >+++ src/org/eclipse/ui/internal/wizards/datatransfer/ArchiveFileExportOperation.java 4 Feb 2011 18:54:14 -0000 >@@ -37,7 +37,9 @@ > * @since 3.1 > */ > public class ArchiveFileExportOperation implements IRunnableWithProgress { >- private IFileExporter exporter; >+ private static final String ZIP_DIR_CHAR = "/"; //$NON-NLS-1$ >+ >+ private IFileExporter exporter; > > private String destinationFilename; > >@@ -162,6 +164,22 @@ > throws InterruptedException { > exportResource(exportResource, 1); > } >+ >+ /** >+ * Creates and returns the string that should be used as the name of the entry in the archive. >+ * >+ * @param exportResource the resource to export >+ * @param leadupDepth the number of resource levels to be included in the path including the resourse itself. >+ * @since 3.6 >+ */ >+ private String createDestinationName(int leadupDepth, IResource exportResource) { >+ IPath fullPath = exportResource.getFullPath(); >+ if (createLeadupStructure) { >+ return fullPath.makeRelative().toString(); >+ } >+ return fullPath.removeFirstSegments( >+ fullPath.segmentCount() - leadupDepth).toString(); >+ } > > /** > * Export the passed resource to the destination .zip >@@ -177,14 +195,7 @@ > } > > if (exportResource.getType() == IResource.FILE) { >- String destinationName; >- IPath fullPath = exportResource.getFullPath(); >- if (createLeadupStructure) { >- destinationName = fullPath.makeRelative().toString(); >- } else { >- destinationName = fullPath.removeFirstSegments( >- fullPath.segmentCount() - leadupDepth).toString(); >- } >+ String destinationName = createDestinationName(leadupDepth, exportResource); > monitor.subTask(destinationName); > > try { >@@ -198,7 +209,8 @@ > monitor.worked(1); > ModalContext.checkCanceled(monitor); > } else { >- IResource[] children = null; >+ >+ IResource[] children = null; > > try { > children = ((IContainer) exportResource).members(); >@@ -206,7 +218,20 @@ > // this should never happen because an #isAccessible check is done before #members is invoked > addError(NLS.bind(DataTransferMessages.DataTransfer_errorExporting, exportResource.getFullPath()), e); > } >- >+ // create an entry for ourselves, see bug 278402 >+ // Only create entry if no children exist >+ if (children.length == 0) { >+ String destinationName = createDestinationName(leadupDepth, exportResource); >+ >+ try { >+ exporter.write((IContainer) exportResource, destinationName + ZIP_DIR_CHAR); >+ } catch (IOException e) { >+ addError( >+ NLS.bind(DataTransferMessages.DataTransfer_errorExporting, exportResource.getFullPath().makeRelative(), >+ e.getMessage()), e); >+ } >+ } >+ > for (int i = 0; i < children.length; i++) { > exportResource(children[i], leadupDepth + 1); > }
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 278402
:
137765
|
149468
|
188350
|
192850