Exemple #1
0
 public DebuggerHook(DTE2 applicationObject, AddinController controller, IViewAdapter viewAdapter, IDsmSettingsManager settingsManager)
 {
     _settingsManager   = settingsManager;
     _viewAdapter       = viewAdapter;
     _controller        = controller;
     _applicationObject = applicationObject;
 }
Exemple #2
0
 public DebuggerHook(DTE2 applicationObject, AddinController controller, IViewAdapter viewAdapter, IDsmSettingsManager settingsManager)
 {
     _settingsManager = settingsManager;
       _viewAdapter = viewAdapter;
       _controller = controller;
       _applicationObject = applicationObject;
 }
Exemple #3
0
        public AddinController GetAddinController(DTE2 dteApplicationObject)
        {
            if (_addinController == null)
            _addinController = new AddinController(GetISessionManager(), GetIDsmSettingsManager(), GetIViewAdapter(dteApplicationObject),
              GetIDteAdapter(dteApplicationObject), GetIExceptionManager());

              return _addinController;
        }
Exemple #4
0
        public AddinController GetAddinController(DTE2 dteApplicationObject)
        {
            if (_addinController == null)
            {
                _addinController = new AddinController(GetISessionManager(), GetIDsmSettingsManager(), GetIViewAdapter(dteApplicationObject),
                                                       GetIDteAdapter(dteApplicationObject), GetIExceptionManager());
            }

            return(_addinController);
        }
