Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/ResourceChangeHandlerBase.java17
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ResourceChangeHandler.java6
2 files changed, 21 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/ResourceChangeHandlerBase.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/ResourceChangeHandlerBase.java
index 9444fc1d9a4..caff261452c 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/ResourceChangeHandlerBase.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/util/ResourceChangeHandlerBase.java
@@ -14,6 +14,7 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -74,6 +75,9 @@ public abstract class ResourceChangeHandlerBase implements IResourceChangeListen
public boolean visit(IResourceDelta delta) throws CoreException {
IResource dResource = delta.getResource();
+ if(dResource.getType() == IResource.PROJECT && !shouldVisit((IProject)dResource))
+ return false;
+
boolean resume = true;
boolean removed = false;
@@ -126,10 +130,21 @@ public abstract class ResourceChangeHandlerBase implements IResourceChangeListen
}
}
+ protected boolean shouldVisit(IProject project){
+ try {
+ return project.isOpen() ? project.hasNature(CProjectNature.C_NATURE_ID) : true;
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ return false;
+ }
+ }
+
protected void doHahdleResourceMove(IResourceChangeEvent event, IResourceMoveHandler handler){
switch (event.getType()) {
case IResourceChangeEvent.PRE_CLOSE:
- handler.handleProjectClose((IProject)event.getResource());
+ IProject project = (IProject)event.getResource();
+ if(shouldVisit(project))
+ handler.handleProjectClose(project);
break;
// case IResourceChangeEvent.PRE_DELETE :
// handler.handleResourceRemove(event.getResource());
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ResourceChangeHandler.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ResourceChangeHandler.java
index 86013b6fa98..1cecf635ec1 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ResourceChangeHandler.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/ResourceChangeHandler.java
@@ -334,7 +334,11 @@ public class ResourceChangeHandler extends ResourceChangeHandlerBase implements
if(delta != null){
IResourceDelta projs[] = delta.getAffectedChildren();
for(int i = 0; i < projs.length; i++){
- IResourceDelta children[] = projs[i].getAffectedChildren();
+ IResourceDelta projDelta = projs[i];
+ if(!shouldVisit((IProject)projDelta.getResource()))
+ continue;
+
+ IResourceDelta children[] = projDelta.getAffectedChildren();
for(int k = 0; k < children.length; k++){
IResourceDelta child = children[k];
IResource rc = child.getResource();

Back to the top