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

Java FileSystemStructureProvider类代码示例

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

本文整理汇总了Java中org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider的典型用法代码示例。如果您正苦于以下问题:Java FileSystemStructureProvider类的具体用法?Java FileSystemStructureProvider怎么用?Java FileSystemStructureProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FileSystemStructureProvider类属于org.eclipse.ui.wizards.datatransfer包,在下文中一共展示了FileSystemStructureProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: importProject

import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; //导入依赖的package包/类
private static IProject importProject(File probandsFolder, String projectName, boolean prepareDotProject)
		throws Exception {
	File projectSourceFolder = new File(probandsFolder, projectName);
	if (!projectSourceFolder.exists()) {
		throw new IllegalArgumentException("proband not found in " + projectSourceFolder);
	}

	if (prepareDotProject) {
		prepareDotProject(projectSourceFolder);
	}

	IProgressMonitor monitor = new NullProgressMonitor();
	IWorkspace workspace = ResourcesPlugin.getWorkspace();

	IProjectDescription newProjectDescription = workspace.newProjectDescription(projectName);
	IProject project = workspace.getRoot().getProject(projectName);
	project.create(newProjectDescription, monitor);
	project.open(monitor);
	if (!project.getLocation().toFile().exists()) {
		throw new IllegalArgumentException("test project correctly created in " + project.getLocation());
	}

	IOverwriteQuery overwriteQuery = new IOverwriteQuery() {
		@Override
		public String queryOverwrite(String file) {
			return ALL;
		}
	};
	ImportOperation importOperation = new ImportOperation(project.getFullPath(), projectSourceFolder,
			FileSystemStructureProvider.INSTANCE, overwriteQuery);
	importOperation.setCreateContainerStructure(false);
	importOperation.run(monitor);

	return project;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:36,代码来源:ProjectUtils.java


示例2: doCreateProject

import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; //导入依赖的package包/类
private IProject doCreateProject(ProjectCandidate pc, IProgressMonitor monitor) throws CoreException, InterruptedException {
	HybridProjectCreator projectCreator = new HybridProjectCreator();
	Widget w = pc.getWidget();
	String projectName = pc.getProjectName();
	URI location = null;
	if(!copyFiles){
		location = pc.wwwLocation.getParentFile().toURI();
	}
	IProject project = projectCreator.createProject(projectName, location, w.getName(), w.getId(), null, monitor);
	if(copyFiles){
		ImportOperation operation = new ImportOperation(project
				.getFullPath(), pc.wwwLocation.getParentFile(), FileSystemStructureProvider.INSTANCE
				, this);
		operation.setContext(getShell());
		operation.setOverwriteResources(true); 
		operation.setCreateContainerStructure(false);
		
		try {
			operation.run(monitor);
		} catch (InvocationTargetException e) {
			if(e.getCause() != null  && e.getCause() instanceof CoreException){
				CoreException corex = (CoreException) e.getCause();
				throw corex;
			}
		}
		IStatus status = operation.getStatus();
		if (!status.isOK())
			throw new CoreException(status);
	}
	return project;

}
 
开发者ID:eclipse,项目名称:thym,代码行数:33,代码来源:HybridProjectImportPage.java


示例3: run

import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; //导入依赖的package包/类
@Override
public void run(String[] params, ICheatSheetManager manager) {

	if (params == null || params[0] == null) {
		return;
	}
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	String projectName = params[0];
	String zipName = params[1];
	IProjectDescription newProjectDescription = workspace.newProjectDescription(projectName);
	IProject newProject = workspace.getRoot().getProject(projectName);
	try {
		newProject.create(newProjectDescription, null);
		newProject.open(null);

		URL url = this.getClass().getClassLoader().getResource(zipName);
		File f = new File(FileLocator.toFileURL(url).getPath());

		IOverwriteQuery overwriteQuery = new IOverwriteQuery() {
			public String queryOverwrite(String file) {
				System.out.println(file);
				return ALL;
			}
		};

		FileSystemStructureProvider provider = FileSystemStructureProvider.INSTANCE;

		File root = createTempDirectory();

		unzip(f.getAbsolutePath(), root.getAbsolutePath());

		List<File> files = readFiles(root.getAbsolutePath());
		ImportOperation importOperation = new ImportOperation(newProject.getFullPath(), root, provider,
				overwriteQuery, files);
		importOperation.setCreateContainerStructure(false);
		importOperation.run(new NullProgressMonitor());
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:42,代码来源:ProjectImport.java


示例4: importExample

import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; //导入依赖的package包/类
@Override
public void importExample(ExampleData edata, IProgressMonitor monitor) {
	try {
		IProjectDescription original = ResourcesPlugin.getWorkspace()
				.loadProjectDescription(new Path(edata.getProjectDir().getAbsolutePath()).append("/.project"));
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(edata.getProjectDir().getName());

		IProjectDescription clone = ResourcesPlugin.getWorkspace()
				.newProjectDescription(original.getName());
		clone.setBuildSpec(original.getBuildSpec());
		clone.setComment(original.getComment());
		clone.setDynamicReferences(original
				.getDynamicReferences());
		clone.setNatureIds(original.getNatureIds());
		clone.setReferencedProjects(original
				.getReferencedProjects());
		if(project.exists()){
			return;
		}
		project.create(clone, monitor);
		project.open(monitor);
		
		@SuppressWarnings("unchecked")
		List<IFile> filesToImport = FileSystemStructureProvider.INSTANCE.getChildren(edata.getProjectDir());
		ImportOperation io = new ImportOperation(project.getFullPath(), edata.getProjectDir(),
				FileSystemStructureProvider.INSTANCE, new IOverwriteQuery() {

					@Override
					public String queryOverwrite(String pathString) {
						return IOverwriteQuery.ALL;
					}

				}, filesToImport);
		io.setOverwriteResources(true);
		io.setCreateContainerStructure(false);
		io.run(monitor);
		project.refreshLocal(IProject.DEPTH_INFINITE, monitor);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:42,代码来源:GitRepositoryExampleService.java



注:本文中的org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java AbstractFilterTubeImpl类代码示例发布时间:2022-05-23
下一篇:
Java Arrays类代码示例发布时间: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