Editor window from the own tool window RRS feed

  • Question

  • 1 .what is the best way to get editor window by clicking the File in  Tool window similar to the solution exlporer ?

    2 .Files in the toolwindow are binded from the webservice,there is no physical file in the local system.as shown in the below figure..

    Thanks in advance..

    Thursday, April 30, 2015 11:55 AM

All replies

  • Hi,

    I think the easiest way is to use DTE: Simply call something like this inside your serviceprovider:

    DTE = GetService(typeof (SDTE)) as DTE;

    However, how this plays with your second point, I do not know. I could imagine that things get really complicated, as you need to implement your own EditorFactory, and provide some "fake" (in the sense that there is no physical file) Source object to the Visual Studio interfaces. Or maybe you manage to save the file to disk before opening it. By listening to the respective document handlers, you can synchronize changes with the web. Hope that helps.


    Friday, May 1, 2015 7:56 PM
  • When files are opened (or an editor/designer is invoked), it's always associated with project hierarchy and project item. If you have an actual file, and you do something like "DTE.ItemOperations.OpenFile", if the file is in a project, it's opened with that projects hierarchyinterface and item id. In all other instances, the file gets opened in the miscellaneous project (which is usually hidden in the solution explorer).

    Note, there's an option in the Tools.Options dialog to turn it on.

    But that's probably neither here nor there. From what you describe, (launching an editor from a toolwindow), you'll most likely need to have your toolwindow implement a minimal IVsHierarchy implementation, so as to provide the IVsHierarchy, itemID, and an IVsHierarchy.GetProperty implementation (among others).

    Then use IVsUIShellOpenDocument::OpenSpecificEditor or similar to launch your editor.


    Ed Dore

    Friday, May 1, 2015 10:47 PM
  • Hi,

    I have achieved it by using OpenDocumentViaProjectWithSpecific().


    I have one more problem,

    I want to persist the editor tab and its Data(importantly) in the editor tab between the visual studio sessions,as it is shown in the above image each tab contains some diffrent data.

    Thanks in advance..

    Thursday, May 7, 2015 1:46 PM