Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / February 2005

Tip: Looking for answers? Try searching our database.

Find of Goto Definition, how can I implement?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WALDO - 04 Feb 2005 23:41 GMT
I have an add-in I'm developing that basically analyzes multiple projects'
codemodels in a solution.
It has a tree view and when you double-click a node representing a
codeelement, it should open the containing document of the codeelement and
navigate to the line and position it starts at. How can I determine the
codeelement, given some basic information? I don't mind iterating until I
do/don't find my item. I would just like an idea where to start.

Given the following string:
TestHGrid: M:TestHGrid.TestIHGrid.#ctor(System.Drawing.Color)

I know that this is in the project TestHGrid. Can I reference that project
using:
Dim proj As Project = Me._applicationObject.Solutions.Item("TestHGrid")
? Will that give me a reference to the project I want, or do I have to
iterate?

What if there are two projects named TestHGrid in my solution? Hadn't
thought of that until just now.

I know that this method is a constructor (In VB.Net, Sub New()) that takes a
single Color object as a parameter.
I know that it has two parent objects, TestIHGrid and TestHgrid,
respectively, which could be namespaces, classes, interfaces, modules, etc
(which I don't definitively know).

Should I just iterate over the codemodel eleemts looking for matches by name
(which if anything is overloaded, could produce duplicates), or is there a
more intuitive way?

Once I know the codeelement, it is easy enough to get the StartPoint. How do
I navigate to it, once I have that?

Any help is appreciarted.
Thanks in advance.

WALDO
Carlos J. Quintero [.NET MVP] - 07 Feb 2005 11:09 GMT
The short answer is that in VS.NET everything is recursive and therefore you
have to iterate. Even projects can be nested (Enterprise projects of the
Enterprise Edition of VS.NET come to my mind).

Projects have a UniqueName property, just in case 2 projects have the same
name.

For code elements, you must use the CodeElement.FullName, which is unique.

Once you have a CodeElement you can use either CodeElement.StartPoint or
CodeElement.GetStartPoint(part). Then you can use the EditPoint.TryToShow
method.

Signature

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com

>I have an add-in I'm developing that basically analyzes multiple projects'
> codemodels in a solution.
[quoted text clipped - 36 lines]
>
> WALDO

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.