当前位置: 首页>>代码示例>>Java>>正文


Java ProjectUtils类代码示例

本文整理汇总了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
	}
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:45,代码来源:BranchProjectTracker.java

示例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();
}
 
开发者ID:baloise,项目名称:egitblit,代码行数:30,代码来源:CloneOneClickAction.java


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