diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandle.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandle.java index 4060d919a56..bd127b9382d 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandle.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/CElementHandle.java @@ -212,14 +212,6 @@ abstract class CElementHandle implements ICElementHandle, ISourceReference { return false; } - public boolean isConstructor() throws CModelException { - return false; - } - - public boolean isDestructor() throws CModelException { - return false; - } - public boolean isInline() throws CModelException { return false; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/MethodHandle.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/MethodHandle.java index 03c9937dbaa..a80361ac1b4 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/MethodHandle.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ext/MethodHandle.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.model.ext; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.dom.ast.DOMException; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; @@ -26,16 +27,20 @@ public class MethodHandle extends CElementHandle implements IMethod { private String[] fParameterTypes; private ASTAccessVisibility fVisibility; private boolean fIsStatic; - + private boolean fIsConstructor; + private boolean fIsDestructor; + public MethodHandle(ICElement parent, ICPPMethod method) throws DOMException { super(parent, ICElement.C_METHOD, method.getName()); fParameterTypes= extractParameterTypes(method); fVisibility= getVisibility(method); try { fIsStatic= method.isStatic(); + fIsConstructor= method instanceof ICPPConstructor; + if (!fIsConstructor) + fIsDestructor= method.isDestructor(); } catch (DOMException e) { CCorePlugin.log(e); - fIsStatic= false; } } @@ -66,4 +71,12 @@ public class MethodHandle extends CElementHandle implements IMethod { public ASTAccessVisibility getVisibility() throws CModelException { return fVisibility; } + + public boolean isConstructor() throws CModelException { + return fIsConstructor; + } + + public boolean isDestructor() throws CModelException { + return fIsDestructor; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexName.java index 8405b84c159..ab0efd73559 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexName.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IIndexName.java @@ -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 @@ -63,4 +63,9 @@ public interface IIndexName extends IName { */ public IIndexName[] getEnclosedNames() throws CoreException; + /** + * Returns whether a declaration is a base-class specifier. + */ + public boolean isBaseSpecifier() throws CoreException; + } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java index b85edff8777..f12e7eda820 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THHierarchyModel.java @@ -274,7 +274,7 @@ public class THHierarchyModel { try { IBinding binding = IndexUI.elementToBinding(index, elem); if (binding instanceof ICPPClassType) { - IIndexName[] names= index.findNames(binding, IIndex.FIND_ALL_OCCURENCES); + IIndexName[] names= index.findNames(binding, IIndex.FIND_REFERENCES); for (int i = 0; i < names.length; i++) { if (monitor.isCanceled()) { return; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THViewPart.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THViewPart.java index 922e9182f06..08de76826d1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THViewPart.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/THViewPart.java @@ -74,6 +74,7 @@ import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.IDeclaration; import org.eclipse.cdt.core.model.IMember; +import org.eclipse.cdt.core.model.IMethodDeclaration; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.refactoring.actions.CRefactoringActionGroup; import org.eclipse.cdt.ui.CUIPlugin; @@ -429,6 +430,16 @@ public class THViewPart extends ViewPart { ICElement celem= (ICElement)element; switch (celem.getElementType()) { case ICElement.C_FIELD: return 1; + case ICElement.C_METHOD: + case ICElement.C_METHOD_DECLARATION: + IMethodDeclaration md= (IMethodDeclaration) celem; + try { + if (md.isConstructor()) return 2; + if (md.isDestructor()) return 3; + } catch (CModelException e) { + CUIPlugin.getDefault().log(e); + } + break; } } return 10; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java index fb922ee7251..8a299462ab4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/typehierarchy/TypeHierarchyUI.java @@ -205,8 +205,6 @@ public class TypeHierarchyUI { case ICElement.C_STRUCT_DECLARATION: case ICElement.C_UNION_DECLARATION: // case ICElement.C_TYPEDEF: -// case ICElement.C_CLASS_CTOR: -// case ICElement.C_CLASS_DTOR: // case ICElement.C_FIELD: // case ICElement.C_METHOD: // case ICElement.C_METHOD_DECLARATION: