共用方式為


CodeWindowManager Class

Wraps an IVsCodeWindow object for use in a language service.

This API is not CLS-compliant. 

Inheritance Hierarchy

Object
  Microsoft.VisualStudio.Package.CodeWindowManager

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
<ComVisibleAttribute(True)> _
Public Class CodeWindowManager _
    Implements IVsCodeWindowManager
[CLSCompliantAttribute(false)]
[ComVisibleAttribute(true)]
public class CodeWindowManager : IVsCodeWindowManager
[CLSCompliantAttribute(false)]
[ComVisibleAttribute(true)]
public ref class CodeWindowManager : IVsCodeWindowManager
[<CLSCompliantAttribute(false)>]
[<ComVisibleAttribute(true)>]
type CodeWindowManager =  
    class 
        interface IVsCodeWindowManager 
    end
public class CodeWindowManager implements IVsCodeWindowManager

The CodeWindowManager type exposes the following members.

Constructors

  Name Description
Public method CodeWindowManager Initializes the CodeWindowManager class.

Top

Properties

  Name Description
Public property CodeWindow Returns the IVsCodeWindow this CodeWindowManager is managing.
Public property DropDownHelper Returns the drop-down helper class.
Public property LanguageService Returns the language service that owns this code window manager.
Public property Properties Allows retrieving and updating the document properties.
Public property Source Returns the Source object associated with the view managed by this code window manager class.

Top

Methods

  Name Description
Public method AddAdornments Called to add adornments or additional user interface (UI) elements to the text view.
Public method Close Close down the CodeWindowManager object.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize The destructor for the CodeWindowManager class. (Overrides Object.Finalize.)
Public method GetFilter Returns the ViewFilter object associated with the specified text view.
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method OnKillFocus Called when the specified text view loses focus.
Public method OnNewView Called when a new text view is created.
Public method OnSetFocus Called when the specified text view receives the focus.
Public method RemoveAdornments Called to remove any adornments on a text view that is being closed.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

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 Implementers

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 CodeWindowManager.OnSetFocus and CodeWindowManager.OnKillFocus (these are called indirectly through the ViewFilter class in its implementation of the IVsTextViewEvents interface).

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Package Namespace