diff --git a/src/Integration.TeamExplorer/ConnectSectionView.xaml b/src/Integration.TeamExplorer/ConnectSectionView.xaml index 09d150f1f8..d6b861873b 100644 --- a/src/Integration.TeamExplorer/ConnectSectionView.xaml +++ b/src/Integration.TeamExplorer/ConnectSectionView.xaml @@ -1,22 +1,9 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/src/Integration.TeamExplorer/ConnectSectionView.xaml.cs b/src/Integration.TeamExplorer/ConnectSectionView.xaml.cs index c7ca03bcf7..42e6de2921 100644 --- a/src/Integration.TeamExplorer/ConnectSectionView.xaml.cs +++ b/src/Integration.TeamExplorer/ConnectSectionView.xaml.cs @@ -1,4 +1,4 @@ -/* +/* * SonarLint for Visual Studio * Copyright (C) 2016-2024 SonarSource SA * mailto:info AT sonarsource DOT com @@ -40,7 +40,6 @@ void IProgressControlHost.Host(ProgressControl progressControl) protected virtual void HostProgressControl(ProgressControl control) { - this.progressPlacePlaceholder.Content = control; } } } diff --git a/src/Integration.TeamExplorer/UIStrings.Designer.cs b/src/Integration.TeamExplorer/UIStrings.Designer.cs index ff07684bc5..1884c4727a 100644 --- a/src/Integration.TeamExplorer/UIStrings.Designer.cs +++ b/src/Integration.TeamExplorer/UIStrings.Designer.cs @@ -1,6 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -18,7 +19,7 @@ namespace SonarLint.VisualStudio.Integration.TeamExplorer { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class UIStrings { @@ -60,83 +61,13 @@ internal UIStrings() { } /// - /// Looks up a localized string similar to Connect.... + /// Looks up a localized string similar to The Connected Mode experience has been migrated away from Team Explorer view. + /// + ///Please use the new window by navigating to Extensions -> SonarLint -> Connected Mode -> Bind to SonarQube or SonarCloud.... /// - public static string ConnectLinkText { + public static string UseNewConnectedMode { get { - return ResourceManager.GetString("ConnectLinkText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to More info.... - /// - public static string MoreInfoLinkText { - get { - return ResourceManager.GetString("MoreInfoLinkText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to SonarSource and Microsoft. - /// - public static string ProductAuthors { - get { - return ResourceManager.GetString("ProductAuthors", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select a SonarQube project and bind it to the current solution.. - /// - public static string SelectProjectInstruction { - get { - return ResourceManager.GetString("SelectProjectInstruction", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to (no projects). - /// - public static string ServerNoProjectsInlineText { - get { - return ResourceManager.GetString("ServerNoProjectsInlineText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No shared binding configuration found. - /// - public static string SharedBindingCheckboxDisabledTooltipText { - get { - return ResourceManager.GetString("SharedBindingCheckboxDisabledTooltipText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Use Shared Binding Configuration. - /// - public static string SharedBindingCheckboxLabel { - get { - return ResourceManager.GetString("SharedBindingCheckboxLabel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to SonarQube is an open source platform to manage code quality. Connect your solution to an existing SonarQube Server to get the same issues in Visual Studio and in your SonarQube server.. - /// - public static string SonarQubeDescription { - get { - return ResourceManager.GetString("SonarQubeDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to SonarQube. - /// - public static string SonarQubeName { - get { - return ResourceManager.GetString("SonarQubeName", resourceCulture); + return ResourceManager.GetString("UseNewConnectedMode", resourceCulture); } } } diff --git a/src/Integration.TeamExplorer/UIStrings.resx b/src/Integration.TeamExplorer/UIStrings.resx index ad29c38689..386e705382 100644 --- a/src/Integration.TeamExplorer/UIStrings.resx +++ b/src/Integration.TeamExplorer/UIStrings.resx @@ -117,38 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Connect... - Link text for 'connect' command to initiate a connection with a SonarQube server - - - (no projects) - Text to be displayed inline next to the connected SonarQube server in the Team Explorer tree view when there are no SonarQube Projects available under the given server - - - More info... - Link text for getting more information about SonarQube - - - SonarSource and Microsoft - Authors of the product - - - SonarQube is an open source platform to manage code quality. Connect your solution to an existing SonarQube Server to get the same issues in Visual Studio and in your SonarQube server. - Short descriptive text about SonarQube shown on the Team Explorer invitation card. - - - SonarQube - Name of SonarQube server product - - - Select a SonarQube project and bind it to the current solution. - Message instructing the user to select from the presented list of SonarQube projects with which to bind the current solution to. - - - Use Shared Binding Configuration - - - No shared binding configuration found + + The Connected Mode experience has been migrated away from Team Explorer view. + +Please use the new window by navigating to Extensions -> SonarLint -> Connected Mode -> Bind to SonarQube or SonarCloud... \ No newline at end of file diff --git a/src/Integration.Vsix.UnitTests/Commands/ConnectedModeMenu/ManageConnectionsCommandTests.cs b/src/Integration.Vsix.UnitTests/Commands/ConnectedModeMenu/ManageConnectionsCommandTests.cs deleted file mode 100644 index 700f687cda..0000000000 --- a/src/Integration.Vsix.UnitTests/Commands/ConnectedModeMenu/ManageConnectionsCommandTests.cs +++ /dev/null @@ -1,94 +0,0 @@ -/* - * SonarLint for Visual Studio - * Copyright (C) 2016-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using FluentAssertions; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using SonarLint.VisualStudio.Integration.Vsix.Commands.ConnectedModeMenu; -using SonarLint.VisualStudio.TestInfrastructure; - -namespace SonarLint.VisualStudio.Integration.UnitTests.Commands.ConnectedModeMenu -{ - [TestClass] - public class ManageConnectionsCommandTests - { - [TestMethod] - public void ManageConnectionsCommand_Invoke() - { - // Arrange - OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); - var teController = new ConfigurableTeamExplorerController(); - - var testSubject = new ManageConnectionsCommand(teController); - - // Test case 1: was disabled - command.Enabled = false; - - // Act - using (new AssertIgnoreScope()) // Invoked when disabled - { - testSubject.Invoke(command, null); - } - - // Assert - teController.ShowConnectionsPageCallsCount.Should().Be(0); - - // Test case 2: was enabled - command.Enabled = true; - - // Act - testSubject.Invoke(command, null); - - // Assert - teController.ShowConnectionsPageCallsCount.Should().Be(1); - } - - [TestMethod] - public void ManageConnectionsCommand_QueryStatus() - { - // Arrange - OleMenuCommand command = CommandHelper.CreateRandomOleMenuCommand(); - - // Test case 1: no TE controller - // Arrange - command.Enabled = false; - - var testSubject1 = new ManageConnectionsCommand(null); - - // Act - testSubject1.QueryStatus(command, null); - - // Assert - command.Enabled.Should().BeFalse("Expected the command to be disabled on QueryStatus when no TE controller"); - - // Test case 2: has TE controller - // Arrange - var teController = new ConfigurableTeamExplorerController(); - var testSubject2 = new ManageConnectionsCommand(teController); - - // Act - testSubject2.QueryStatus(command, null); - - // Assert - command.Enabled.Should().BeTrue("Expected the command to be disabled on QueryStatus when does have TE controller"); - } - - } -} diff --git a/src/Integration.Vsix.UnitTests/Commands/PackageCommandManagerTests.cs b/src/Integration.Vsix.UnitTests/Commands/PackageCommandManagerTests.cs index 7a23dcabc4..2d760d38e7 100644 --- a/src/Integration.Vsix.UnitTests/Commands/PackageCommandManagerTests.cs +++ b/src/Integration.Vsix.UnitTests/Commands/PackageCommandManagerTests.cs @@ -52,7 +52,7 @@ public void PackageCommandManager_Initialize() .ToList(); // Act - testSubject.Initialize(Mock.Of(), + testSubject.Initialize( Mock.Of(), Mock.Of(), Mock.Of(), diff --git a/src/Integration.Vsix/Commands/ConnectedModeMenu/ConnectedModeMenu.vsct b/src/Integration.Vsix/Commands/ConnectedModeMenu/ConnectedModeMenu.vsct index 3ea8ea6bae..1c49307f30 100644 --- a/src/Integration.Vsix/Commands/ConnectedModeMenu/ConnectedModeMenu.vsct +++ b/src/Integration.Vsix/Commands/ConnectedModeMenu/ConnectedModeMenu.vsct @@ -21,19 +21,12 @@ Export Binding Configuration - - diff --git a/src/Integration.Vsix/Commands/ConnectedModeMenu/ManageConnectionsCommand.cs b/src/Integration.Vsix/Commands/ConnectedModeMenu/ManageConnectionsCommand.cs index 7761cf0ff1..00e50d7136 100644 --- a/src/Integration.Vsix/Commands/ConnectedModeMenu/ManageConnectionsCommand.cs +++ b/src/Integration.Vsix/Commands/ConnectedModeMenu/ManageConnectionsCommand.cs @@ -18,32 +18,28 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -using System.Diagnostics; -using Microsoft.VisualStudio.Shell; -using SonarLint.VisualStudio.Integration.TeamExplorer; +using System.Windows; +using SonarLint.VisualStudio.ConnectedMode.UI; +using SonarLint.VisualStudio.ConnectedMode.UI.ManageBinding; namespace SonarLint.VisualStudio.Integration.Vsix.Commands.ConnectedModeMenu { + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal class ManageConnectionsCommand : VsCommandBase { + private readonly IConnectedModeServices connectedModeServices; + private readonly IConnectedModeBindingServices connectedModeBindingServices; internal const int Id = 0x102; - private readonly ITeamExplorerController teamExplorer; - - public ManageConnectionsCommand(ITeamExplorerController teamExplorer) - { - this.teamExplorer = teamExplorer; - } - - protected override void QueryStatusInternal(OleMenuCommand command) + public ManageConnectionsCommand(IConnectedModeServices connectedModeServices, IConnectedModeBindingServices connectedModeBindingServices) { - command.Enabled = (this.teamExplorer != null); + this.connectedModeServices = connectedModeServices; + this.connectedModeBindingServices = connectedModeBindingServices; } protected override void InvokeInternal() { - Debug.Assert(this.teamExplorer != null, "Should only be invocable with a handle to the team explorer controller"); - this.teamExplorer.ShowSonarQubePage(); + new ManageBindingDialog(connectedModeServices, connectedModeBindingServices).ShowDialog(Application.Current.MainWindow); } } } diff --git a/src/Integration.Vsix/Commands/ConnectedModeMenu/NewConnectedModeCommand.cs b/src/Integration.Vsix/Commands/ConnectedModeMenu/NewConnectedModeCommand.cs deleted file mode 100644 index 8e4836b92c..0000000000 --- a/src/Integration.Vsix/Commands/ConnectedModeMenu/NewConnectedModeCommand.cs +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarLint for Visual Studio - * Copyright (C) 2016-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -using System.Windows; -using SonarLint.VisualStudio.ConnectedMode.UI.ManageBinding; -using SonarLint.VisualStudio.ConnectedMode.UI; - -namespace SonarLint.VisualStudio.Integration.Vsix.Commands.ConnectedModeMenu -{ - [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] - public class NewConnectedModeCommand : VsCommandBase - { - private readonly IConnectedModeServices connectedModeServices; - private readonly IConnectedModeBindingServices connectedModeBindingServices; - internal const int Id = 0x104; - - public NewConnectedModeCommand(IConnectedModeServices connectedModeServices, IConnectedModeBindingServices connectedModeBindingServices) - { - this.connectedModeServices = connectedModeServices; - this.connectedModeBindingServices = connectedModeBindingServices; - } - - protected override void InvokeInternal() - { - new ManageBindingDialog(connectedModeServices, connectedModeBindingServices).ShowDialog(Application.Current.MainWindow); - } - } -} diff --git a/src/Integration.Vsix/Commands/PackageCommandManager.cs b/src/Integration.Vsix/Commands/PackageCommandManager.cs index d45d2c22cc..f64268c804 100644 --- a/src/Integration.Vsix/Commands/PackageCommandManager.cs +++ b/src/Integration.Vsix/Commands/PackageCommandManager.cs @@ -42,7 +42,7 @@ public PackageCommandManager(IMenuCommandService menuService) this.menuService = menuService ?? throw new ArgumentNullException(nameof(menuService)); } - public void Initialize(ITeamExplorerController teamExplorerController, + public void Initialize( IProjectPropertyManager projectPropertyManager, IOutputWindowService outputWindowService, IShowInBrowserService showInBrowserService, @@ -69,8 +69,7 @@ public void Initialize(ITeamExplorerController teamExplorerController, RegisterCommand(CommonGuids.HelpMenuCommandSet, ShowCommunityPageCommand.Id, new ShowCommunityPageCommand(showInBrowserService)); // Connected mode buttons - RegisterCommand(CommonGuids.ConnectedModeMenuCommandSet, ManageConnectionsCommand.Id, new ManageConnectionsCommand(teamExplorerController)); - RegisterCommand(CommonGuids.ConnectedModeMenuCommandSet, NewConnectedModeCommand.Id, new NewConnectedModeCommand(connectedModeServices, connectedModeBindingServices)); + RegisterCommand(CommonGuids.ConnectedModeMenuCommandSet, ManageConnectionsCommand.Id, new ManageConnectionsCommand(connectedModeServices, connectedModeBindingServices)); RegisterCommand(CommonGuids.ConnectedModeMenuCommandSet, SaveSharedConnectionCommand.Id, new SaveSharedConnectionCommand(connectedModeServices.ConfigurationProvider, connectedModeBindingServices.SharedBindingConfigProvider)); } diff --git a/src/Integration.Vsix/SonarLintIntegrationPackage.cs b/src/Integration.Vsix/SonarLintIntegrationPackage.cs index 26d0734063..33e6ced149 100644 --- a/src/Integration.Vsix/SonarLintIntegrationPackage.cs +++ b/src/Integration.Vsix/SonarLintIntegrationPackage.cs @@ -92,7 +92,7 @@ private async System.Threading.Tasks.Task InitOnUIThreadAsync() this.commandManager = new PackageCommandManager(serviceProvider.GetService()); - this.commandManager.Initialize(serviceProvider.GetMefService(), + this.commandManager.Initialize( serviceProvider.GetMefService(), serviceProvider.GetMefService(), serviceProvider.GetMefService(),