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