Answered access from DSLPackage to VSPackage in vs shell 2010

  • Friday, April 06, 2012 4:13 AM
     
     

    Hello! I have got two packages in my vs shell 2010 :

    1)my own VSPackage designer to display some data using wpf elements 

    2)DSLPackage to build dsl models

    So,i want to access  from 2) code to 1) package data.How to organize this interaction?

    Thanks


    • Changed Type andreal90 Tuesday, April 17, 2012 3:14 AM
    •  

All Replies

  • Monday, April 09, 2012 5:32 AM
     
     

    The easiest way would be to move your logic and data from the VSPackage to the DSLPackage, including the WPF UI (by encapsulating it in a tool window, see Jean-Marc Prieur's excellent write-up for that).

    You would then have seamless integration between the two (including data binding), unless you have special reasons for keeping the VSPackage separate.


    - Ciper


  • Tuesday, April 10, 2012 3:10 PM
    Owner
     
     

    ... and if you do need to keep the packages separate, they can interoperate through Services. Basically you can provide a global service from one package and consume that service from the other.

    If you have further questions around working with services in VS, those are probably best directed to the general VS extensibility forum.

    Regards

    Blair

  • Tuesday, April 17, 2012 3:12 AM
     
     

    Thanks! And after use the sample with toolwindow , i have got a new quastion - how to bind a data from my custom file in the project from solution explorer to form of custom toolwindow?

    I want to click on my file from solution explorer and open it in toolwindow.

    Thanks.

  • Wednesday, April 18, 2012 9:16 AM
    Owner
     
     Answered

    That's a broader VS extensibility question that would need to continue in the general VS extensibility forum, but the basic mechanism is to register an editor factory for your file type. VS will then invoke this factory to create an editor instance when required. I suggest you start reading here: http://msdn.microsoft.com/en-us/library/bb166453.aspx

    As for opening a "document" in a tool window alone, I'm not sure that makes sense architecturally since tool windows are single windows that float or are docked. Normally you would have a document window as the main editor, one per open document/file instance, and then there may be tool windows that display and/or allow editing of certain aspects of the active document. You can see that the DSL Designer is structured in this way - you have the main design surface, that opens in the document well, and then a series of custom and standard tool windows such as the DSL Details tool window, DSL explorer, toolbox and property grid.

    Regards

    Blair