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 / September 2005

Tip: Looking for answers? Try searching our database.

Open a misc document from ToolWindow

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SWu - 07 Sep 2005 23:36 GMT
Hi,

Is it possible to open a misc document from a ToolWindow?

It seems I should be able to use the method
VsShellUtilities.OpenDocumentWithSpecificEditor, but I don't really have a
IServiceProvider in the ToolWindow.

Can anyone help?

Thanks,
Shirley
"Gary Chang[MSFT]" - 08 Sep 2005 10:49 GMT
Hi Shirley,

>It seems I should be able to use the method
>VsShellUtilities.OpenDocumentWithSpecificEditor,
>but I don't really have a IServiceProvider in the ToolWindow.

Based on my understanding, you need to create a specific editor in your
package's ToolWindow to open a misc document,  please correct me know if I
have misunderstood anything.

If so, since your ToolWindow class doesn't have an IServiceProvider
interface, but its parent package has it, how about use the package's
IServiceProvider to get the VsShellUtilities object...

Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Oliver Sturm - 08 Sep 2005 11:16 GMT
>Is it possible to open a misc document from a ToolWindow?
>
>It seems I should be able to use the method
>VsShellUtilities.OpenDocumentWithSpecificEditor, but I don't really have a
>IServiceProvider in the ToolWindow.

Your package is derived from Microsoft.VisualStudio.Shell.Package, I
assume. This class implements IServiceProvider, so you should be able to
pass it in to the OpenDocumentWithSpecificEditor method.

               Oliver Sturm
Signature

Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

"Ed Dore [MSFT]" - 09 Sep 2005 21:37 GMT
Hi Shirley,

All toolwindows get an IServiceProvider. When a toolwindow is created, it's
IVsWindowPane.SetSite implementation is called with an IOleServiceProvider
that you can call QueryService on. I suspect you're using the new package
wizard generated stuff though, so it's not really obvious how to do this.

A toolwindow implemented with MPF, is typically derived from a
ToolWindowPane object that has a GetService method on it. So you can call
this method to retrieve any specific type of service you require (provided
it's available).

That all being said, it's unclear what exactly you are attempting to do. If
you are simply looking for a way to open a document FROM your toolwindow,
you can use the DTE automation object's ExecuteCommand() or
ItemOperations.FileOpen().

To retreive the DTE object, you just need to call GetService(typeof(_DTE)).

If you are actually talking about implementing/displaying an editor within
the confines of your own toolwindow, there is no support for that. You can
create and parent the core text editor off of your own toolwindow, but
generally speaking other editors won't take to kindly to being parented on
a toolwindow, unless they've actually specifically been designed to support
that).

Sincerely,
Ed Dore [MSFT]

This post is 'AS IS' with no warranties, and confers no rights.

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.