下面列出了怎么用org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* extract zip file and import files into project
*
* @param srcZipFile
* @param destPath
* @param monitor
* @param query
* @throws CoreException
*/
private static void importFilesFromZip( ZipFile srcZipFile, IPath destPath,
IProgressMonitor monitor, IOverwriteQuery query )
throws CoreException
{
try
{
ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(
srcZipFile );
List list = prepareFileList( structureProvider, structureProvider
.getRoot( ), null );
ImportOperation op = new ImportOperation( destPath,
structureProvider.getRoot( ), structureProvider, query,
list );
op.run( monitor );
}
catch ( Exception e )
{
String message = srcZipFile.getName( ) + ": " + e.getMessage( ); //$NON-NLS-1$
Logger.logException( e );
throw BirtCoreException.getException( message, e );
}
}
private static void importFilesFromZip(ZipFile srcZipFile, IPath destPath, IProgressMonitor monitor)
throws InvocationTargetException {
ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(srcZipFile);
try {
ImportOperation op = new ImportOperation(destPath, structureProvider.getRoot(), structureProvider,
new ImportOverwriteQuery());
op.run(monitor);
} catch (InterruptedException e) {
// should not happen
}
}
public ZipDialogContentProvider(ZipFileStructureProvider provider) {
fProvider= provider;
}
public ZipDialogLabelProvider(ZipFileStructureProvider provider) {
fProvider= provider;
}