次の方法で共有


Editor Design Decisions

As outlined in Types of Editors, you can choose different types of editors for your VSPackage depending on its needs. But which one is the right one to use? The following design questions will help answer this question and narrow down the type of editor best suited to your VSPackage:

  • Will your project save its data in files or not? If it will save its data in files, will they be in a custom or standard format?

    If you use a standard file format, other project types in addition to your project will be able to open and read/write data to them. If you use a custom file format, however, only your project type will be able to open and read/write data to them.

    If your project uses files, then you should create a standard editor. If your project does not use files, but rather uses items in a database or other repository, then you should create a custom editor.

  • Does your editor need to host ActiveX controls?

    If your editor hosts ActiveX controls, then implement an in-place activation editor, as outlined in In-Place Activation. If it does not host ActiveX controls, then either use a simplified embedding editor, or customize the Visual Studio core editor, which is an implementation of a simplified embedding editor. For more information, see Document Windows and Editors and Core Editor.

  • Will your editor support multiple views, meaning, your editor's view can be visible at the same time that the core editor is visible?

    If your editor needs to support multiple views, the document data and document view objects for the editor must be separate objects. For more information, see Supporting Multiple Document Views.

    If your editor supports multiple views, do you plan to use the Visual Studio core editor's text buffer implementation (VsTextBuffer object) for your document data object? That is, do you want to support your editor view side-by-side with the Visual Studio core editor? The ability to do this is the basis of the forms designer and is demonstrated in the Figures Edit sample. For more information, see Text Buffer for the Visual Studio Editor and Figures Edit.

  • Do you need to host an editor from another application that is outside of Visual Studio? Can the editor be embedded, meaning, can it be used inside Visual Studio?

    If it can be embedded, you should create a host window for the external editor and then call the IsDocumentInProject method and set the VSDOCUMENTPRIORITY enumeration value to DP_External. If the editor cannot be embedded, the IDE will automatically create a separate window for it.

See Also

Concepts

Project Types

Document Windows and Editors

Core Editor