1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

Bug 310007 back-out changes - tests aren't happy

This commit is contained in:
James Blackburn 2010-04-22 15:43:21 +00:00
parent 63dc719a21
commit 077917c1f5
2 changed files with 9 additions and 16 deletions

View file

@ -443,9 +443,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
// Should the rule be scheduled, or run immediately // Should the rule be scheduled, or run immediately
// Bug 310007 - Always unsafe to modify resources while data structure lock is held boolean scheduleRule = ResourcesPlugin.getWorkspace().isTreeLocked();
boolean scheduleRule = true;
// boolean scheduleRule = ResourcesPlugin.getWorkspace().isTreeLocked();
// Check whether current job contains rule 'rule' // Check whether current job contains rule 'rule'
// If not, we must schedule another job to execute the runnable // If not, we must schedule another job to execute the runnable

View file

@ -48,9 +48,9 @@ import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionStorageManager; import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionStorageManager;
import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory; import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
import org.eclipse.cdt.internal.core.settings.model.ICProjectDescriptionStorageType; import org.eclipse.cdt.internal.core.settings.model.ICProjectDescriptionStorageType;
import org.eclipse.cdt.internal.core.settings.model.ICProjectDescriptionStorageType.CProjectDescriptionStorageTypeProxy;
import org.eclipse.cdt.internal.core.settings.model.SettingsContext; import org.eclipse.cdt.internal.core.settings.model.SettingsContext;
import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages; import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages;
import org.eclipse.cdt.internal.core.settings.model.ICProjectDescriptionStorageType.CProjectDescriptionStorageTypeProxy;
import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo; import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.filesystem.IFileStore;
@ -61,7 +61,6 @@ import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -121,8 +120,6 @@ public class XmlProjectDescriptionStorage extends AbstractCProjectDescriptionSto
super(type, project, version); super(type, project, version);
} }
private int desSerialTotalCount;
private volatile int desSerialCurrent;
/** /**
* The workspace runnable that actually goes about serializing the project description * The workspace runnable that actually goes about serializing the project description
@ -130,22 +127,20 @@ public class XmlProjectDescriptionStorage extends AbstractCProjectDescriptionSto
private class DesSerializationRunnable implements IWorkspaceRunnable { private class DesSerializationRunnable implements IWorkspaceRunnable {
private final ICProjectDescription fDes; private final ICProjectDescription fDes;
private final ICStorageElement fElement; private final ICStorageElement fElement;
private final int serializingNumber;
public DesSerializationRunnable(ICProjectDescription des, ICStorageElement el) { public DesSerializationRunnable(ICProjectDescription des, ICStorageElement el) {
fDes = des; fDes = des;
fElement = el; fElement = el;
serializingNumber = desSerialTotalCount++;
} }
public void run(IProgressMonitor monitor) throws CoreException { public void run(IProgressMonitor monitor) throws CoreException {
// Asserting that the platform job API stands by its committment to run jobs try {
// with conflicting scheduling rules in strict order -- so the project configuration serializingLock.acquire();
// at the end of a batch of changes is consistent. projectModificaitonStamp = serialize(fDes.getProject(), ICProjectDescriptionStorageType.STORAGE_FILE_NAME, fElement);
Assert.isTrue(serializingNumber == desSerialCurrent); ((ContributedEnvironment) CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment()).serialize(fDes);
desSerialCurrent++; } finally {
projectModificaitonStamp = serialize(fDes.getProject(), ICProjectDescriptionStorageType.STORAGE_FILE_NAME, fElement); serializingLock.release();
((ContributedEnvironment) CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment()).serialize(fDes); }
} }
} }