ToolWindow Class

 

When overridden by a derived class, represents a tool window in the generated designer for a domain-specific language.

Namespace:   Microsoft.VisualStudio.Modeling.Shell
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Shell.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.Shell.12.0.dll)


[CLSCompliantAttribute(false)]
public ref class ToolWindow abstract : ModelingWindowPane

NameDescription
System_CAPS_protmethodToolWindow(IServiceProvider^)

Initializes a new instance of the ToolWindow class.

NameDescription
System_CAPS_pubpropertyActiveInPlaceEditWindow

Gets and sets the active window for in-place editing.(Inherited from ModelingWindowPane.)

System_CAPS_protpropertyBitmapIndex

When overriden in a derived class, gets the index of the bitmap that appears next to the name of the tool window.

System_CAPS_protpropertyBitmapResource

When overriden in a derived class, gets the resource ID of the bitmap that appears next to the name of the tool window.

System_CAPS_pubpropertyContent

(Inherited from WindowPane.)

System_CAPS_pubpropertyDocData

Gets a document in memory.

System_CAPS_protpropertyEnableUndo

Gets the tool window and enables the Undo command.

System_CAPS_pubpropertyFrame

Gets the IVsWindowFrame that corresponds to this window..(Inherited from ModelingWindowPane.)

System_CAPS_protpropertyHasSelectableObjects

Gets the tool window disables the Select Objects command if a document is not loaded.(Overrides ModelingWindowPane::HasSelectableObjects.)

System_CAPS_protpropertyHasToolBar

Gets the tool window and verifies whether it should have a toolbar.

System_CAPS_protpropertyHelpService

Gets the help service.(Inherited from ModelingWindowPane.)

System_CAPS_protpropertyInitializationMode

(Inherited from WindowPane.)

System_CAPS_pubpropertyMenuService

Gets the menu command service.(Inherited from ModelingWindowPane.)

System_CAPS_pubpropertyPrimarySelection

Gets the primary selected element in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_protpropertySelectedElements

Gets the elements that are selected in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_pubpropertySelectionCount

Gets the number of elements that are selected in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_protpropertySelectionHelpService

Gets the selection help service. (Inherited from ModelingWindowPane.)

System_CAPS_protpropertyServiceProvider

Gets the service provider that is local to this window pane.(Inherited from ModelingWindowPane.)

System_CAPS_protpropertyToolBarHost

Gets the IVsToolWindowToolbarHost interface, which determines how toolbars appear in the tool window.

System_CAPS_protpropertyToolWindowFont

Gets the font to use for the tool window.

System_CAPS_pubpropertyWindow

(Inherited from WindowPane.)

System_CAPS_pubpropertyWindowTitle

Gets the title of the tool window.

NameDescription
System_CAPS_protmethodCommitPendingEditForCommand(CommandID^)

When implemented in a derived class, specifies whether pending edits should be committed before a command is executed.(Inherited from ModelingWindowPane.)

System_CAPS_protmethodCountAllObjects()

Gets the number of elements in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodCountObjects(UInt32, UInt32)

Counts the number of elements in the window pane or in the current selection.(Inherited from ModelingWindowPane.)

System_CAPS_protmethodCountSelectedObjects()

Gets the number of elements in the current selection.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodDispose()

(Inherited from WindowPane.)

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the ToolWindow and optionally releases the managed resources.(Overrides ModelingWindowPane::Dispose(Boolean).)

System_CAPS_protmethodDoSelectObjects(UInt32, array<Object^>^, UInt32)

When implemented in a derived class, selects elements in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_protmethodGetAllObjects(UInt32, array<Object^>^)

Gets all elements in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodGetComponentSelected(Object^)

Specifies whether the given component is selected.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodGetContainerSelected(Object^)

Specifies whether the given container is selected.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetObjects(UInt32, UInt32, array<Object^>^)

Gets either the elements that are currently selected or the elements that can be selected in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodGetSelectedComponents()

Gets the components that are selected in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_protmethodGetSelectedObjects(UInt32, array<Object^>^)

Gets the elements that are selected in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_protmethodGetService(Type^)

Gets the service of the specified type. Override this method to return the custom menu command service(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodGetSite(Guid, IntPtr)

Gets the site that was set with SetSite.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodHide()

Hides the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_protmethodInitialize()

Initializes a new instance of the ToolWindow class.(Overrides WindowPane::Initialize().)

System_CAPS_pubmethodLoadUIState(Stream^)

(Inherited from WindowPane.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethodOnAfterToolWindowCreate()

Post-creation initialization.

System_CAPS_protmethodOnClose()

Removes window pane objects from the shortcut menu selection when the window pane is closed.(Inherited from ModelingWindowPane.)

System_CAPS_protmethodOnCreate()

Creates a tool window.(Overrides WindowPane::OnCreate().)

System_CAPS_protmethodOnDocumentWindowChanged(ModelingDocView^, ModelingDocView^)

Notifies derived classes if a user makes a change in the document window.

System_CAPS_protmethodOnSelectionChanged(EventArgs^)

Notifies event listeners after the selection changes.(Inherited from ModelingWindowPane.)

System_CAPS_protmethodOnSelectionChanging(EventArgs^)

Notifies event listeners before the selection changes.(Inherited from ModelingWindowPane.)

System_CAPS_protmethodOnToolWindowCreate()

Listens for frame changes in a document window

System_CAPS_protmethodPreProcessMessage(Message)

Handles window messages.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodSaveUIState(Stream^)

(Inherited from WindowPane.)

System_CAPS_pubmethodSelectObjects(UInt32, array<Object^>^, UInt32)

Selects elements in the window pane.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodSetSelectedComponents(ICollection^)

Adds the specified components into the selection container and notifies the shell of the selection change.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodSetSelectedComponents(ICollection^, SelectionTypes)

Not currently implemented.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodSetSite(Object^)

Initializes the window pane in the environment.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodShow()

Displays the window pane, brings it to the front, and makes it the active window.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodShowNoActivate()

Displays the window pane, brings it to the front, but does not make it the active window.(Inherited from ModelingWindowPane.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_pubeventSelectionChanged

Fired after the selection in the window pane has changed.(Inherited from ModelingWindowPane.)

System_CAPS_pubeventSelectionChanging

Fired before the selection in the window pane changes.(Inherited from ModelingWindowPane.)

Before you can add a tool window to the generated designer, you must register the window. For more information, see ModelingPackage.

The following example adds a tool window called Custom Tool Window to a domain-specific language project that is named RegisterTools. When you open your project in the generated designer, the tab for this window appears next to Solution Explorer. When you click this tab, a label that reads This is the custom tool window appears in the middle of the tool window.

This code registers the tool window:

using VSShellInterop = Microsoft.VisualStudio.Shell.Interop;
using VSShell = Microsoft.VisualStudio.Shell;
using DslShell = Microsoft.VisualStudio.Modeling.Shell;
using DslDesign = Microsoft.VisualStudio.Modeling.Design;
using VSTextTemplatingHost = Microsoft.VisualStudio.TextTemplating.VSHost;

namespace MS.RegisterTools.DslPackage
{
    [VSShell::ProvideToolWindowVisibility(typeof(CustomToolWindow), 
              Constants.RegisterToolsEditorFactoryId)]
    [VSShell::ProvideToolWindow(typeof(CustomToolWindow), 
              MultiInstances = false, 
              Style = VSShell::VsDockStyle.Tabbed, 
              Orientation = VSShell::ToolWindowOrientation.Right, 
              Window = "{3AE79031-E1BC-11D0-8F78-00A0C9110057}")]

    internal partial class RegisterToolsPackage
    {
        //Initializes the base class for the package
        protected override void Initialize()
        {
            base.Initialize();

            //Registers the custom tool window
            this.AddToolWindow(typeof(CustomToolWindow));
        }
    }
}

This code defines the tool window:

using System;
using System.Windows.Forms;
using VSShellInterop = Microsoft.VisualStudio.Shell.Interop;
using VSShell = Microsoft.VisualStudio.Shell;
using DslShell = Microsoft.VisualStudio.Modeling.Shell;
using DslDesign = Microsoft.VisualStudio.Modeling.Design;
using VSTextTemplatingHost = Microsoft.VisualStudio.TextTemplating.VSHost;

namespace MS.RegisterTools.DslPackage
{

    //Creates a tool window and gives it a title, icon, and label
    internal class CustomToolWindow : DslShell.ToolWindow
    {

        //defines a label
  private Label myLabel;

        //creates the tool window
  public CustomToolWindow(IServiceProvider serviceProvider) : base(serviceProvider)
  { 
  }

        //gets the icon for the tool window
        protected override int BitmapResource
        {
            get { return 104; }
        }

        //gets the index for the icon
        protected override int BitmapIndex
        {
            get { return 0; }
        }

        //gets the name of the tool window
        public override string WindowTitle
        {
            get { return "Custom Window"; }
        }

        //sets up a label
  protected override void OnToolWindowCreate()
  {
      this.myLabel = new Label();
this.myLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.myLabel.Text = "This is the custom tool window";
   }

        //puts a label on the tool window
  public override System.Windows.Forms.IWin32Window Window
  {
       get { return this.myLabel; }
  }
    }
}

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

Return to top
Show: