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


Java MultiRule类代码示例

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


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

示例1: getSchedulingRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的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.runtime.jobs.MultiRule; //导入依赖的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.runtime.jobs.MultiRule; //导入依赖的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.runtime.jobs.MultiRule; //导入依赖的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: getResetRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
/**
 * @generated
 */
protected ISchedulingRule getResetRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
		for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
				.hasNext();) {
			Resource nextResource = it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				rules.add(ResourcesPlugin.getWorkspace().getRuleFactory()
						.modifyRule(file));
			}
		}
		return new MultiRule(
				(ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules
						.size()]));
	}
	return null;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:23,代码来源:StatemachineDocumentProvider.java

示例6: getSaveRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
/**
 * @generated
 */
protected ISchedulingRule getSaveRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
		for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
				.hasNext();) {
			Resource nextResource = it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				rules.add(computeSchedulingRule(file));
			}
		}
		return new MultiRule(
				(ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules
						.size()]));
	}
	return null;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:22,代码来源:StatemachineDocumentProvider.java

示例7: getSynchronizeRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
/**
 * @generated
 */
protected ISchedulingRule getSynchronizeRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
		for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
				.hasNext();) {
			Resource nextResource = it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				rules.add(ResourcesPlugin.getWorkspace().getRuleFactory()
						.refreshRule(file));
			}
		}
		return new MultiRule(
				(ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules
						.size()]));
	}
	return null;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:23,代码来源:StatemachineDocumentProvider.java

示例8: validateEditRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
/** Combines rules for each parameter to validateEdit from the corresponding rule factories. */
public ISchedulingRule validateEditRule(IResource[] resources) {
  if (resources.length == 0) return null;
  // optimize rule for single file
  if (resources.length == 1) {
    if (resources[0].getType() == IResource.ROOT) return root;
    return factoryFor(resources[0]).validateEditRule(resources);
  }
  // gather rules for each resource from appropriate factory
  HashSet<ISchedulingRule> rules = new HashSet<ISchedulingRule>();
  IResource[] oneResource = new IResource[1];
  for (int i = 0; i < resources.length; i++) {
    if (resources[i].getType() == IResource.ROOT) return root;
    oneResource[0] = resources[i];
    ISchedulingRule rule = factoryFor(resources[i]).validateEditRule(oneResource);
    if (rule != null) rules.add(rule);
  }
  if (rules.isEmpty()) return null;
  if (rules.size() == 1) return rules.iterator().next();
  ISchedulingRule[] ruleArray = rules.toArray(new ISchedulingRule[rules.size()]);
  return new MultiRule(ruleArray);
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:Rules.java

示例9: contains

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
@Override
public boolean contains(ISchedulingRule rule) {
  if (this == rule) return true;
  // must allow notifications to nest in all resource rules
  if (rule.getClass().equals(WorkManager.NotifyRule.class)) return true;
  if (rule instanceof MultiRule) {
    MultiRule multi = (MultiRule) rule;
    ISchedulingRule[] children = multi.getChildren();
    for (int i = 0; i < children.length; i++) if (!contains(children[i])) return false;
    return true;
  }
  if (!(rule instanceof IResource)) return false;
  IResource resource = (IResource) rule;
  if (!workspace.equals(resource.getWorkspace())) return false;
  return path.isPrefixOf(resource.getFullPath());
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:Resource.java

示例10: isConflicting

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
@Override
public boolean isConflicting(ISchedulingRule rule) {
  if (this == rule) return true;
  // must not schedule at same time as notification
  if (rule.getClass().equals(WorkManager.NotifyRule.class)) return true;
  if (rule instanceof MultiRule) {
    MultiRule multi = (MultiRule) rule;
    ISchedulingRule[] children = multi.getChildren();
    for (int i = 0; i < children.length; i++) if (isConflicting(children[i])) return true;
    return false;
  }
  if (!(rule instanceof IResource)) return false;
  IResource resource = (IResource) rule;
  if (!workspace.equals(resource.getWorkspace())) return false;
  IPath otherPath = resource.getFullPath();
  return path.isPrefixOf(otherPath) || otherPath.isPrefixOf(path);
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:Resource.java

示例11: getSchedulingRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
protected ISchedulingRule getSchedulingRule() {
	if (this.elementsToProcess == null)
		return null;
	int length = this.elementsToProcess.length;
	if (length == 1)
		return getSchedulingRule(this.elementsToProcess[0]);
	ISchedulingRule[] rules = new ISchedulingRule[length];
	int index = 0;
	for (int i = 0; i < length; i++) {
		ISchedulingRule rule = getSchedulingRule(this.elementsToProcess[i]);
		if (rule != null) {
			rules[index++] = rule;
		}
	}
	if (index != length)
		System.arraycopy(rules, 0, rules = new ISchedulingRule[index], 0, index);
	return new MultiRule(rules);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CopyResourceElementsOperation.java

示例12: getResetRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
/**
 * @generated
 */
protected ISchedulingRule getResetRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/rules = new ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
		for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info
				.getLoadedResourcesIterator(); it.hasNext();) {
			Resource nextResource = (Resource) it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				rules.add(ResourcesPlugin.getWorkspace().getRuleFactory()
						.modifyRule(file));
			}
		}
		return new MultiRule((ISchedulingRule[]) rules
				.toArray(new ISchedulingRule[rules.size()]));
	}
	return null;
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:22,代码来源:SmcDocumentProvider.java

示例13: getSaveRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
/**
 * @generated
 */
protected ISchedulingRule getSaveRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/rules = new ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
		for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info
				.getLoadedResourcesIterator(); it.hasNext();) {
			Resource nextResource = (Resource) it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				rules.add(computeSchedulingRule(file));
			}
		}
		return new MultiRule((ISchedulingRule[]) rules
				.toArray(new ISchedulingRule[rules.size()]));
	}
	return null;
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:21,代码来源:SmcDocumentProvider.java

示例14: getSynchronizeRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
/**
 * @generated
 */
protected ISchedulingRule getSynchronizeRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/rules = new ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
		for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info
				.getLoadedResourcesIterator(); it.hasNext();) {
			Resource nextResource = (Resource) it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				rules.add(ResourcesPlugin.getWorkspace().getRuleFactory()
						.refreshRule(file));
			}
		}
		return new MultiRule((ISchedulingRule[]) rules
				.toArray(new ISchedulingRule[rules.size()]));
	}
	return null;
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:22,代码来源:SmcDocumentProvider.java

示例15: getResetRule

import org.eclipse.core.runtime.jobs.MultiRule; //导入依赖的package包/类
/**
* @generated
*/
protected ISchedulingRule getResetRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
		for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) {
			Resource nextResource = it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
			}
		}
		return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
	}
	return null;
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:19,代码来源:ICSE15_SequenceDiagram_MAVODocumentProvider.java


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