diff --git a/core/org.eclipse.cdt.ui/browser/ChangeLog-browser b/core/org.eclipse.cdt.ui/browser/ChangeLog-browser index d129843ca91..dd731cf164d 100644 --- a/core/org.eclipse.cdt.ui/browser/ChangeLog-browser +++ b/core/org.eclipse.cdt.ui/browser/ChangeLog-browser @@ -1,3 +1,8 @@ +2004-09-15 Chris Wiebe + + fixed selection + * browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypesView.java + 2004-09-15 Chris Wiebe fixed element navigation problems diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypesView.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypesView.java index d187e0e9d27..d7f76ac5ef6 100644 --- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypesView.java +++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/TypesView.java @@ -16,12 +16,9 @@ import org.eclipse.cdt.core.browser.TypeUtil; 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.IEnumeration; import org.eclipse.cdt.core.model.INamespace; import org.eclipse.cdt.core.model.ISourceRoot; -import org.eclipse.cdt.core.model.IStructure; import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.core.model.ITypeDef; import org.eclipse.cdt.internal.ui.ICHelpContextIds; import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.PreferenceConstants; @@ -216,20 +213,23 @@ public class TypesView extends CBrowsingPart { return null; } - if (element instanceof ICElement && !(element instanceof ITranslationUnit)) { - ICElement parent = (ICElement)element; - while (parent != null) { - if ((parent instanceof IStructure - || parent instanceof IEnumeration - || parent instanceof ITypeDef)) { - ITypeInfo info = AllTypesCache.getTypeForElement(parent, true, true, null); - return info; - } - parent = parent.getParent(); - } - return null; + if (element instanceof ICElement) { + ICElement celem = (ICElement) element; + if (celem instanceof ITranslationUnit) { + return null; + } else if (celem.getElementType() == ICElement.C_NAMESPACE) { + return null; + } else { + while (celem != null) { + ICElement parent = TypeUtil.getDeclaringType(celem); + if (parent == null || parent instanceof INamespace) { + return AllTypesCache.getTypeForElement(celem, true, true, null); + } + celem = parent; + } + } } - + if (element instanceof ITypeInfo) { ITypeInfo info = (ITypeInfo) element; if (info.getCElementType() != ICElement.C_NAMESPACE) {