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

Fix for 202085: CDT contributions to ProjectExplorer slows performance down dramatically

This commit is contained in:
Anton Leherbauer 2007-09-11 11:38:13 +00:00
parent 455f7fb132
commit 61c06f6e88
2 changed files with 34 additions and 24 deletions

View file

@ -458,7 +458,11 @@ public class DeltaProcessor {
IResource resource = delta.getResource(); IResource resource = delta.getResource();
ICElement current = createElement(resource); ICElement current = createElement(resource);
updateChildren = updateCurrentDeltaAndIndex(current, delta); updateChildren = updateCurrentDeltaAndIndex(current, delta);
if (current == null || current instanceof ISourceRoot) { if (current == null) {
nonCResourcesChanged(parent, delta);
// no corresponding ICElement - we are done
return;
} else if (current instanceof ISourceRoot) {
nonCResourcesChanged(parent, delta); nonCResourcesChanged(parent, delta);
} else if (current instanceof ICProject) { } else if (current instanceof ICProject) {
ICProject cprj = (ICProject)current; ICProject cprj = (ICProject)current;
@ -467,9 +471,7 @@ public class DeltaProcessor {
nonCResourcesChanged(parent, delta); nonCResourcesChanged(parent, delta);
} }
} }
if (current != null) { parent = current;
parent = current;
}
} catch (CModelException e) { } catch (CModelException e) {
} }
if (updateChildren){ if (updateChildren){

View file

@ -15,23 +15,6 @@ package org.eclipse.cdt.ui;
import java.util.HashSet; import java.util.HashSet;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ElementChangedEvent;
import org.eclipse.cdt.core.model.IArchive;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementDelta;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.ArchiveContainer;
import org.eclipse.cdt.internal.core.model.BinaryContainer;
import org.eclipse.cdt.internal.ui.BaseCElementContentProvider;
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
import org.eclipse.cdt.internal.ui.text.CWordFinder;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.IRegion;
@ -45,6 +28,27 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ElementChangedEvent;
import org.eclipse.cdt.core.model.IArchive;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementDelta;
import org.eclipse.cdt.core.model.ICModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.ArchiveContainer;
import org.eclipse.cdt.internal.core.model.BinaryContainer;
import org.eclipse.cdt.internal.ui.BaseCElementContentProvider;
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
import org.eclipse.cdt.internal.ui.text.CWordFinder;
/** /**
* A content provider for C elements. * A content provider for C elements.
* <p> * <p>
@ -169,8 +173,10 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
// well, we do see bugzilla 147694 // well, we do see bugzilla 147694
if (element instanceof ITranslationUnit) { if (element instanceof ITranslationUnit) {
ITranslationUnit unit = (ITranslationUnit) element; ITranslationUnit unit = (ITranslationUnit) element;
if (!getProvideWorkingCopy() && unit.isWorkingCopy()) { if (unit.isWorkingCopy()) {
return; if (!getProvideWorkingCopy() || kind == ICElementDelta.REMOVED || kind == ICElementDelta.ADDED) {
return;
}
} }
if (!getProvideMembers() && kind == ICElementDelta.CHANGED) { if (!getProvideMembers() && kind == ICElementDelta.CHANGED) {
return; return;
@ -230,8 +236,10 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
if (deltas == null) if (deltas == null)
return false; return false;
if (deltas.length > 1) { if (deltas.length > 1 && !(parent instanceof ICModel)) {
// more than one child changed, refresh from here downwards // more than one child changed, refresh from here downwards
// but not if the parent is ICModel
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=202085
postRefresh(parent); postRefresh(parent);
return true; return true;
} }