1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixed up the commit operation to use the correct Scheduling

Rule. M8 seems to have gotten more strict.
This commit is contained in:
Doug Schaefer 2004-03-27 05:03:58 +00:00
parent a9d96b7796
commit 783624b37e
3 changed files with 26 additions and 2 deletions

View file

@ -883,7 +883,8 @@ public class CModelManager implements IResourceChangeListener, ICDescriptorListe
operation.run(monitor);
} else {
// use IWorkspace.run(...) to ensure that a build will be done in autobuild mode
getCModel().getUnderlyingResource().getWorkspace().run(operation, monitor);
getCModel().getUnderlyingResource().getWorkspace()
.run(operation, operation.getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor);
}
} catch (CoreException ce) {
if (ce instanceof CModelException) {

View file

@ -21,12 +21,14 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
/**
* Defines behavior common to all C Model operations
@ -382,6 +384,15 @@ public abstract class CModelOperation implements IWorkspaceRunnable, IProgressMo
return fResultElements;
}
/**
* Returns the scheduling rule for this operation (i.e. the resource that needs to be locked
* while this operation is running.
* Subclasses can override.
*/
public ISchedulingRule getSchedulingRule() {
return ResourcesPlugin.getWorkspace().getRoot();
}
/**
* Creates and returns a subprogress monitor if appropriate.
*/

View file

@ -11,13 +11,16 @@ package org.eclipse.cdt.internal.core.model;
* Rational Software - Initial API and implementation
***********************************************************************/
import org.eclipse.cdt.core.model.*;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IBuffer;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModelStatus;
import org.eclipse.cdt.core.model.ICModelStatusConstants;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
/**
* Commits the contents of a working copy translation unit to its original
@ -54,6 +57,15 @@ public class CommitWorkingCopyOperation extends CModelOperation {
super(new ICElement[] {element}, force);
}
public ISchedulingRule getSchedulingRule() {
IResource resource = getElementToProcess().getResource();
IWorkspace workspace = resource.getWorkspace();
if (resource.exists()) {
return workspace.getRuleFactory().modifyRule(resource);
} else {
return workspace.getRuleFactory().createRule(resource);
}
}
/**
* @see org.eclipse.cdt.internal.core.model.CModelOperation#executeOperation()