This sample demonstrates how to create a package that provides an Editor type extended with Toolbox support. In this sample we implement an editor for a .tbx file and construct toolbox items that are available for the document.
Goals
- Provide an editor factory.
- Document integration and persistence.
- Toolbox integration
- Handle source-controlled and read-only files.
This sample implements an editor for a ".tbx" plain text file. The actual UI of this designer is simply a RichTextBox control. This sample demonstrates how to implement integration with Visual Studio Toolbox within the Editor. The Editor uses SVsToolbox service and implements IVsToolboxUser in order to support Toolbox integration. It handles toolbox items availability and supports drag and drop text from the toolbox.
To start the sample:
- Build the solution
- Open Visual Studio under experimental hive by pressing F5
To test the samples functionality
- On the File menu, click New and then click File.
- In the Categories box, select Test Editor. In the Templates box, select Test Editor. Both come from the sample VSPackage. Then click Open. The VSPackage opens a new file tab with the embedded rich textbox.
- Click Toolbox from the View menu. Expand the Toolbox Test tab. As with all toolbox tabs, it has a Pointer tool. Drag the Toolbox Sample Item tool into the .tbx file window. NOTE: If your toolbox does not have a Toolbox Test tab or Toolbox Sample Item tool, make sure you have a .tbx file as the active file. The tab and tool are registered specifically to the .tbx file editor.
Additional Resources
Unit Tests:
- Verify that the package can be created and sited and that it is instantiates.
- Test exist for all command functions
- Test the factory properties
|