/** * Returns a scheduling rule that encompasses all provided rules. The resulting * rule may or may not be an instance of <code>MultiRule</code>. If all * provided rules are <code>null</code> then the result will be * <code>null</code>. * * @param ruleArray An array of scheduling rules, some of which may be <code>null</code> * @return a combined scheduling rule, or <code>null</code> * @since 3.1 */ public static ISchedulingRule combine(ISchedulingRule[] ruleArray) { ISchedulingRule result = null; for (int i = 0; i < ruleArray.length; i++) { if (ruleArray[i] == null) continue; if (result == null) { result = ruleArray[i]; continue; } result = combine(result, ruleArray[i]); } return result; }
/** * Returns a scheduling rule that encompasses all provided rules. The resulting * rule may or may not be an instance of <code>MultiRule</code>. If all * provided rules are <code>null</code> then the result will be * <code>null</code>. * * @param ruleArray An array of scheduling rules, some of which may be <code>null</code> * @return a combined scheduling rule, or <code>null</code> * @since 3.1 */ public static ISchedulingRule combine(ISchedulingRule[] ruleArray) { ISchedulingRule result = null; for (int i = 0; i < ruleArray.length; i++) { if (ruleArray[i] == null) continue; if (result == null) { result = ruleArray[i]; continue; } result = combine(result, ruleArray[i]); } return result; }
/** * Returns a scheduling rule that encompasses all provided rules. The resulting * rule may or may not be an instance of <code>MultiRule</code>. If all * provided rules are <code>null</code> then the result will be * <code>null</code>. * * @param ruleArray An array of scheduling rules, some of which may be <code>null</code> * @return a combined scheduling rule, or <code>null</code> * @since 3.1 */ public static ISchedulingRule combine(ISchedulingRule[] ruleArray) { ISchedulingRule result = null; for (int i = 0; i < ruleArray.length; i++) { if (ruleArray[i] == null) continue; if (result == null) { result = ruleArray[i]; continue; } result = combine(result, ruleArray[i]); } return result; }
/** * Returns a scheduling rule that encompasses all provided rules. The resulting * rule may or may not be an instance of <code>MultiRule</code>. If all * provided rules are <code>null</code> then the result will be * <code>null</code>. * * @param ruleArray An array of scheduling rules, some of which may be <code>null</code> * @return a combined scheduling rule, or <code>null</code> * @since 3.1 */ public static ISchedulingRule combine(ISchedulingRule[] ruleArray) { ISchedulingRule result = null; for (int i = 0; i < ruleArray.length; i++) { if (ruleArray[i] == null) continue; if (result == null) { result = ruleArray[i]; continue; } result = combine(result, ruleArray[i]); } return result; }
private ISchedulingRule getMergeRule(IMergeContext context, IDiff[] deltas) { ISchedulingRule result = null; for (int i = 0; i < deltas.length; i++) { IDiff node = deltas[i]; ISchedulingRule rule = context.getMergeRule(node); if (result == null) { result = rule; } else { result = MultiRule.combine(result, rule); } } return result; }
/** * Create a new {@link MonitorRule} that will be conflicting with * the same rules and will contain the same rules as the given resources. * * @param resources the resources to wrap * @return a new {@link MonitorRule}. */ static MonitorRule create(Collection<IResource> resources) { return new MonitorRule(MultiRule.combine(resources.toArray(SCHEDULING_RULE__EMPTY_ARR))); }
@Override public ISchedulingRule getMergeRule(IDiff[] deltas) { ISchedulingRule result = null; for (int i = 0; i < deltas.length; i++) { IDiff node = deltas[i]; ISchedulingRule rule = getMergeRule(node); if (result == null) { result = rule; } else { result = MultiRule.combine(result, rule); } } return result; }
private ISchedulingRule getMergeRule(IMergeContext context, IDiff[] deltas) { ISchedulingRule result = null; for (int i = 0; i < deltas.length; i++) { IDiff node = deltas[i]; ISchedulingRule rule = context.getMergeRule(node); if (result == null) { result = rule; } else { result = MultiRule.combine(result, rule); } } return result; }
public ISchedulingRule getSchedulingRule() { Set projs = gatherDependentProjects(getComponent(), new HashSet()); ISchedulingRule combinedRule = null; IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory(); for (Iterator iter = projs.iterator(); iter.hasNext();) { IProject proj = (IProject) iter.next(); ISchedulingRule rule = ruleFactory.createRule(proj); combinedRule = MultiRule.combine(rule, combinedRule); } combinedRule = MultiRule.combine(ruleFactory.buildRule(), combinedRule); return combinedRule; }
@Override protected ISchedulingRule getExecuteSchedulingRule() { ISchedulingRule[] ruleArray = new ISchedulingRule[resources.length]; for (int i = 0; i < resources.length; i++) { ruleArray[i] = getWorkspaceRuleFactory().markerRule(resources[i]); } return MultiRule.combine(ruleArray); }
/** * Default implementation of <code>IResourceRuleFactory#moveRule</code>. * This default implementation returns a rule that combines the parent * of the source resource and the parent of the destination resource. * <p> * Subclasses may override this method. The rule provided by an overriding * method must at least contain the rule from this default implementation. * * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule) * @see org.eclipse.core.resources.IResourceRuleFactory#moveRule(IResource, IResource) */ @Override public ISchedulingRule moveRule(IResource source, IResource destination) { //move needs the parent of both source and destination return MultiRule.combine(parent(source), parent(destination)); }
/** * Default implementation of <code>IResourceRuleFactory#moveRule</code>. * This default implementation returns a rule that combines the parent * of the source resource and the parent of the destination resource. * <p> * Subclasses may override this method. The rule provided by an overriding * method must at least contain the rule from this default implementation. * * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule) * @see org.eclipse.core.resources.IResourceRuleFactory#moveRule(IResource, IResource) */ @Override public ISchedulingRule moveRule(IResource source, IResource destination) { //move needs the parent of both source and destination return MultiRule.combine(parent(source), parent(destination)); }
/** * Default implementation of <code>IResourceRuleFactory#moveRule</code>. * This default implementation returns a rule that combines the parent * of the source resource and the parent of the destination resource. * <p> * Subclasses may override this method. The rule provided by an overriding * method must at least contain the rule from this default implementation. * * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule) * @see org.eclipse.core.resources.IResourceRuleFactory#moveRule(IResource, IResource) */ @Override public ISchedulingRule moveRule(IResource source, IResource destination) { //move needs the parent of both source and destination return MultiRule.combine(parent(source), parent(destination)); }
/** * Return the scheduling rule that is used when initializing and refreshing * the scope. By default, a rule that covers all projects for the input mappings * of the scope is returned. Subclasses may override. * * @return the scheduling rule that is used when initializing and refreshing * the scope */ public ISchedulingRule getSchedulingRule() { Set<IProject> projects = new HashSet<>(); ResourceMapping[] mappings = scope.getInputMappings(); for (int i = 0; i < mappings.length; i++) { ResourceMapping mapping = mappings[i]; Object modelObject = mapping.getModelObject(); if (modelObject instanceof IResource) { IResource resource = (IResource) modelObject; if (resource.getType() == IResource.ROOT) // If the workspace root is one of the inputs, // then use the workspace root as the rule return ResourcesPlugin.getWorkspace().getRoot(); projects.add(resource.getProject()); } else { // If one of the inputs is not a resource, then use the // root as the rule since we don't know whether projects // can be added or removed return ResourcesPlugin.getWorkspace().getRoot(); } } return MultiRule.combine(projects.toArray(new IProject[projects.size()])); }
/** * Compute a scheduling rule for deleting resources. * * @return a scheduling rule appropriate for deleting the resources * specified in the receiver. */ protected ISchedulingRule computeDeleteSchedulingRule() { ISchedulingRule[] ruleArray = new ISchedulingRule[resources.length * 2]; for (int i = 0; i < resources.length; i++) { ruleArray[i * 2] = getWorkspaceRuleFactory().deleteRule( resources[i]); // we include a modify rule because we may have to open a project // to record its resources before deleting it. ruleArray[i * 2 + 1] = getWorkspaceRuleFactory().modifyRule( resources[i]); } return MultiRule.combine(ruleArray); }
public SiteBuildOperation(IFeatureModel[] features, ISiteModel site, String jobName) { super(getInfo(features, site), jobName); fFeatureModels = features; fSiteModel = site; fSiteContainer = site.getUnderlyingResource().getParent(); setRule(MultiRule.combine(fSiteContainer.getProject(), getRule())); }
protected AbstractBranchChangeRemoteJob(final Repository repository, UUID id, final String sourcePath, final String targetPath, final String commitComment, final String reviewId) { super(commitComment); this.repository = repository; this.commitComment = commitComment; this.reviewId = reviewId; merge.set(MergeImpl.builder(sourcePath, targetPath).id(id).build()); setSystem(true); setRule(MultiRule.combine( new BranchExclusiveRule(repository.id(), BranchPathUtils.createPath(sourcePath)), new BranchExclusiveRule(repository.id(), BranchPathUtils.createPath(targetPath)))); }
/** * Obtains the scheduling rule from the appropriate factories for a move operation. */ @Override public ISchedulingRule moveRule(IResource source, IResource destination) { if (source.getType() == IResource.ROOT || destination.getType() == IResource.ROOT) return root; //treat a move across projects as a create on the destination and a delete on the source if (!source.getFullPath().segment(0).equals(destination.getFullPath().segment(0))) return MultiRule.combine(modifyRule(source.getProject()), modifyRule(destination.getProject())); return factoryFor(source).moveRule(source, destination); }
/** * Obtains the scheduling rule from the appropriate factories for a move operation. */ @Override public ISchedulingRule moveRule(IResource source, IResource destination) { if (source.getType() == IResource.ROOT || destination.getType() == IResource.ROOT) return root; //treat a move across projects as a create on the destination and a delete on the source if (!source.getFullPath().segment(0).equals(destination.getFullPath().segment(0))) return MultiRule.combine(modifyRule(source.getProject()), modifyRule(destination.getProject())); return factoryFor(source).moveRule(source, destination); }
/** * Obtains the scheduling rule from the appropriate factories for a move operation. */ @Override public ISchedulingRule moveRule(IResource source, IResource destination) { if (source.getType() == IResource.ROOT || destination.getType() == IResource.ROOT) return root; //treat a move across projects as a create on the destination and a delete on the source if (!source.getFullPath().segment(0).equals(destination.getFullPath().segment(0))) return MultiRule.combine(modifyRule(source.getProject()), modifyRule(destination.getProject())); return factoryFor(source).moveRule(source, destination); }