Exemple #5
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)
        {
            try
            {
                if ((disconnectMode == ext_DisconnectMode.ext_dm_HostShutdown) || (disconnectMode == ext_DisconnectMode.ext_dm_UserClosed))
                {
                    if (_debugHook != null)
                    {
                        _debugHook.UnHook();
                    }

                    AddinController.NotifyPluginUnloaded();

                    foreach (var control in _controlsCreated)
                    {
                        try
                        {
                            control.Delete(true);
                        }
                        catch
                        {
                        }
                    }

                    if (managerToolbar != null)
                    {
                        try
                        {
                            if (managerToolbar.Position != null)
                            {
                                _settingsManager.DsmSettings.ToolBarPosition = managerToolbar.Position.ToString();
                            }
                            _settingsManager.DsmSettings.ToolBarRowIndex = managerToolbar.RowIndex;
                            _settingsManager.DsmSettings.ToolBarVisible  = managerToolbar.Visible;
                            _settingsManager.DsmSettings.ToolBarTop      = managerToolbar.Top;
                            _settingsManager.DsmSettings.ToolBarLeft     = managerToolbar.Left;
                            //_settingsManager.DsmSettings.ToolBarWidth = managerToolbar.Width;
                            //_settingsManager.DsmSettings.ToolBarHeight = managerToolbar.Height;

                            _settingsManager.SaveSettings();
                        }
                        finally
                        {
                            managerToolbar.Delete();
                            managerToolbar = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _exceptionManager.HandleException(ex);
            }
        }
Exemple #6
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)
        {
            try
            {
                _applicationObject = (DTE2)application;

                _addInInstance = (AddIn)addInInst;

                var container = new Container();

                _exceptionManager = container.GetIExceptionManager();

                _controller = container.GetAddinController(_applicationObject);

                _debugHook = container.GetDebugHook(_applicationObject);
                _debugHook.Hook();

                _settingsManager = container.GetIDsmSettingsManager();

                if ((connectMode == ext_ConnectMode.ext_cm_Startup) || (connectMode == ext_ConnectMode.ext_cm_AfterStartup))
                {
                    //_settings = Settings.Default;
                    //_settings.Reload();

                    CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;

                    // Create a toolbar for this app
                    string managerToolbarName = "Document Session Manager";
                    managerToolbar = null;
                    //try
                    //{
                    //  managerToolbar = ((Microsoft.VisualStudio.CommandBars.CommandBars)this._applicationObject.CommandBars)[managerToolbarName];
                    //}
                    //catch (ArgumentException)
                    //{
                    //}

                    if (managerToolbar == null)
                    {
                        managerToolbar = (CommandBar)commandBars.Add(managerToolbarName, MsoBarPosition.msoBarTop, System.Type.Missing, true);

                        _settingsManager.LoadSettings();
                        managerToolbar.Position = (MsoBarPosition)Enum.Parse(typeof(MsoBarPosition),
                                                                             _settingsManager.DsmSettings.ToolBarPosition ?? MsoBarPosition.msoBarTop.ToString());
                        managerToolbar.RowIndex = _settingsManager.DsmSettings.ToolBarRowIndex;
                        managerToolbar.Visible  = _settingsManager.DsmSettings.ToolBarVisible;

                        if (_settingsManager.DsmSettings.ToolBarTop != -1)
                        {
                            managerToolbar.Top = _settingsManager.DsmSettings.ToolBarTop;
                        }
                        if (_settingsManager.DsmSettings.ToolBarLeft != -1)
                        {
                            managerToolbar.Left = _settingsManager.DsmSettings.ToolBarLeft;
                        }
                        //if (_settingsManager.DsmSettings.ToolBarWidth != -1)
                        //  managerToolbar.Width = _settingsManager.DsmSettings.ToolBarWidth;
                        //if (_settingsManager.DsmSettings.ToolBarHeight != -1)
                        //  managerToolbar.Height = _settingsManager.DsmSettings.ToolBarHeight;
                    }

                    object controlCreated;

                    _controlsCreated.Clear();

                    //PictureManager.CommandButtons.Clear();

                    AddCommand(managerToolbar, "DsmSessionList", "DsmSessionList",
                               "Sessions", vsCommandControlType.vsCommandControlTypeDropDownCombo, 1,
                               vsCommandStyle.vsCommandStyleComboCaseSensitive, 0, out controlCreated);

                    CommandBarComboBox combo = controlCreated as CommandBarComboBox;
                    if (combo != null)
                    {
                        combo.Width = 200;
                    }

                    AddCommand(managerToolbar, "DsmLoadSession", "DsmLoadSession",
                               "Load session", vsCommandControlType.vsCommandControlTypeButton, 1,
                               vsCommandStyle.vsCommandStylePict, 2, out controlCreated);

                    AddCommand(managerToolbar, "DsmSaveSessionAs", "DsmSaveSessionAs",
                               "Save session as", vsCommandControlType.vsCommandControlTypeButton, 2,
                               vsCommandStyle.vsCommandStylePict, 6, out controlCreated);

                    AddCommand(managerToolbar, "DsmSaveSession", "DsmSaveSession",
                               "Save session", vsCommandControlType.vsCommandControlTypeButton, 3,
                               vsCommandStyle.vsCommandStylePict, 5, out controlCreated);

                    AddCommand(managerToolbar, "DsmDeleteSessions", "DsmDeleteSessions",
                               "Delete sessions", vsCommandControlType.vsCommandControlTypeButton, 4,
                               vsCommandStyle.vsCommandStylePict, 1, out controlCreated);

                    AddCommand(managerToolbar, "DsmReloadSession", "DsmReloadSession",
                               "Reload session", vsCommandControlType.vsCommandControlTypeButton, 5,
                               vsCommandStyle.vsCommandStylePict, 4, out controlCreated);

                    AddCommand(managerToolbar, "DsmRecentlyClosed", "DsmRecentlyClosed",
                               "Recently closed documents", vsCommandControlType.vsCommandControlTypeButton, 6,
                               vsCommandStyle.vsCommandStylePict, 3, out controlCreated);
                }
            }
            catch (Exception ex)
            {
                _exceptionManager.HandleException(ex);
            }
        }
        public void TestFillDocumentsInSession()
        {
            const string DOCUMENT_TO_ADD1 = "documentToAdd1";
              const string DOCUMENT_TO_ADD2 = "documentToAdd2";
              const string DOCUMENT_TO_ADD3 = "documentToAdd3";
              const string DOCUMENT_DUPLICATED = "documentDuplicated";

              var session = new SessionBuilder().StartDefault().Build();
              session.AddDocument(new SessionDocumentBuilder().StartDefault("documentToRemove").Build());
              session.AddDocument(new SessionDocumentBuilder().StartDefault(DOCUMENT_DUPLICATED).Build());

              var dteWindowAdapterMock1 = new Mock<IDteWindowAdapter>();
              dteWindowAdapterMock1.Setup(dwa => dwa.FullPath).Returns(DOCUMENT_TO_ADD1);
              dteWindowAdapterMock1.Setup(dwa => dwa.DocumentType).Returns(DocumentType.Text);

              var dteWindowAdapterMock2 = new Mock<IDteWindowAdapter>();
              dteWindowAdapterMock2.Setup(dwa => dwa.FullPath).Returns(DOCUMENT_TO_ADD2);
              dteWindowAdapterMock2.Setup(dwa => dwa.DocumentType).Returns(DocumentType.Text);

              var dteWindowAdapterMock3 = new Mock<IDteWindowAdapter>();
              dteWindowAdapterMock3.Setup(dwa => dwa.FullPath).Returns(DOCUMENT_TO_ADD3);
              dteWindowAdapterMock3.Setup(dwa => dwa.DocumentType).Returns(DocumentType.Text);

              var dteWindowAdapterMock4 = new Mock<IDteWindowAdapter>();
              dteWindowAdapterMock4.Setup(dwa => dwa.FullPath).Returns(DOCUMENT_DUPLICATED);
              dteWindowAdapterMock4.Setup(dwa => dwa.DocumentType).Returns(DocumentType.Text);

              var dteAdapterMock = new Mock<IDteAdapter>();
              dteAdapterMock.Setup(da => da.GetWindowsForValidDocuments()).Returns(
            new List<IDteWindowAdapter>()
            {
              dteWindowAdapterMock1.Object,
              dteWindowAdapterMock2.Object,
              dteWindowAdapterMock3.Object,
              dteWindowAdapterMock4.Object
            });

              var sessionManagerMock = new Mock<ISessionManager>();
              sessionManagerMock.Setup(sm => sm.CurrentSession).Returns((Session)null);

              var controller = new AddinController(sessionManagerMock.Object, null, null, dteAdapterMock.Object, null);
              controller.FillDocumentsInSession(session);

              IEnumerable<SessionDocument> documentsInSession = session.GetDocuments();

              Assert.AreEqual(4, documentsInSession.Count());
              Assert.AreEqual(1, documentsInSession.Where(d => d.Path.Equals(DOCUMENT_TO_ADD1)).Count());
              Assert.AreEqual(1, documentsInSession.Where(d => d.Path.Equals(DOCUMENT_TO_ADD2)).Count());
              Assert.AreEqual(1, documentsInSession.Where(d => d.Path.Equals(DOCUMENT_TO_ADD3)).Count());
              Assert.AreEqual(1, documentsInSession.Where(d => d.Path.Equals(DOCUMENT_DUPLICATED)).Count());
        }
        public void TestDeleteSessions()
        {
            var sessionToDelete = new SessionBuilder().StartDefault().Build();

              var sessionManagerMock = new Mock<ISessionManager>();
              sessionManagerMock.Setup(sm => sm.GetSessions()).Returns(new List<Session>());
              sessionManagerMock.Setup(sm => sm.GetSession(It.IsAny<string>())).Returns(sessionToDelete);
              sessionManagerMock.Setup(sm => sm.CurrentSession).Returns(sessionToDelete);

              var viewAdapterMock = new Mock<IViewAdapter>();
              viewAdapterMock.Setup(va => va.GetSessionsForDelete(It.IsAny<IList<SessionDto>>()))
            .Returns(new List<SessionDto>()
            {
              new SessionDto()
            });

              var controller = new AddinController(sessionManagerMock.Object, null, viewAdapterMock.Object,
            null, null);
              controller.DeleteSessions();

              sessionManagerMock.Verify(sm => sm.RemoveSession(sessionToDelete), Times.Once());
              sessionManagerMock.Verify(sm => sm.Persist(), Times.Once());
        }
        public void TestShowRecentlyClosedDocuments()
        {
            const int ELEMENTS_TO_ADD = 5;

              var elementsToAdd = new List<SessionDocument>();
              addDocumentsToList(ELEMENTS_TO_ADD, elementsToAdd);

              var sessionManagerMock = new Mock<ISessionManager>();

              var viewAdapterMock = new Mock<IViewAdapter>();

              var controller = new AddinController(sessionManagerMock.Object, null, viewAdapterMock.Object, null, null);
              controller.AddDocumentsToRecentlyClosedList(elementsToAdd);
              controller.ShowRecentlyClosedDocuments();

              viewAdapterMock.Verify(va => va.ShowRecentlyClosedDocuments(It.Is<List<SessionDocumentDto>>(x => x.Count == ELEMENTS_TO_ADD)));
        }
        public void TestSaveSessionAsWithReplace()
        {
            const string SESSION_TO_REPLACE_NAME = "SESSION_TO_REPLACE_NAME";

              var sessionToReplace = new SessionBuilder().StartDefault(SESSION_TO_REPLACE_NAME).Build();
              var sessions = new List<Session>() { sessionToReplace };

              var sessionManagerMock = new Mock<ISessionManager>();
              sessionManagerMock.Setup(sm => sm.GetSessions()).Returns(sessions);
              sessionManagerMock.Setup(sm => sm.GetSession(SESSION_TO_REPLACE_NAME)).Returns(sessionToReplace);
              Session sessionToSave = null;
              sessionManagerMock.SetupSet(sm => sm.CurrentSession).Callback(delegate(Session s)
                                                                    {
                                                                      sessionToSave = s;
                                                                    });
              sessionManagerMock.Setup(sm => sm.CurrentSession).Returns(delegate()
                                                                {
                                                                  return sessionToSave;
                                                                });

              var viewAdapterMock = new Mock<IViewAdapter>();
              viewAdapterMock.Setup(va => va.GetSessionForSaveAs(It.IsAny<IList<SessionDto>>()))
            .Returns((IList<SessionDto> dtoList) => dtoList[0]); //<-- first session (sessionToReplace)

              var dteAdapterMock = new Mock<IDteAdapter>();
              dteAdapterMock.Setup(da => da.GetWindowsForValidDocuments()).Returns(new List<IDteWindowAdapter>());

              var controller = new AddinController(sessionManagerMock.Object, null, viewAdapterMock.Object, dteAdapterMock.Object, null);
              controller.SaveSessionAs();

              sessionManagerMock.VerifySet(sm => sm.CurrentSession = sessionToSave, Times.Once());
              sessionManagerMock.Verify(sm => sm.Persist(), Times.Once());
        }
        public void TestSaveSession()
        {
            var sessionToSave = new SessionBuilder().StartDefault().Build();

              var sessionManagerMock = new Mock<ISessionManager>();
              sessionManagerMock.Setup(sm => sm.CurrentSession).Returns(sessionToSave);

              var dsmSettings = new DsmSettingsBuilder().StartDefault().Build();
              var settingsManagerMock = new Mock<IDsmSettingsManager>();
              settingsManagerMock.Setup(st => st.DsmSettings).Returns(dsmSettings);

              var dteAdapterMock = new Mock<IDteAdapter>();
              dteAdapterMock.Setup(da => da.GetWindowsForValidDocuments()).Returns(new List<IDteWindowAdapter>());

              var controller = new AddinController(sessionManagerMock.Object, settingsManagerMock.Object, null, dteAdapterMock.Object, null);
              controller.SaveSession();

              sessionManagerMock.Verify(sm => sm.Persist(), Times.Once());
        }
        public void TestRefreshCurrentSession()
        {
            var sessionManagerMock = new Mock<ISessionManager>();

              var controller = new AddinController(sessionManagerMock.Object, null, null,
            null, null);
              controller.RefreshCurrentSession();

              sessionManagerMock.Verify(sm => sm.SetCurrentSessionByName(It.IsAny<string>()));
        }
        public void TestLoadSession()
        {
            var sessionToLoad = new SessionBuilder().StartDefault().Build();

              var sessionManagerMock = new Mock<ISessionManager>();
              sessionManagerMock.Setup(sm => sm.GetSessions()).Returns(new List<Session>());
              sessionManagerMock.Setup(sm => sm.GetSession(It.IsAny<string>())).Returns(sessionToLoad);

              var viewAdapterMock = new Mock<IViewAdapter>();
              viewAdapterMock.Setup(va => va.GetSessionForLoading(It.IsAny<IList<SessionDto>>())).Returns(new SessionDto());

              var dteAdapterMock = new Mock<IDteAdapter>();
              dteAdapterMock.Setup(da => da.GetWindowsForValidDocuments()).Returns(new List<IDteWindowAdapter>());

              var controller = new AddinController(sessionManagerMock.Object, null, viewAdapterMock.Object,
            dteAdapterMock.Object, null);
              controller.LoadSession();

              sessionManagerMock.VerifySet(sm => sm.CurrentSession = sessionToLoad, Times.Once());
        }
        public void TestLoadDocumentsFromSession_NonExistentDocument()
        {
            const string NON_EXISTENT_DOCUMENT = "NON_EXISTENT_DOCUMENT";

              var sessionWithDocumentsToLoad = new SessionBuilder().StartDefault().Build();

              var nonExistentDocument = new SessionDocumentBuilder().StartDefault(NON_EXISTENT_DOCUMENT).Build();
              sessionWithDocumentsToLoad.AddDocument(nonExistentDocument);

              var dteAdapterMock = new Mock<IDteAdapter>();
              dteAdapterMock.Setup(da => da.GetWindowsForValidDocuments()).Returns(new List<IDteWindowAdapter>());

              dteAdapterMock.Setup(da => da.FileExists(It.IsAny<string>())).Returns(false);

              var viewAdapterMock = new Mock<IViewAdapter>();

              var sessionManagerMock = new Mock<ISessionManager>();
              sessionManagerMock.Setup(sm => sm.CurrentSession).Returns((Session)null);

              var controller = new AddinController(sessionManagerMock.Object, null, viewAdapterMock.Object,
            dteAdapterMock.Object, null);
              controller.LoadDocumentsFromSession(sessionWithDocumentsToLoad);

              dteAdapterMock.Verify(da => da.OpenFile(It.IsAny<string>(), It.IsAny<DocumentType>()), Times.Never());
              dteAdapterMock.Verify(da => da.FileExists(It.IsAny<string>()), Times.Once());
              viewAdapterMock.Verify(va => va.ShowLongMessage(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Once());
        }
        public void TestLoadDocumentsFromSession()
        {
            const string DOCUMENT_IN_SESSION_AND_IN_THE_IDE = "d1";
              const string DOCUMENT_IN_SESSION = "d2";
              const string DOCUMENT_IN_THE_IDE = "d3";

              var sessionWithDocumentsToLoad = new SessionBuilder().StartDefault().Build();

              var documentInSessionAndInTheIDE = new SessionDocumentBuilder().StartDefault(DOCUMENT_IN_SESSION_AND_IN_THE_IDE).Build();
              sessionWithDocumentsToLoad.AddDocument(documentInSessionAndInTheIDE);

              var documentInSession = new SessionDocumentBuilder().StartDefault(DOCUMENT_IN_SESSION).Build();
              sessionWithDocumentsToLoad.AddDocument(documentInSession);

              var dteWindowAdapterMock1 = new Mock<IDteWindowAdapter>();
              dteWindowAdapterMock1.Setup(dwa => dwa.FullPath).Returns(DOCUMENT_IN_SESSION_AND_IN_THE_IDE);
              dteWindowAdapterMock1.Setup(dwa => dwa.DocumentMatches(documentInSessionAndInTheIDE)).Returns(true);

              var dteWindowAdapterMock2 = new Mock<IDteWindowAdapter>();
              dteWindowAdapterMock2.Setup(dwa => dwa.FullPath).Returns(DOCUMENT_IN_THE_IDE);
              dteWindowAdapterMock2.Setup(dwa => dwa.DocumentMatches(It.IsAny<SessionDocument>())).Returns(false);
              dteWindowAdapterMock2.Setup(dwa => dwa.Close(It.Is<SaveChanges>(x => x == SaveChanges.Prompt))).Returns(true);

              var dteAdapterMock = new Mock<IDteAdapter>();
              dteAdapterMock.Setup(da => da.GetWindowsForValidDocuments()).Returns(new List<IDteWindowAdapter>()
              {
            dteWindowAdapterMock1.Object,
            dteWindowAdapterMock2.Object,
              });

              dteAdapterMock.Setup(da => da.FileExists(It.IsAny<string>())).Returns(true);

              var viewAdapterMock = new Mock<IViewAdapter>();

              var sessionManagerMock = new Mock<ISessionManager>();
              sessionManagerMock.Setup(sm => sm.CurrentSession).Returns((Session)null);

              var controller = new AddinController(sessionManagerMock.Object, null, viewAdapterMock.Object,
            dteAdapterMock.Object, null);
              controller.LoadDocumentsFromSession(sessionWithDocumentsToLoad);

              dteAdapterMock.Verify(da => da.OpenFile(It.IsAny<string>(), It.IsAny<DocumentType>()), Times.Once());
        }
Exemple #16
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)
        {
            try
              {
            _applicationObject = (DTE2)application;

            _addInInstance = (AddIn)addInInst;

            var container = new Container();

            _exceptionManager = container.GetIExceptionManager();

            _controller = container.GetAddinController(_applicationObject);

            _debugHook = container.GetDebugHook(_applicationObject);
            _debugHook.Hook();

            _settingsManager = container.GetIDsmSettingsManager();

            if ((connectMode == ext_ConnectMode.ext_cm_Startup) || (connectMode == ext_ConnectMode.ext_cm_AfterStartup))
            {
              //_settings = Settings.Default;
              //_settings.Reload();

              CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;

              // Create a toolbar for this app
              string managerToolbarName = "Document Session Manager";
              managerToolbar = null;
              //try
              //{
              //  managerToolbar = ((Microsoft.VisualStudio.CommandBars.CommandBars)this._applicationObject.CommandBars)[managerToolbarName];
              //}
              //catch (ArgumentException)
              //{
              //}

              if (managerToolbar == null)
              {
            managerToolbar = (CommandBar)commandBars.Add(managerToolbarName, MsoBarPosition.msoBarTop, System.Type.Missing, true);

            _settingsManager.LoadSettings();
            managerToolbar.Position = (MsoBarPosition)Enum.Parse(typeof(MsoBarPosition),
              _settingsManager.DsmSettings.ToolBarPosition ?? MsoBarPosition.msoBarTop.ToString());
            managerToolbar.RowIndex = _settingsManager.DsmSettings.ToolBarRowIndex;
            managerToolbar.Visible = _settingsManager.DsmSettings.ToolBarVisible;

            if (_settingsManager.DsmSettings.ToolBarTop != -1)
              managerToolbar.Top = _settingsManager.DsmSettings.ToolBarTop;
            if (_settingsManager.DsmSettings.ToolBarLeft != -1)
              managerToolbar.Left = _settingsManager.DsmSettings.ToolBarLeft;
            //if (_settingsManager.DsmSettings.ToolBarWidth != -1)
            //  managerToolbar.Width = _settingsManager.DsmSettings.ToolBarWidth;
            //if (_settingsManager.DsmSettings.ToolBarHeight != -1)
            //  managerToolbar.Height = _settingsManager.DsmSettings.ToolBarHeight;

              }

              object controlCreated;

              _controlsCreated.Clear();

              //PictureManager.CommandButtons.Clear();

              AddCommand(managerToolbar, "DsmSessionList", "DsmSessionList",
            "Sessions", vsCommandControlType.vsCommandControlTypeDropDownCombo, 1,
            vsCommandStyle.vsCommandStyleComboCaseSensitive, 0, out controlCreated);

              CommandBarComboBox combo = controlCreated as CommandBarComboBox;
              if (combo != null)
            combo.Width = 200;

              AddCommand(managerToolbar, "DsmLoadSession", "DsmLoadSession",
            "Load session", vsCommandControlType.vsCommandControlTypeButton, 1,
            vsCommandStyle.vsCommandStylePict, 2, out controlCreated);

              AddCommand(managerToolbar, "DsmSaveSessionAs", "DsmSaveSessionAs",
            "Save session as", vsCommandControlType.vsCommandControlTypeButton, 2,
            vsCommandStyle.vsCommandStylePict, 6, out controlCreated);

              AddCommand(managerToolbar, "DsmSaveSession", "DsmSaveSession",
            "Save session", vsCommandControlType.vsCommandControlTypeButton, 3,
            vsCommandStyle.vsCommandStylePict, 5, out controlCreated);

              AddCommand(managerToolbar, "DsmDeleteSessions", "DsmDeleteSessions",
            "Delete sessions", vsCommandControlType.vsCommandControlTypeButton, 4,
            vsCommandStyle.vsCommandStylePict, 1, out controlCreated);

              AddCommand(managerToolbar, "DsmReloadSession", "DsmReloadSession",
            "Reload session", vsCommandControlType.vsCommandControlTypeButton, 5,
            vsCommandStyle.vsCommandStylePict, 4, out controlCreated);

              AddCommand(managerToolbar, "DsmRecentlyClosed", "DsmRecentlyClosed",
            "Recently closed documents", vsCommandControlType.vsCommandControlTypeButton, 6,
            vsCommandStyle.vsCommandStylePict, 3, out controlCreated);

            }
              }
              catch (Exception ex)
              {
            _exceptionManager.HandleException(ex);
              }
        }