View | Details | Raw Unified | Return to bug 136502
Collapse All | Expand All

(-)compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java (-1 / +15 lines)
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
(-)compare/org/eclipse/compare/internal/patch/PatchWizard.java (-2 / +4 lines)
Lines 17-22 Link Here
17
import org.eclipse.compare.internal.Utilities;
17
import org.eclipse.compare.internal.Utilities;
18
import org.eclipse.compare.internal.patch.CompareWithPatchAction.PatchWizardDialog;
18
import org.eclipse.compare.internal.patch.CompareWithPatchAction.PatchWizardDialog;
19
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.resources.ResourcesPlugin;
20
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IProgressMonitor;
22
import org.eclipse.core.runtime.IProgressMonitor;
22
import org.eclipse.core.runtime.jobs.ISchedulingRule;
23
import org.eclipse.core.runtime.jobs.ISchedulingRule;
Lines 103-113 Link Here
103
			// create scheduling rule based on the type of patch - single or workspace
104
			// create scheduling rule based on the type of patch - single or workspace
104
			ISchedulingRule scheduleRule= null;
105
			ISchedulingRule scheduleRule= null;
105
			if (fPatcher.isWorkspacePatch()) {
106
			if (fPatcher.isWorkspacePatch()) {
106
				// workspace patch
107
				// workspace patch 
107
				scheduleRule= new MultiRule(fPatcher.getTargetProjects());
108
				scheduleRule= new MultiRule(fPatcher.getTargetProjects());
108
			} else {
109
			} else {
109
				// single patch
110
				// single patch
110
				scheduleRule= getTarget();
111
				IResource resource = getTarget();
112
				scheduleRule= ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(resource);
111
			}
113
			}
112
114
113
			WorkspaceModifyOperation op= new WorkspaceModifyOperation(scheduleRule) {
115
			WorkspaceModifyOperation op= new WorkspaceModifyOperation(scheduleRule) {

Return to bug 136502