Partilhar via


CodeWindowManager Class

Definition

Important

This API is not CLS-compliant.

CodeWindowManager provides a default implementation of the VSIP interface IVsCodeWindowManager and manages the LanguageService, Source, ViewFilter, and DocumentProperties objects associated with the given IVsCodeWindow. It calls CreateViewFilter on your LanguageService for each new IVsTextView created by Visual Studio and installs the resulting filter into the command chain. You do not have to override this method, since a default view filter will be created. If your LanguageService returns an object from CreateDocumentProperties then you will have properties in the Properties Window associated with your source files. The CodeWindowManager also provides support for optional drop down combos in the IVsDropdownBar for listing types and members by installing the TypeAndMemberDropdownBars object returned from your LanguageService CreateDropDownHelper method. The default return from CreateDropDownHelper is null, which results in no drop down combos.

public ref class CodeWindowManager : Microsoft::VisualStudio::TextManager::Interop::IVsCodeWindowManager
[Windows::Foundation::Metadata::WebHostHidden]
class CodeWindowManager : Microsoft::VisualStudio::TextManager::Interop::IVsCodeWindowManager
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
public class CodeWindowManager : Microsoft.VisualStudio.TextManager.Interop.IVsCodeWindowManager
[System.Runtime.InteropServices.ComVisible(true)]
public class CodeWindowManager : Microsoft.VisualStudio.TextManager.Interop.IVsCodeWindowManager
[<System.CLSCompliant(false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type CodeWindowManager = class
    interface IVsCodeWindowManager
[<System.Runtime.InteropServices.ComVisible(true)>]
type CodeWindowManager = class
    interface IVsCodeWindowManager
Public Class CodeWindowManager
Implements IVsCodeWindowManager
Inheritance
CodeWindowManager
Attributes
Implements

Remarks

This class provides a default implementation of the VSIP interface, IVsCodeWindowManager and manages the LanguageService, Source, ViewFilter, and DocumentProperties objects associated with the given IVsCodeWindow.

This class calls CreateViewFilter on your LanguageService for each new IVsTextView created by Visual Studio and installs the resulting filter into the command chain. You do not have to override CreateViewFilter, since a default view filter will be created.

If your LanguageService returns an object from CreateDocumentProperties then you will have properties in the Properties window associated with your source files.

This class also provides support for optional drop-down combo boxes (also known as drop-down bars), as represented by the IVsDropdownBar interface, for listing types and members by installing the TypeAndMemberDropdownBars object returned from your CreateDropDownHelper method. If you do not implement CreateDropDownHelper, no drop down-bars are established.

Notes to Inheritors

If you need to add any user interface (UI) features to the view window, you can derive a class from the CodeWindowManager class and override the methods AddAdornments() and RemoveAdornments(); just be sure to call the base class versions of those methods in your implementations. Otherwise, the base class handles all normal chores associated with a language service.

Notes to Callers

The LanguageService class maintains a list of CodeWindowManagers, one instance for each text view or open source file. The only methods called by Visual Studio are AddAdornments() and RemoveAdornments() (these are called directly) and OnSetFocus(IVsTextView) and OnKillFocus(IVsTextView) (these are called indirectly through the ViewFilter class in its implementation of the IVsTextViewEvents interface).

Constructors

CodeWindowManager(LanguageService, IVsCodeWindow, Source)

The CodeWindowManager is constructed by the base LanguageService class when VS calls the IVsLanguageInfo.GetCodeWindowManager method. You can override CreateCodeWindowManager on your LanguageService if you want to plug in a different CodeWindowManager.

Properties

CodeWindow

Return the IVsCodeWindow associated with this code window manager.

DropDownHelper

Return the optional TypeAndMemberDropdownBars object for the drop down combos

LanguageService

Returns the LanguageService object that created this code window manager

Properties

Returns the DocumentProperties, if any. You can update this property if you want to change the document properties on the fly.

Source

returns the Source object associated with the IVsTextLines buffer for this code window

Methods

AddAdornments()

Install the optional TypeAndMemberDropdownBars, and primary and secondary view filters

Close()

Closes all view filters, and the document properties window

Finalize()

The destructor for the CodeWindowManager class.

GetFilter(IVsTextView)

Returns the ViewFilter for the given view or null if no matching filter is found.

OnKillFocus(IVsTextView)

Called when the specified text view loses focus.

OnNewView(IVsTextView)

Install a new view filter for the given view. This method calls your CreateViewFilter method.

OnSetFocus(IVsTextView)

Refresh the document properties

RemoveAdornments()

Remove drop down combos, view filters, and notify the LanguageService that the Source and CodeWindowManager is now closed

Applies to