views:

92

answers:

2

Visual studio 2010 has added a call heirarchy function. Does anyone know if it is possible to access this from within a plugin?

A: 

You can try adding a reference to \Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.VisualStudio.CallHierarchy.Package.Definitions.dll and importing the ICallHierarchy service.

ICallHierarchy allows you to:

public interface ICallHierarchy
{
    void AddRootItem(ICallHierarchyMemberItem item);
    void ShowToolWindow();
}

You might also need other Call Hierarchy .dlls:

  • Microsoft.VisualStudio.CallHierarchy.Package.Implementation.dll
  • Microsoft.VisualStudio.Language.CallHierarchy.dll
  • Microsoft.VisualStudio.Language.CallHierarchy.Implementation.dll
Kirill Osenkov
This seems pretty close as I can see the interface definitions I need in the Language.CallHierarchy dll. However if I try to add the implementation dll as a reference it won't add it to the project. How do I get create some concrete objects in order to actually do some work?
Matt Breckon
You can implement ICallHierarchyMemberItem yourself, create your own object and add it to the Call Hierarchy toolwindow as a root. From there, WPF will use databinding to display your object in the tree. It can have children, Name, etc.
Kirill Osenkov
Ah, that wasn't quite what I wanted - I probably didn't specify it enough in the question, but I was hoping to be able to get Visual Studio to do the parsing of the code hierarchy and return the list for me
Matt Breckon
A: 

Did you ever find a solution to this problem Matt?

Stephen Ellis
No, sorry. I seem to remember concluding that it wasn't possible as it seemed the information was buried too deep in the VS components to be able to extracted. If you do manage to find a definitive answer please do update this question
Matt Breckon

related questions