Lines 24-29
Link Here
|
24 |
import org.eclipse.core.resources.IFile; |
24 |
import org.eclipse.core.resources.IFile; |
25 |
import org.eclipse.core.resources.IMarker; |
25 |
import org.eclipse.core.resources.IMarker; |
26 |
import org.eclipse.core.resources.IProject; |
26 |
import org.eclipse.core.resources.IProject; |
|
|
27 |
import org.eclipse.core.resources.IProjectDescription; |
27 |
import org.eclipse.core.resources.ResourcesPlugin; |
28 |
import org.eclipse.core.resources.ResourcesPlugin; |
28 |
import org.eclipse.core.runtime.CoreException; |
29 |
import org.eclipse.core.runtime.CoreException; |
29 |
import org.eclipse.core.runtime.IAdaptable; |
30 |
import org.eclipse.core.runtime.IAdaptable; |
Lines 32-37
Link Here
|
32 |
import org.eclipse.core.runtime.Path; |
33 |
import org.eclipse.core.runtime.Path; |
33 |
import org.eclipse.core.runtime.SubProgressMonitor; |
34 |
import org.eclipse.core.runtime.SubProgressMonitor; |
34 |
import org.eclipse.core.runtime.jobs.ISchedulingRule; |
35 |
import org.eclipse.core.runtime.jobs.ISchedulingRule; |
|
|
36 |
import org.eclipse.core.runtime.jobs.MultiRule; |
35 |
import org.eclipse.jface.resource.ImageDescriptor; |
37 |
import org.eclipse.jface.resource.ImageDescriptor; |
36 |
import org.eclipse.swt.SWT; |
38 |
import org.eclipse.swt.SWT; |
37 |
import org.eclipse.swt.widgets.Shell; |
39 |
import org.eclipse.swt.widgets.Shell; |
Lines 265-274
Link Here
|
265 |
|
267 |
|
266 |
public ISchedulingRule[] getTargetProjects() { |
268 |
public ISchedulingRule[] getTargetProjects() { |
267 |
List projects = new ArrayList(); |
269 |
List projects = new ArrayList(); |
|
|
270 |
//Determine the appropriate scheduling rules |
268 |
for (int i = 0; i < fDiffProjects.length; i++) { |
271 |
for (int i = 0; i < fDiffProjects.length; i++) { |
269 |
DiffProject diffProject = fDiffProjects[i]; |
272 |
DiffProject diffProject = fDiffProjects[i]; |
270 |
projects.add(diffProject.getProject()); |
273 |
IProject tempProject = diffProject.getProject(); |
|
|
274 |
ISchedulingRule scheduleRule; |
275 |
MultiRule multiRule = null; |
276 |
// The goal here is to lock as little of the workspace as neccessary |
277 |
// but still allow the patcher to obtain the locks it needs. |
278 |
// As such, we need to get the modify rules from the rule factory for the .project file. A pessimistic |
279 |
// rule factory will return the root, while others might return just the project. Combining |
280 |
// this rule with the project will result in the smallest possible locking set. |
281 |
scheduleRule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(tempProject.getFile(IProjectDescription.DESCRIPTION_FILE_NAME)); |
282 |
multiRule = new MultiRule(new ISchedulingRule[]{scheduleRule, tempProject}); |
283 |
projects.add(multiRule); |
271 |
} |
284 |
} |
|
|
285 |
|
272 |
return (ISchedulingRule[]) projects.toArray(new ISchedulingRule[projects.size()]); |
286 |
return (ISchedulingRule[]) projects.toArray(new ISchedulingRule[projects.size()]); |
273 |
} |
287 |
} |
274 |
|
288 |
|