本文整理汇总了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;
}
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:24,代码来源:ExampleService.java
示例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 );
}
}
开发者ID:eclipse,项目名称:birt,代码行数:32,代码来源:BirtWizardUtil.java
示例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;
}
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:38,代码来源:ExampleProjectWizard.java
示例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
}
}
开发者ID:kjlubick,项目名称:fb-contrib-eclipse-quick-fixes,代码行数:12,代码来源:JavaProjectHelper.java
示例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;
}
开发者ID:eclipse,项目名称:birt,代码行数:43,代码来源:BirtWizardUtil.java
示例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;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:55,代码来源:JavadocConfigurationBlock.java
示例9: ZipDialogContentProvider
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
public ZipDialogContentProvider(ZipFileStructureProvider provider) {
fProvider= provider;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:JavadocConfigurationBlock.java
示例10: ZipDialogLabelProvider
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; //导入依赖的package包/类
public ZipDialogLabelProvider(ZipFileStructureProvider provider) {
fProvider= provider;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:JavadocConfigurationBlock.java
注:本文中的org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论