This project is read-only.
Implementing and launching custom actions to configure the environment based on the end-user configuration

Whoever is configuring your feature model can launch actions provided by you. For example, imagine that if someone selects the Joystick input feature when configuring a feature model for games, then a new class or method is added to the current project in order to help the developer to handle joystick input.

How to implement a Confeaturator Action Provider?

1. Create a new class library project.

2. Add a reference to the UFPE.FeatureModelDSL.DslPackage.dll assembly. This assembly can be found at %localappdata%\Microsoft\VisualStudio\10.0\Extensions\UFPE\FeatureModelDSL\ (change the visual studio version in this path if using VS 2008). If the UFPE folder can't be found under the Extensions folder, search for the UFPE.FeatureModelDSL.DslPackage.dll assembly once in the Extensions folder.

3. Create a class that implements the UFPE.FeatureModelDSL.Confeaturator.IConfeaturatorActionProvider interface. This interface defines a method called PerformConfeaturatorAction, which receives the list of the features selected by the user in the Confeaturator tool window, as well as the DTE object used to manipulate the Visual Studio environment. Detailing the DTE features is out of the scope of this project - if you want more details, you can check the Professional Visual Studio Extensibility book.

In the example below, if the Joystick feature is selected, a new class file JoystickHandler.cs is added to the solution.


How to consume a Confeaturator Action Provider?

1. Right-click the project which hosts the feature model files (.fm), select Add, Existing Item, then browse to the location of the .dll created in the steps above (How to implement a Confeaturator Action Provider?).

2. In the Confeaturator tool window, click in the Add / Remove Confeaturator Action Providers button, click in Find, expand the node of the aforementioned dll, and select the class that implements the IConfeaturatorActionProvider interface.


3. Back to the Confeaturator tool window, click in the Launch Confeaturator Actions to configure the environment button. This will invoke the implementation of the PerformConfeaturatorAction method from the class you selected in step 2 just above.

Last edited Apr 30, 2012 at 4:32 AM by AFurtado, version 4


No comments yet.