本文整理汇总了Java中org.eclipse.egit.ui.internal.clone.ProjectUtils类的典型用法代码示例。如果您正苦于以下问题:Java ProjectUtils类的具体用法?Java ProjectUtils怎么用?Java ProjectUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectUtils类属于org.eclipse.egit.ui.internal.clone包,在下文中一共展示了ProjectUtils类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restore
import org.eclipse.egit.ui.internal.clone.ProjectUtils; //导入依赖的package包/类
/**
* Restore projects associated with the given branch to the workspace
*
* @param branch
* @param monitor
*/
public void restore(final String branch, final IProgressMonitor monitor) {
String[] paths = getProjectPaths(branch);
if (paths.length == 0)
return;
Set<ProjectRecord> records = new LinkedHashSet<ProjectRecord>();
File parent = repository.getWorkTree();
for (String path : paths) {
File root;
if (!REPO_ROOT.equals(path))
root = new File(parent, path);
else
root = parent;
if (!root.isDirectory())
continue;
File projectDescription = new File(root,
IProjectDescription.DESCRIPTION_FILE_NAME);
if (!projectDescription.isFile())
continue;
records.add(new ProjectRecord(projectDescription));
}
if (records.isEmpty())
return;
IProgressMonitor importMonitor;
if (monitor != null)
importMonitor = monitor;
else
importMonitor = new NullProgressMonitor();
try {
ProjectUtils.createProjects(records, true, null, importMonitor);
} catch (InvocationTargetException e) {
Activator
.logError("Error restoring branch-project associations", e); //$NON-NLS-1$
} catch (InterruptedException ignored) {
// Ignored
}
}
示例2: importProjects
import org.eclipse.egit.ui.internal.clone.ProjectUtils; //导入依赖的package包/类
private void importProjects(final Repository repository, final IWorkingSet[] sets){
Job importJob = new Job("Importing") {
@SuppressWarnings("restriction")
protected IStatus run(IProgressMonitor monitor){
List<File> files = new ArrayList<File>();
ProjectUtil.findProjectFiles(files, repository.getWorkTree(), true, monitor);
if(files.isEmpty()){
return Status.OK_STATUS;
}
Set<ProjectRecord> records = new LinkedHashSet<ProjectRecord>();
for(File file: files){
records.add(new ProjectRecord(file));
}
try{
//ProjectUtils.createProjects(records, false, repository, sets, monitor);
ProjectUtils.createProjects(records, sets, monitor);
}
catch(Exception e){
Activator.logError(e.getLocalizedMessage(), e);
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
};
importJob.schedule();
}