本文整理汇总了Java中org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider类的典型用法代码示例。如果您正苦于以下问题:Java ZipFileStructureProvider类的具体用法?Java ZipFileStructureProvider怎么用?Java ZipFileStructureProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ZipFileStructureProvider类属于org.eclipse.ui.wizards.datatransfer包,在下文中一共展示了ZipFileStructureProvider类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unpackResourceProject
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
public static IProject unpackResourceProject(IProject project, Example.Resource resource) throws Exception
{
if (resource.getType() == Type.ENVIRONMENT)
CloudScaleProjectSupport.addProjectNature(project);
ZipFile file = new ZipFile(resource.getArchive().getFile());
ZipFileStructureProvider provider = new ZipFileStructureProvider(file);
IPath containerPath = project.getFullPath();
Object source = provider.getRoot();
IOverwriteQuery query = new IOverwriteQuery()
{
@Override
public String queryOverwrite(String path)
{
return IOverwriteQuery.ALL;
};
};
ImportOperation operation = new ImportOperation(containerPath, source, provider, query);
operation.run(null);
return project;
}
示例2: importFilesFromZip
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
/**
* 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 );
}
}
示例3: assertEntryMatchesDir
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
private void assertEntryMatchesDir(ZipFileStructureProvider structureProvider, IContainer folder, ZipEntry parentEntry) throws Exception {
List unexportedItems = Arrays.asList("bin");
IResource[] members = folder.members();
List children = structureProvider.getChildren(parentEntry);
for (IResource member : members) {
String memberName = member.getName();
if (unexportedItems.contains(memberName))
continue;
boolean found = false;
for (Object child : children) {
ZipEntry entry = (ZipEntry) child;
String entryName = getEntryName(entry);
if (entryName.equals(memberName)) {
found = true;
if (member instanceof IFolder)
if (entry.isDirectory())
assertEntryMatchesDir(structureProvider, (IContainer) member, entry);
else
fail("Directories don't match");
}
}
assertTrue(found);
}
}
开发者ID:ChangeOrientedProgrammingEnvironment,项目名称:eclipseRecorder,代码行数:25,代码来源:SnapshotManagerTest.java
示例4: createExampleProject
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
public static IProject createExampleProject(IProject project, Example.Resource resource)
{
try
{
if (resource.getType() == Type.ENVIRONMENT)
CloudScaleProjectSupport.addProjectNature(project);
ZipFile file = new ZipFile(resource.getArchive().getFile());
ZipFileStructureProvider provider = new ZipFileStructureProvider(file);
IPath containerPath = project.getFullPath();
Object source = provider.getRoot();
IOverwriteQuery query = new IOverwriteQuery()
{
@Override
public String queryOverwrite(String path)
{
return IOverwriteQuery.ALL;
};
};
ImportOperation operation = new ImportOperation(containerPath, source, provider, query);
try
{
operation.run(null);
} catch (Exception ex)
{
ex.printStackTrace();
}
} catch (Exception e)
{
e.printStackTrace();
project = null;
}
return project;
}
示例5: importFilesFromZip
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
public 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
}
}
示例6: prepareFileList
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
/**
* Prepare file list from zip file
*
* @param structure
* @param entry
* @param list
* @return
*/
private static List prepareFileList( ZipFileStructureProvider structure,
ZipEntry entry, List list )
{
if ( structure == null || entry == null )
return null;
if ( list == null )
{
list = new ArrayList( );
}
// get children
List son = structure.getChildren( entry );
if ( son == null )
return list;
// check if directory
Iterator it = son.iterator( );
while ( it.hasNext( ) )
{
ZipEntry temp = (ZipEntry) it.next( );
if ( temp.isDirectory( ) )
{
prepareFileList( structure, temp, list );
}
else
{
// if it is file, add to list
list.add( temp );
}
}
return list;
}
示例7: testCompleteSnapshot
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
@Test
public void testCompleteSnapshot() throws Exception {
String snapshotFile = snapshotManager.takeSnapshot(javaProject.getProject());
Thread.sleep(200);
ZipFileStructureProvider structureProvider = new ZipFileStructureProvider(new ZipFile(snapshotFile));
ZipEntry rootEntry = structureProvider.getRoot();
List children = structureProvider.getChildren(rootEntry);
ZipEntry projectRoot = getProjectEntry(children);
assertEntryMatchesDir(structureProvider, javaProject.getProject(), projectRoot);
}
开发者ID:ChangeOrientedProgrammingEnvironment,项目名称:eclipseRecorder,代码行数:12,代码来源:SnapshotManagerTest.java
示例8: internalChooseArchivePath
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
private String internalChooseArchivePath() {
ZipFile zipFile= null;
try {
if (fWorkspaceRadio.isSelected()) {
IResource resource= ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(fArchiveField.getText()));
if (resource != null) {
IPath location= resource.getLocation();
if (location != null) {
zipFile= new ZipFile(location.toOSString());
}
}
} else {
zipFile= new ZipFile(fArchiveField.getText());
}
if (zipFile == null) {
return null;
}
ZipFileStructureProvider provider= new ZipFileStructureProvider(zipFile);
ILabelProvider lp= new ZipDialogLabelProvider(provider);
ZipDialogContentProvider cp= new ZipDialogContentProvider(provider);
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(fShell, lp, cp);
dialog.setAllowMultiple(false);
dialog.setValidator(new ZipDialogValidator());
dialog.setTitle(PreferencesMessages.JavadocConfigurationBlock_browse_jarorzip_path_title);
dialog.setMessage(PreferencesMessages.JavadocConfigurationBlock_location_in_jarorzip_message);
dialog.setComparator(new ViewerComparator());
String init= fArchivePathField.getText();
if (init.length() == 0) {
init= "docs/api"; //$NON-NLS-1$
}
dialog.setInitialSelection(cp.findElement(new Path(init)));
dialog.setInput(this);
if (dialog.open() == Window.OK) {
String name= provider.getFullPath(dialog.getFirstResult());
return new Path(name).removeTrailingSeparator().toString();
}
} catch (IOException e) {
JavaPlugin.log(e);
} finally {
if (zipFile != null) {
try {
zipFile.close();
} catch (IOException e1) {
// ignore
}
}
}
return null;
}
示例9: ZipDialogContentProvider
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
public ZipDialogContentProvider(ZipFileStructureProvider provider) {
fProvider= provider;
}
示例10: ZipDialogLabelProvider
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
public ZipDialogLabelProvider(ZipFileStructureProvider provider) {
fProvider= provider;
}