index > Visual Studio Team System - Domain-Specific Language Tools > DSL interacting with VS project system.

DSL interacting with VS project system.


I've been hitting the DSL trail hard over the last couple weeks and have some designers and code generaters that would be of tremendous value to me if I could figure out how to get my model to interace with DEVENV and interact with project files, references, Types, or other language elements already in the solution.

For instance, I would like to be able to define a property "type" that has to provide a UITypeEditor capable of browsing the the project in a similar way that the Class View operates to enable the user to reference and datatype a property without having to manually type it in.

In another case, I would like to be able to add or remove files to the project in response to user actions within the DSL such as automatically (or through a command) add partial classes to the solution to add custom code to the generated code.

I know that the model can't really respond to events that occur within the ide, but I would like to be able to command the ide to do things in response to the model.

I hope that makes sense.

Aaron

Aaron Anderson

Aaron,

You can get a reference to the COM Visual Studio extensibility model with the following line of code:

EnvDTE.DTE dte = MyLanguagePackage.GetGlobalService(typeof(EnvDTE._DTE)) as EnvDTE.DTE;

You will also need to add a reference to [Program Files]Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\EnvDTE.dll. This should let you walk the solutions and projects hierarchy to build up a project tree in your UITypeEditor.

You can also use "[MyLanguage]Package.GetGlobalService" / "ServiceProvider.GetService" to get at other Visual Studio services, such as e.g. IVsMonitorSelection. This would let you register for notifications when changes occur in the IDE (although if you are doing this, make sure that it is your DslPackage that is handling the notifications, not the Dsl itself).

Searching in this forum for GetService / GetGlobalService will bring up examples of what other people are doing. One of those postings (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=252142&SiteID=1) covers programmatically adding files to a project.

Duncan

DuncanP
reply 2

You can use google to search for other answers

 

More Articles

How to move shapes within diagram programmatically???
Is DSL development a language driven development?
Customising standard context menu items
More than one Diagram / File - Extension for a single model?
How To Navigate over Links
Administrator priviliges required
Upgrade bug: Only 8.1 version of TextTemplating available on upgr...
No more RedistInstallDir registry value in Feb. 2006 DSLToolsRedi...
Deployment - template doesn't appear under project types
"Static" Swimlanes
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Package Load Failure
Language name has to start with capital …
How to generate Hashtable like collection?
Feedback
.tt files shouldn't be copyrighted
Catch On Properties Change Event
End-to-end samples and updated customiza…
How to get a programmatic reference on t…
Problem Extending Notation with icons
Can we host DSL designer in a custom hos…
Stability of Modeling API
tutorial
Adding/Removing elements in domain model
Any Practical Limits on Model Size?
Custom connector target (June CTP)

Hot Articles

Migrating .diagram files to V1 (Septembe…
Problem loading different models in Dire…
designer definition toolbox item - compa…
How are new objects created in a DSL?
Compartment Shape Equivalents
DMD -> DD
Adding/Removing elements in domain model
Error creating DSL setup project (empty …
Bugs (?) in July version
How to get a reference to a model within…
Mouse click in the Domain-Specific Langu…
Unable to Replace Old Files by New ones
Using a Template to iterate on all model…
DSL Tools V1 Released
Self-contained Embedding

Recommend Articles

Controlling and detecting what elements …
.tt files shouldn't be copyrighted
blog post suggestions: mdfddt/mdfomt fil…
Designer and File Associations
How to make the connector text parallel …
Error Creating DSL Designer Project
Question on using the domain model desig…
Tool support for designer definition?
Join the World's Largest Software Factor…
Shape Icon and Shape Tool Minor Bug
Can I Generate Code with CodeDom in the …
Generate a Domain Model during Debugging
Suggestion - Context Menu: Override Beha…
2 problems with V1 release
IE7 Beta 2 and DSL Tools