• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ZipFileStructureProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParsedMessage类代码示例发布时间:2022-05-23
下一篇:
Java UrlSpaceConfigurer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap