Java Code Examples for org.eclipse.core.resources.IResourceRuleFactory#createRule()

The following examples show how to use org.eclipse.core.resources.IResourceRuleFactory#createRule() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceHelper.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: BaseDocumentLifeCycleHandler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private ISchedulingRule getRule(Set<ICompilationUnit> units) {
	ISchedulingRule result = null;
	IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
	for (ICompilationUnit unit : units) {
		if (unit.getResource() != null) {
			ISchedulingRule rule = ruleFactory.createRule(unit.getResource());
			result = MultiRule.combine(rule, result);
		}
	}
	return result;
}
 
Example 3
Source File: ResourceUtils.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public static ISchedulingRule createRule(Collection<? extends IResource> resources) {
      ISchedulingRule combinedRule = null;
      IResourceRuleFactory ruleFactory = 
            ResourcesPlugin.getWorkspace().getRuleFactory();
      
      for (IResource r : resources) {
      	ISchedulingRule rule = ruleFactory.createRule(r);
          combinedRule = MultiRule.combine(rule, combinedRule);
}
      
      return combinedRule;
   }
 
Example 4
Source File: ResourceHelper.java    From tlaplus with MIT License 4 votes vote down vote up
public static ISchedulingRule getCreateRule(IResource resource)
{
    IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
    return ruleFactory.createRule(resource);
}