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 / April 2006

Tip: Looking for answers? Try searching our database.

Obtaining object information

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
slush_puppy - 24 Apr 2006 01:57 GMT
I'm trying to find a way to get object information very similar to what
can be found in the object browser.  I found the SVsObjBrowser service,
but all you can do with it is have it navigate somewhere... you can't
ask it for infomation.  UIHierarchy (class view, solution explorer)
doesn't seem to offer this information, yet seems to use a service that
provides it.

How do I go about getting the kind of information that object browser
has?  There must be some service used by intellisense/object
browser/UIHierarchy that allows them to look up their information so
quickly, and I have a hard time believeing that they all implement this
independently.  Is there some sort of object service with all of the
reflected information stored in it, and if so, how can I query it for
information?
Stuart Carnie - 24 Apr 2006 07:21 GMT
On option is to use the Automation interfaces.  Look up the FileCodeModel interface and it's related interfaces.  FileCodeModel is
a property of the ProjectItem interface.  A ProjectItem represents a node in you project tree.

In your add-in or package, you can get the selected ProjectItem by calling
ProjectItem item = serviceProvider.GetService(typeof(ProjectItem))

You can get the Project interface of your hierarchy by calling:
GetProperty((uint)VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out extObj));
EnvDTE.Project project = extObj as EnvDTE.Project;

Then from the Project interface, you can enumerate all the ProjectItem objects, and their respective FileCodeModel.

I don't think the Object Browser uses the FileCodeModel - I believe it is using reflection and metadata directly from the assemblies.

The SVsObjectManager looks promising, but I have not used it.

Cheers,

Stu

> I'm trying to find a way to get object information very similar to what
> can be found in the object browser.  I found the SVsObjBrowser service,
[quoted text clipped - 10 lines]
> reflected information stored in it, and if so, how can I query it for
> information?
slush_puppy - 24 Apr 2006 13:38 GMT
Yeah, I'm using the code model right now for the "in-project" stuff,
but I want to be able to get the same type of information for all of
the included references, etc... just like intellisense has at its
fingertips.  It seems like a huge waste of memory for all of the
features that need that information to all have their own cache/lookup
for them, so I figured that VS would have some sort of package that
offered that service.  It seems like such a good idea for a service,
something that lots of other packages need.

FWIW, Class View, Solution Explorer and Objects Browser all give full
reflection details without the existence of any assemblies, so they
must use the code model as well.  I believe that CV and SE use
UIHierarchy and OB is just it's own service.

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.