1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Fix for 184748: Binaries container not updated in Project Explorer

This commit is contained in:
Anton Leherbauer 2007-05-02 13:31:33 +00:00
parent 4443451c11
commit 51f0803459
2 changed files with 35 additions and 18 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006 Wind River Systems, Inc. and others.
* Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -37,6 +37,7 @@ import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.PreferenceConstants;
@ -347,24 +348,40 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
return false;
}
protected void postContainerRefresh(final IParent container, final ICProject cproject) {
postRefreshable(new RefreshContainer(container, cproject.getProject()));
}
protected void postRefresh(final Object element) {
if (element instanceof ICModel) {
super.postRefresh(fRealInput);
return;
} else if (element instanceof ICProject) {
super.postRefresh(((ICProject)element).getProject());
} else {
super.postRefresh(element);
}
super.postRefresh(element);
}
protected void postAdd(final Object parent, final Object element) {
if (parent instanceof ICModel) {
super.postAdd(fRealInput, element);
return;
} else if (parent instanceof ICProject) {
super.postAdd(((ICProject)parent).getProject(), element);
} else {
super.postAdd(parent, element);
}
super.postAdd(parent, element);
}
protected void postRemove(final Object element) {
postRefresh(internalGetParent(element));
}
protected void postProjectStateChanged(final Object element) {
if (element instanceof ICModel) {
super.postProjectStateChanged(fRealInput);
} else if (element instanceof ICProject) {
super.postProjectStateChanged(((ICProject)element).getProject());
} else {
super.postProjectStateChanged(element);
}
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -300,31 +300,31 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
// We keep track of what we're going to refresh and avoid posting multiple refresh
// messages for the same elements. This avoids major performance issues where
// we update tree views hundreds or thousands of times.
interface IRefreshable {
protected interface IRefreshable {
public void refresh();
}
final class RefreshContainer implements IRefreshable {
protected final class RefreshContainer implements IRefreshable {
private IParent container;
private ICProject cproject;
public RefreshContainer(IParent container, ICProject cproject) {
private Object project;
public RefreshContainer(IParent container, Object project) {
this.container = container;
this.cproject = cproject;
this.project = project;
}
public void refresh() {
if (container.hasChildren()) {
if (fViewer.testFindItem(container) != null) {
fViewer.refresh(container);
} else {
fViewer.refresh(cproject);
fViewer.refresh(project);
}
} else {
fViewer.refresh(cproject);
fViewer.refresh(project);
}
}
public boolean equals(Object o) {
if (o instanceof RefreshContainer) {
RefreshContainer c = (RefreshContainer)o;
return c.container.equals(container) && c.cproject.equals(cproject);
return c.container.equals(container) && c.project.equals(project);
}
return false;
}
@ -332,7 +332,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
return container.hashCode()*10903143 + 31181;
}
}
final class RefreshElement implements IRefreshable {
protected final class RefreshElement implements IRefreshable {
private Object element;
public RefreshElement(Object element) {
this.element = element;
@ -362,7 +362,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
}
}
final class RefreshProjectState implements IRefreshable {
protected final class RefreshProjectState implements IRefreshable {
private Object element;
public RefreshProjectState(Object element) {
this.element = element;
@ -391,7 +391,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
}
protected void postRefresh(final Object element) {
//System.out.println("UI refresh:" + root);
//System.out.println("UI refresh:" + element);
postRefreshable(new RefreshElement(element));
}
@ -409,7 +409,7 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
postRefreshable(new RefreshProjectState(root));
}
private void postRefreshable(final IRefreshable r) {
protected final void postRefreshable(final IRefreshable r) {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
if (pendingRefreshes.contains(r))