From 65bd3ed919b163bf237531b4dd17382555a50206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Fra=C5=9F=20Erg=C3=BCn?= <96827714+ugras-ergun-sonarsource@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:52:18 +0100 Subject: [PATCH 1/6] added window --- src/Integration/Integration.csproj | 2 + src/Integration/Muting/MuteWindowDialog.xaml | 60 ++++++++++++++ .../Muting/MuteWindowDialog.xaml.cs | 82 +++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 src/Integration/Muting/MuteWindowDialog.xaml create mode 100644 src/Integration/Muting/MuteWindowDialog.xaml.cs diff --git a/src/Integration/Integration.csproj b/src/Integration/Integration.csproj index 3b2580443b..f96956a9ce 100644 --- a/src/Integration/Integration.csproj +++ b/src/Integration/Integration.csproj @@ -59,11 +59,13 @@ + + diff --git a/src/Integration/Muting/MuteWindowDialog.xaml b/src/Integration/Muting/MuteWindowDialog.xaml new file mode 100644 index 0000000000..6e5c796d69 --- /dev/null +++ b/src/Integration/Muting/MuteWindowDialog.xaml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Integration/Muting/MuteWindowDialog.xaml.cs b/src/Integration/Muting/MuteWindowDialog.xaml.cs new file mode 100644 index 0000000000..d7eb7466c9 --- /dev/null +++ b/src/Integration/Muting/MuteWindowDialog.xaml.cs @@ -0,0 +1,82 @@ +/* + * SonarLint for Visual Studio + * Copyright (C) 2016-2023 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 System.Windows.Markup; +using Microsoft.VisualStudio.PlatformUI; +using SonarQube.Client.Models; + +namespace SonarLint.VisualStudio.Integration.Muting +{ + /// + /// Interaction logic for UserControl1.xaml + /// + [ContentProperty(nameof(MuteWindowDialog))] + public partial class MuteWindowDialog : DialogWindow + { + public MuteWindowDialog(bool showAccept) + { + InitializeComponent(); + + NewMethod(showAccept); + } + + private void NewMethod(bool showAccept) + { + BorderWontFix.Visibility = showAccept ? Visibility.Hidden : Visibility.Visible; + BorderAccept.Visibility = showAccept ? Visibility.Visible : Visibility.Hidden; + } + + private void Cancel_Click(object sender, RoutedEventArgs e) + { + this.DialogResult = false; + } + + private void Submit_Click(object sender, RoutedEventArgs e) + { + this.DialogResult = true; + } + + public SonarQubeIssueTransition SelectedIssueTransition { get; private set; } + + public string Comment => txtComment.Text; + + private void RadioButton_Checked(object sender, RoutedEventArgs e) + { + switch (sender) + { + case var value when value == rbWontFix: + SelectedIssueTransition = SonarQubeIssueTransition.WontFix; + break; + + case var value when value == rbAccept: + SelectedIssueTransition = SonarQubeIssueTransition.Accept; + break; + + case var value when value == rbFalsePositive: + SelectedIssueTransition = SonarQubeIssueTransition.FalsePositive; + break; + + default: + break; + } + } + } +} From cb43f7df43714ad29329508b6e3b18f0c7b448b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=9Fra=C5=9F=20Erg=C3=BCn?= <96827714+ugras-ergun-sonarsource@users.noreply.github.com> Date: Fri, 24 Nov 2023 12:05:06 +0100 Subject: [PATCH 2/6] PR feedback --- src/Integration/Integration.csproj | 4 +- src/Integration/Resources/Strings.Designer.cs | 91 +++++++++++++++++++ src/Integration/Resources/Strings.resx | 30 ++++++ .../MuteWindowDialog.xaml | 26 +++--- .../MuteWindowDialog.xaml.cs | 9 +- 5 files changed, 140 insertions(+), 20 deletions(-) rename src/Integration/{Muting => Transition}/MuteWindowDialog.xaml (59%) rename src/Integration/{Muting => Transition}/MuteWindowDialog.xaml.cs (93%) diff --git a/src/Integration/Integration.csproj b/src/Integration/Integration.csproj index f96956a9ce..509b65bd53 100644 --- a/src/Integration/Integration.csproj +++ b/src/Integration/Integration.csproj @@ -59,13 +59,13 @@ - + - + diff --git a/src/Integration/Resources/Strings.Designer.cs b/src/Integration/Resources/Strings.Designer.cs index 9b4dbd9b7c..7c5213addf 100644 --- a/src/Integration/Resources/Strings.Designer.cs +++ b/src/Integration/Resources/Strings.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. @@ -494,6 +495,96 @@ public static string MoreInfoLinkText { } } + /// + /// Looks up a localized string similar to The issue is valid but does not need fixing. It represents accepted technical debt.. + /// + public static string MuteWindow_AcceptContent { + get { + return ResourceManager.GetString("MuteWindow_AcceptContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Accept. + /// + public static string MuteWindow_AcceptTitle { + get { + return ResourceManager.GetString("MuteWindow_AcceptTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cancel. + /// + public static string MuteWindow_CancelButton { + get { + return ResourceManager.GetString("MuteWindow_CancelButton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Add a comment (optional):. + /// + public static string MuteWindow_CommentLabel { + get { + return ResourceManager.GetString("MuteWindow_CommentLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The issue is raised unxpectedly on code that should not trigger an issue.. + /// + public static string MuteWindow_FalsePositiveContent { + get { + return ResourceManager.GetString("MuteWindow_FalsePositiveContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to False Positive. + /// + public static string MuteWindow_FalsePositiveTitle { + get { + return ResourceManager.GetString("MuteWindow_FalsePositiveTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Mark Issue as.... + /// + public static string MuteWindow_SubmitButton { + get { + return ResourceManager.GetString("MuteWindow_SubmitButton", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Mark Issue as Resolved on SonarQube. + /// + public static string MuteWindow_Title { + get { + return ResourceManager.GetString("MuteWindow_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The issue is valid but does not need fixing. It represents accepted technical debt.. + /// + public static string MuteWindow_WontFixContent { + get { + return ResourceManager.GetString("MuteWindow_WontFixContent", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Won't Fix. + /// + public static string MuteWindow_WontFixTitle { + get { + return ResourceManager.GetString("MuteWindow_WontFixTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to None (for selected SonarQube project's quality profile). /// diff --git a/src/Integration/Resources/Strings.resx b/src/Integration/Resources/Strings.resx index ec5212b4fe..5abf3b4c4c 100644 --- a/src/Integration/Resources/Strings.resx +++ b/src/Integration/Resources/Strings.resx @@ -574,4 +574,34 @@ This is the general format to use when writing errors to output window or when t [Binding check] Error checking bound project settings file: {0} + + The issue is valid but does not need fixing. It represents accepted technical debt. + + + Accept + + + Cancel + + + Add a comment (optional): + + + The issue is raised unxpectedly on code that should not trigger an issue. + + + False Positive + + + Mark Issue as... + + + Mark Issue as Resolved on SonarQube + + + The issue is valid but does not need fixing. It represents accepted technical debt. + + + Won't Fix + \ No newline at end of file diff --git a/src/Integration/Muting/MuteWindowDialog.xaml b/src/Integration/Transition/MuteWindowDialog.xaml similarity index 59% rename from src/Integration/Muting/MuteWindowDialog.xaml rename to src/Integration/Transition/MuteWindowDialog.xaml index 6e5c796d69..5cba46f405 100644 --- a/src/Integration/Muting/MuteWindowDialog.xaml +++ b/src/Integration/Transition/MuteWindowDialog.xaml @@ -1,38 +1,40 @@ - + SizeToContent="WidthAndHeight" + Title="{x:Static resx:Strings.MuteWindow_Title}"> - - - - - - -