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


Java IResourceRuleFactory类代码示例

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


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

示例1: getSchedulingRule

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
/**
 * Retgurn the scheduling rule to be obtained before work
 * begins on the given provider. By default, it is the provider's project.
 * This can be changed by subclasses.
 * @param provider
 * @return
 */
protected ISchedulingRule getSchedulingRule(SVNTeamProvider provider) {
	IResourceRuleFactory ruleFactory = provider.getRuleFactory();
	HashSet rules = new HashSet();
	IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	for (int i = 0; i < resources.length; i++) {			
		IResource[] pathResources = SVNWorkspaceRoot.getResourcesFor(new Path(resources[i].getLocation().toOSString()), false);
		for (IResource pathResource : pathResources) {
			IProject resourceProject = pathResource.getProject();				
			rules.add(ruleFactory.modifyRule(resourceProject));
			if (resourceProject.getLocation() != null) {
				// Add nested projects
				for (IProject project : projects) {
					if (project.getLocation() != null) {
						if (!project.getLocation().equals(resourceProject.getLocation()) && resourceProject.getLocation().isPrefixOf(project.getLocation())) {
							rules.add(ruleFactory.modifyRule(project));
						}
					}
				}	
			}
		}
	}
	return MultiRule.combine((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:31,代码来源:RepositoryProviderOperation.java

示例2: getModifyRule

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
/**
 * Retrieves a combined rule for modifying the resources
 * @param resources set of resources
 * @return a combined rule
 */
public static ISchedulingRule getModifyRule(IResource[] resources)
{
    if (resources == null)
    {
        return null;
    }
    ISchedulingRule combinedRule = null;
    IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
    for (int i = 0; i < resources.length; i++)
    {
        // if one of the resources does not exist
        // something is screwed up
        if (resources[i] == null || !resources[i].exists())
        {
            return null;
        }
        ISchedulingRule rule = ruleFactory.modifyRule(resources[i]);
        combinedRule = MultiRule.combine(rule, combinedRule);
    }
    return combinedRule;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:27,代码来源:ResourceHelper.java

示例3: getDeleteRule

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
/**
 * Retrieves a combined rule for deleting resource
 * @param resource
 * @return
 */
public static ISchedulingRule getDeleteRule(IResource[] resources)
{
    if (resources == null)
    {
        return null;
    }
    ISchedulingRule combinedRule = null;
    IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
    for (int i = 0; i < resources.length; i++)
    {
        ISchedulingRule rule = ruleFactory.deleteRule(resources[i]);
        combinedRule = MultiRule.combine(rule, combinedRule);
    }
    return combinedRule;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:21,代码来源:ResourceHelper.java

示例4: getCreateRule

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
/**
 * Retrieves a combined rule for creating resource
 * @param resource
 * @return
 */
public static ISchedulingRule getCreateRule(IResource[] resources)
{
    if (resources == null)
    {
        return null;
    }
    ISchedulingRule combinedRule = null;
    IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
    for (int i = 0; i < resources.length; i++)
    {
        ISchedulingRule rule = ruleFactory.createRule(resources[i]);
        combinedRule = MultiRule.combine(rule, combinedRule);
    }
    return combinedRule;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:21,代码来源:ResourceHelper.java

示例5: getSchedulingRule

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
protected ISchedulingRule getSchedulingRule(SVNTeamProvider provider) {
	IResourceRuleFactory ruleFactory = provider.getRuleFactory();
	HashSet rules = new HashSet();
	for (int i = 0; i < localFolders.length; i++) {
		rules.add(ruleFactory.modifyRule(localFolders[i].getProject()));
	}
	return MultiRule.combine((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:9,代码来源:CheckoutAsProjectOperation.java

示例6: getSchedulingRule

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
protected ISchedulingRule getSchedulingRule(SVNTeamProvider provider) {
	IResource[] resources = getResources();
	if (resources == null) return super.getSchedulingRule(provider);
	IResourceRuleFactory ruleFactory = provider.getRuleFactory();
	HashSet<ISchedulingRule> rules = new HashSet<ISchedulingRule>();
	for (int i = 0; i < resources.length; i++) {
		rules.add(ruleFactory.modifyRule(resources[i].getProject()));
	}
	return MultiRule.combine((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:11,代码来源:BranchTagOperation.java

示例7: getMarkerRule

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
private ISchedulingRule getMarkerRule(IResource resource) {
	ISchedulingRule rule = null;
	if (resource != null) {
		IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
		rule = ruleFactory.markerRule(resource);
	}
	return rule;
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:9,代码来源:BookmarksMarkers.java

示例8: factoryFor

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
/** Returns the scheduling rule factory for the given resource */
private IResourceRuleFactory factoryFor(IResource destination) {
  IResourceRuleFactory fac = projectsToRules.get(destination.getFullPath().segment(0));
  if (fac == null) {
    // use the default factory if the project is not yet accessible
    if (!destination.getProject().isAccessible()) return defaultFactory;
    // ask the team hook to supply one
    fac = teamHook.getRuleFactory(destination.getProject());
    projectsToRules.put(destination.getFullPath().segment(0), fac);
  }
  return fac;
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:Rules.java

示例9: getRuleFactory

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
@Override
public IResourceRuleFactory getRuleFactory() {
  // note that the rule factory is created lazily because it
  // requires loading the teamHook extension
  if (ruleFactory == null) {
    ruleFactory = new Rules(this);
  }
  return ruleFactory;
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:Workspace.java

示例10: run

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
/**
 * The implementation of this <code>WorkspaceAction</code> method method saves and closes the resource's dirty
 * editors before closing it.
 */
@Override
public void run() {
	// Get the items to close.
	final List<? extends IResource> projects = getSelectedResources();
	if (projects == null || projects.isEmpty()) {
		// no action needs to be taken since no projects are selected
		return;
	}

	final IResource[] projectArray = projects.toArray(new IResource[projects.size()]);

	if (!IDE.saveAllEditors(projectArray, true)) { return; }
	if (!validateClose()) { return; }

	closeMatchingEditors(projects, false);

	// be conservative and include all projects in the selection - projects
	// can change state between now and when the job starts
	ISchedulingRule rule = null;
	final IResourceRuleFactory factory = ResourcesPlugin.getWorkspace().getRuleFactory();
	for (final IResource element : projectArray) {
		final IProject project = (IProject) element;
		rule = MultiRule.combine(rule, factory.modifyRule(project));
	}
	runInBackground(rule);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:31,代码来源:CloseResourceAction.java

示例11: getSchedulingRule

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
protected ISchedulingRule getSchedulingRule() {
	if (this.canChangeResources) {
		IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
		return new MultiRule(new ISchedulingRule[] {
			// use project modification rule as this is needed to create the .classpath file if it doesn't exist yet, or to update project references
			ruleFactory.modifyRule(this.project.getProject()),
			
			// and external project modification rule in case the external folders are modified
			ruleFactory.modifyRule(JavaModelManager.getExternalManager().getExternalFoldersProject())
		});
	}
	return super.getSchedulingRule();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:SetClasspathOperation.java

示例12: getRuleFactory

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
public IResourceRuleFactory getRuleFactory() {
	return RESOURCE_RULE_FACTORY;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:4,代码来源:SVNTeamProvider.java

示例13: setRuleFactory

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
void setRuleFactory(IProject project, IResourceRuleFactory factory) {
  if (factory == null) projectsToRules.remove(project.getName());
  else projectsToRules.put(project.getName(), factory);
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:Rules.java

示例14: setRuleFactory

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
protected void setRuleFactory(IProject project, IResourceRuleFactory factory) {
  Workspace workspace = ((Workspace) project.getWorkspace());
  ((Rules) workspace.getRuleFactory()).setRuleFactory(project, factory);
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:InternalTeamHook.java

示例15: addTestJob

import org.eclipse.core.resources.IResourceRuleFactory; //导入依赖的package包/类
/**
 * Add a new test generation job to the job queue
 * 
 * @param target
 */
protected void addTestJob(final IResource target) {
	IJavaElement element = JavaCore.create(target);
	if (element == null) {
		return;
	}
	IJavaElement packageElement = element.getParent();

	String packageName = packageElement.getElementName();

	final String targetClass = (!packageName.isEmpty() ? packageName + "." : "")
	        + target.getName().replace(".java", "").replace(File.separator, ".");
	System.out.println("* Scheduling new automated job for " + targetClass);
	final String targetClassWithoutPackage = target.getName().replace(".java", "");

	final String suiteClassName = targetClass + Properties.JUNIT_SUFFIX;
	
	final String suiteFileName = target.getProject().getLocation() + "/evosuite-tests/" + 
									suiteClassName.replace('.', File.separatorChar) + ".java";
	System.out.println("Checking for " + suiteFileName);
	File suiteFile = new File(suiteFileName);
	Job job = null;
	if (suiteFile.exists()) {

		MessageDialog dialog = new MessageDialog(
		        shell,
		        "Existing test suite found",
		        null, // image
		        "A test suite for class \""
		                + targetClass
		                + "\" already exists. EvoSuite will overwrite this test suite. Do you really want to proceed?",
		        MessageDialog.QUESTION_WITH_CANCEL, new String[] { "Overwrite", "Extend",
		                "Rename Original", "Cancel" }, 0);

		int returnCode = dialog.open();
		// 0 == overwrite
		// 1 == extend
		if(returnCode == 1) {
			IWorkspaceRoot wroot = target.getWorkspace().getRoot();
			IResource suiteResource = wroot.getFileForLocation(new Path(suiteFileName));
			job = new TestExtensionJob(shell, suiteResource, targetClass, suiteClassName);
		}
		else if (returnCode == 2) {
			// 2 == Rename
			renameSuite(target, packageName, targetClassWithoutPackage + Properties.JUNIT_SUFFIX + ".java");
		} else if (returnCode > 2) {
			// Cancel
			return;
		}
	}

	if(job == null)
		job = new TestGenerationJob(shell, target, targetClass, suiteClassName);
	
	job.setPriority(Job.SHORT);
	IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
	ISchedulingRule rule = ruleFactory.createRule(target.getProject());

	//IFolder folder = proj.getFolder(ResourceUtil.EVOSUITE_FILES);
	job.setRule(rule);
	job.setUser(true);
	job.schedule(); // start as soon as possible
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:68,代码来源:TestGenerationAction.java


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