Exemple #1
0
 /// <summary>Implements the OnDisconnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being unloaded.</summary>
 /// <param term='disconnectMode'>Describes how the Add-in is being unloaded.</param>
 /// <param term='custom'>Array of parameters that are host application specific.</param>
 /// <seealso class='IDTExtensibility2' />
 public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
 {
     manager.ApplicationExit(false /* true */);
     customizator.Destroy();
     manager      = null;
     customizator = null;
 }
Exemple #2
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            if (manager == null)
            {
                customizator = new TytanCustomizator();
                manager      = new CustomAddInManager((DTE2)application, (AddIn)addInInst, customizator,
                                                      Assembly.GetExecutingAssembly());
                //if (connectMode != ext_ConnectMode.ext_cm_UISetup)
                customizator.Initialize(manager);

                // register all known refactoring IPackageActions:
                manager.Add(new InitConstructorRefactor());
                manager.Add(new ExtractPropertyRefactor());
                //manager.Add(new ExpandEnumRefactor());
                // manager.Add(new ExtractResourceRefactor());
                manager.Add(new AssignReorderRefactor());
                manager.Add(new MultiRenameRefactor());
                manager.Add(new InsertionGuidRefactor());
                manager.Add(new InsertionClassNameAction());
                manager.Add(new InsertionPathRefactor());
                manager.Add(new InsertionDatabaseRefactor());
                if (manager.Version == ShellVersions.VS2005)
                {
                    manager.Add(new OpenWindowsExplorer());
                }
                manager.Add(new VisualStudioCloseQuestion());
                manager.Add(new ReferenceProjectAction());

                // manager.Add(new NativeImagePreviewPackageTool());
                manager.Add(new CommandViewPackageTool());
                manager.Add(new RegistryViewPackageTool());
                manager.Add(new EnvironmentVarsPackageTool());
                manager.Add(new DebugViewPackageTool());

                manager.Add(new AboutBoxAction());
            }

            // initialize VS IDE commands:
            manager.ApplicationInit(true /* connectMode == ext_ConnectMode.ext_cm_UISetup */);
            customizator.AfterApplicationInit(true);
        }