ModelingPackage Class

 

When overridden in a derived class, represents the VSPackage for the Domain-Specific Language Designer.

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

System::Object
  Microsoft.VisualStudio.Shell::Package
    Microsoft.VisualStudio.Modeling.Shell::ModelingPackage

[ComVisibleAttribute(true)]
[CLSCompliantAttribute(false)]
public ref class ModelingPackage abstract : Package, IVsToolWindowFactory

NameDescription
System_CAPS_protmethodModelingPackage()

Initializes a new instance of the ModelingPackage class.

NameDescription
System_CAPS_pubpropertyApplicationRegistryRoot

(Inherited from Package.)

System_CAPS_pubpropertyLocator

Gets the model element locator, which locates modeling elements in the package.

System_CAPS_protpropertySetupMode

Gets the modeling package and verifies whether the Domain-Specific Language Designer is being set up.

System_CAPS_pubpropertyUserDataPath

(Inherited from Package.)

System_CAPS_pubpropertyUserLocalDataPath

(Inherited from Package.)

System_CAPS_pubpropertyUserRegistryRoot

(Inherited from Package.)

System_CAPS_pubpropertyZombied

(Inherited from Package.)

NameDescription
System_CAPS_protmethodAddOptionKey(String^)

(Inherited from Package.)

System_CAPS_pubmethodSystem_CAPS_staticAddOrReplaceToolboxItem(IToolboxService^, ModelingToolboxItemBase^)

Obsolete.Add a toolbox item if it is not present. Will replace an existing toolbox item if the item is already present

System_CAPS_protmethodAddToolboxItems(IEnumerable<ModelingToolboxItemBase^>^)

Add the passed collection of ModelingToolboxItemBase items into the Visual Studio toolbox.

System_CAPS_protmethodAddToolWindow(Type^)

Adds a tool window to the generated designer for a domain-specific language.

System_CAPS_pubmethodCreateInstance(Guid, Guid, Type^)

(Inherited from Package.)

System_CAPS_protmethodCreateLocator()

Creates a model element locator for the package.

System_CAPS_pubmethodCreateTool(Guid)

(Inherited from Package.)

System_CAPS_protmethodCreateToolboxItems()

Creates the items in the Toolbox.

System_CAPS_pubmethodCreateToolWindow(Guid, UInt32)

Creates a tool window.

System_CAPS_protmethodCreateToolWindow(Type^, Int32)

(Inherited from Package.)

System_CAPS_protmethodDispose(Boolean)

(Inherited from Package.)

System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodFindToolWindow(Type^, Int32, Boolean)

(Inherited from Package.)

System_CAPS_pubmethodFindWindowPane(Type^, Int32, Boolean)

(Inherited from Package.)

System_CAPS_protmethodGetAutomationObject(String^)

(Inherited from Package.)

System_CAPS_protmethodGetDialogPage(Type^)

(Inherited from Package.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetOutputPane(Guid, String^)

(Inherited from Package.)

System_CAPS_pubmethodGetProviderLocale()

(Inherited from Package.)

System_CAPS_protmethodGetService(Type^)

(Inherited from Package.)

System_CAPS_protmethodGetToolboxItemData(String^, DataFormats::Format^)

(Inherited from Package.)

System_CAPS_pubmethodGetToolWindow(Type^)

Gets a tool window.

System_CAPS_pubmethodGetToolWindow(Type^, Boolean)

Gets a tool window.

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodInitialize()

Initializes the ModelingPackage class.(Overrides Package::Initialize().)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethodOnLoadOptions(String^, Stream^)

(Inherited from Package.)

System_CAPS_protmethodOnSaveOptions(String^, Stream^)

(Inherited from Package.)

System_CAPS_protmethodOnToolboxInitialized(Object^, EventArgs^)

Event handler for ToolboxInitialized event The dynamic/custom toolbox items will be re-registered.

System_CAPS_protmethodOnToolboxUpgraded(Object^, EventArgs^)

Event handler for ToolboxUpgraded event The dynamic/custom toolbox items will be re-registered.

System_CAPS_protmethodParseToolboxResource(TextReader^, Guid)

(Inherited from Package.)

System_CAPS_protmethodParseToolboxResource(TextReader^, ResourceManager^)

(Inherited from Package.)

System_CAPS_protmethodQueryClose(Boolean)

(Inherited from Package.)

System_CAPS_protmethodRegisterEditorFactory(IVsEditorFactory^)

(Inherited from Package.)

System_CAPS_protmethodRegisterProjectFactory(IVsProjectFactory^)

(Inherited from Package.)

System_CAPS_protmethodSetupDynamicToolbox()

Refreshes the items in the Toolbox.

System_CAPS_pubmethodShowOptionPage(Type^)

(Inherited from Package.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_proteventToolboxInitialized

(Inherited from Package.)

System_CAPS_proteventToolboxUpgraded

(Inherited from Package.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIOleCommandTarget::Exec(Guid, UInt32, UInt32, IntPtr, IntPtr)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIOleCommandTarget::QueryStatus(Guid, UInt32, array<OLECMD>^, IntPtr)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceProvider::QueryService(Guid, Guid, IntPtr)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPackage::Close()

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPackage::GetAutomationObject(String^, Object^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPackage::GetPropertyPage(Guid, array<VSPROPSHEETPAGE>^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPackage::QueryClose(Int32)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPackage::ResetDefaults(UInt32)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPackage::SetSite(IServiceProvider^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPersistSolutionOpts::LoadUserOptions(IVsSolutionPersistence^, UInt32)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPersistSolutionOpts::ReadUserOptions(IStream^, String^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPersistSolutionOpts::SaveUserOptions(IVsSolutionPersistence^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsPersistSolutionOpts::WriteUserOptions(IStream^, String^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsToolboxItemProvider::GetItemContent(String^, UInt16, IntPtr)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsToolWindowFactory::CreateToolWindow(Guid, UInt32)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsUserSettings::ExportSettings(String^, IVsSettingsWriter^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsUserSettings::ImportSettings(String^, IVsSettingsReader^, UInt32, Int32)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIVsUserSettingsQuery::NeedExport(String^, Int32)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceContainer::AddService(Type^, Object^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceContainer::AddService(Type^, Object^, Boolean)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceContainer::AddService(Type^, ServiceCreatorCallback^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceContainer::AddService(Type^, ServiceCreatorCallback^, Boolean)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceContainer::RemoveService(Type^)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceContainer::RemoveService(Type^, Boolean)

(Inherited from Package.)

System_CAPS_pubinterfaceSystem_CAPS_privmethodIServiceProvider::GetService(Type^)

(Inherited from Package.)

You use this class to load a domain-specific language package, which registers an editor factory with Visual Studio. Visual Studio calls the editor factory, which creates the generated designer for the domain-specific language. In addition to registering editor factories, you can also use this class to register tool windows.

This class includes menu support at the package level. Packages that support tool windows are required to implement IVsToolWindowFactory.

The following example adds a tool window that is called Custom Tool Window to the generated designer. When you open your project in the generated designer, the tab for this window appears next to Solution Explorer. When you click the tab for your window, 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
{
    [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
{

    //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: