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

Wrap the call in a CoreModel.run()

This commit is contained in:
Alain Magloire 2005-07-09 02:44:13 +00:00
parent 0e90fb8c5c
commit 0b7470dc63

View file

@ -36,9 +36,11 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
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.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
@ -153,14 +155,16 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager#changeDiscoveredContainer(org.eclipse.core.resources.IProject, java.lang.String)
*/
public void changeDiscoveredContainer(IProject project, ScannerConfigScope profileScope, List changedResources) {
public void changeDiscoveredContainer(final IProject project, final ScannerConfigScope profileScope, final List changedResources) {
// order here is of essence
// 1. clear DiscoveredPathManager's path info cache
IDiscoveredPathInfo oldInfo = (IDiscoveredPathInfo) fDiscoveredMap.remove(project);
// 2. switch the containers
ICProject cProject = CoreModel.getDefault().create(project);
try {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
ICProject cProject = CoreModel.getDefault().create(project);
if (ScannerConfigScope.PROJECT_SCOPE.equals(profileScope)) {
CoreModel.setPathEntryContainer(new ICProject[]{cProject},
new DiscoveredPathContainer(project), null);
@ -187,8 +191,12 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
MakeCorePlugin.log(new Status(IStatus.ERROR, MakeCorePlugin.getUniqueIdentifier(), 1,
MakeMessages.getString("DiscoveredContainer.ScopeErrorMessage"), null)); //$NON-NLS-1$
}
}
catch (CModelException e) {
};
CoreModel.run(runnable, null);
}
catch (CoreException e) {
MakeCorePlugin.log(e);
}