Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs =================================================================== diff -u -r28ca59defc5d6928bed9ddcfaf2257467fd8eab2 -rc063a97260cc4d630a453c359d49fca96ed8ac80 --- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 28ca59defc5d6928bed9ddcfaf2257467fd8eab2) +++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision c063a97260cc4d630a453c359d49fca96ed8ac80) @@ -223,6 +223,17 @@ } } + /// + /// Updates the data of the . + /// + public void UpdateProjectExplorer() + { + if (ProjectExplorer != null) + { + ProjectExplorer.Data = gui.Project; + } + } + protected virtual void Dispose(bool disposing) { if (IsWindowDisposed || !disposing) Index: Core/Common/src/Core.Common.Gui/GuiCore.cs =================================================================== diff -u -r229c2919ec8ea593f593b614ca64d4c42a5b8534 -rc063a97260cc4d630a453c359d49fca96ed8ac80 --- Core/Common/src/Core.Common.Gui/GuiCore.cs (.../GuiCore.cs) (revision 229c2919ec8ea593f593b614ca64d4c42a5b8534) +++ Core/Common/src/Core.Common.Gui/GuiCore.cs (.../GuiCore.cs) (revision c063a97260cc4d630a453c359d49fca96ed8ac80) @@ -368,6 +368,7 @@ projectObserver.Observable = newProject; UpdateTitle(); + mainWindow?.UpdateProjectExplorer(); } private void ApplicationBeforeProjectOpened(IProject oldProject) Index: Core/Common/test/Core.Common.Gui.Test/Forms/MainWindow/MainWindowTest.cs =================================================================== diff -u -r667f6bc7aad5f7fc5b82da1b0577d92d392e91a4 -rc063a97260cc4d630a453c359d49fca96ed8ac80 --- Core/Common/test/Core.Common.Gui.Test/Forms/MainWindow/MainWindowTest.cs (.../MainWindowTest.cs) (revision 667f6bc7aad5f7fc5b82da1b0577d92d392e91a4) +++ Core/Common/test/Core.Common.Gui.Test/Forms/MainWindow/MainWindowTest.cs (.../MainWindowTest.cs) (revision c063a97260cc4d630a453c359d49fca96ed8ac80) @@ -584,5 +584,61 @@ mocks.VerifyAll(); } + + [Test] + [Apartment(ApartmentState.STA)] + public void GivenGuiWithProjectExplorer_WhenUpdateProjectExplorer_ThenDataSetOnProjectExplorer() + { + // Given + var mocks = new MockRepository(); + var project1 = mocks.Stub(); + var project2 = mocks.Stub(); + + var projectStore = mocks.Stub(); + var projectMigrator = mocks.Stub(); + var projectFactory = mocks.Stub(); + projectFactory.Stub(pf => pf.CreateNewProject()).Return(project1); + + var plugin = mocks.Stub(); + plugin.Stub(p => p.Deactivate()); + plugin.Stub(p => p.Dispose()); + plugin.Expect(p => p.Activate()); + plugin.Expect(p => p.GetViewInfos()).Return(Enumerable.Empty()); + plugin.Expect(p => p.GetPropertyInfos()).Return(Enumerable.Empty()); + plugin.Expect(p => p.GetChildDataWithViewDefinitions(null)).IgnoreArguments().Return(Enumerable.Empty()); + plugin.Stub(p => p.GetTreeNodeInfos()).Return(new TreeNodeInfo[] + { + new TreeNodeInfo() + }); + mocks.ReplayAll(); + + using (var mainWindow = new Gui.Forms.MainWindow.MainWindow()) + using (var gui = new GuiCore(mainWindow, projectStore, projectMigrator, projectFactory, new GuiCoreSettings()) + { + Plugins = + { + plugin + } + }) + { + gui.Run(); + + mainWindow.SetGui(gui); + mainWindow.InitializeToolWindows(); + + // Precondition + Assert.IsNotNull(mainWindow.ProjectExplorer); + Assert.AreSame(project1, mainWindow.ProjectExplorer.Data); + + gui.SetProject(project2, string.Empty); + + // When + mainWindow.UpdateProjectExplorer(); + + // Then + Assert.AreSame(project2, mainWindow.ProjectExplorer.Data); + } + mocks.VerifyAll(); + } } } \ No newline at end of file Index: Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs =================================================================== diff -u -r667f6bc7aad5f7fc5b82da1b0577d92d392e91a4 -rc063a97260cc4d630a453c359d49fca96ed8ac80 --- Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs (.../GuiCoreTest.cs) (revision 667f6bc7aad5f7fc5b82da1b0577d92d392e91a4) +++ Core/Common/test/Core.Common.Gui.Test/GuiCoreTest.cs (.../GuiCoreTest.cs) (revision c063a97260cc4d630a453c359d49fca96ed8ac80) @@ -632,6 +632,7 @@ var expectedTitle = $"{fileName} - {fixedSettings.MainWindowTitle} {SettingsHelper.Instance.ApplicationVersion}"; Assert.AreEqual(expectedTitle, mainWindow.Title); + Assert.AreSame(gui.Project, mainWindow.ProjectExplorer.Data); } mocks.VerifyAll();