-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add popup with choice of Accept or Won't Fix #5046
Merged
ugras-ergun-sonarsource
merged 6 commits into
feature/mute-server-issues
from
ue/add-window
Nov 24, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
65bd3ed
added window
ugras-ergun-sonarsource cb43f7d
PR feedback
ugras-ergun-sonarsource d8f6200
exclude tests
ugras-ergun-sonarsource 07bbfb4
PR feedback
ugras-ergun-sonarsource fe6ad37
pr feedback
ugras-ergun-sonarsource 4e25fd8
moved styles
ugras-ergun-sonarsource File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<vsui:DialogWindow x:Class="SonarLint.VisualStudio.Integration.Transition.MuteWindowDialog" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:resx="clr-namespace:SonarLint.VisualStudio.Integration.Resources" | ||
xmlns:local="clr-namespace:SonarLint.VisualStudio.Integration.Transition" | ||
xmlns:vsui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0" | ||
mc:Ignorable="d" | ||
SizeToContent="WidthAndHeight" | ||
Title="{x:Static resx:Strings.MuteWindow_Title}"> | ||
<vsui:DialogWindow.Resources> | ||
<Style x:Key="RadioButtonStyle" TargetType="RadioButton"> | ||
<Setter Property="GroupName" Value="Transitions" /> | ||
<Setter Property="VerticalAlignment" Value="Top" /> | ||
<Setter Property="Margin" Value="10,16,-10,0" /> | ||
<Setter Property="FontWeight" Value="Bold" /> | ||
</Style> | ||
<Style x:Key="BorderStyle" TargetType="Border"> | ||
<Setter Property="BorderBrush" Value="Black" /> | ||
<Setter Property="BorderThickness" Value="1" /> | ||
<Setter Property="HorizontalAlignment" Value="Left" /> | ||
<Setter Property="Height" Value="75" /> | ||
<Setter Property="VerticalAlignment" Value="Top" /> | ||
<Setter Property="Width" Value="450" /> | ||
</Style> | ||
<Style x:Key="LabelStyle" TargetType="Label"> | ||
<Setter Property="HorizontalAlignment" Value="Left" /> | ||
<Setter Property="VerticalAlignment" Value="Top" /> | ||
<Setter Property="Margin" Value="25,200,0,0" /> | ||
</Style> | ||
<Style x:Key="TransitionLabelStyle" BasedOn="{StaticResource LabelStyle}" TargetType="Label"> | ||
<Setter Property="Margin" Value="10,36,0,0" /> | ||
</Style> | ||
<Style x:Key="ButtonStyle" TargetType="Button"> | ||
<Setter Property="Padding" Value="5,1"/> | ||
<Setter Property="HorizontalAlignment" Value="Left"/> | ||
<Setter Property="VerticalAlignment" Value="Top"/> | ||
</Style> | ||
<Style x:Key="CancelButtonStyle" BasedOn="{StaticResource ButtonStyle}" TargetType="Button"> | ||
<Setter Property="Margin" Value="300,300,0,0"/> | ||
</Style> | ||
<Style x:Key="SubmitButtonStyle" TargetType="Button" BasedOn="{StaticResource ButtonStyle}"> | ||
<Setter Property="Margin" Value="360,300,0,0" /> | ||
<Setter Property="IsEnabled" Value="False"/> | ||
<Style.Triggers> | ||
<DataTrigger Binding="{Binding Path=IsChecked, ElementName=rbWontFix}" Value="True"> | ||
<Setter Property="IsEnabled" Value="True"/> | ||
</DataTrigger> | ||
|
||
<DataTrigger Binding="{Binding Path=IsChecked, ElementName=rbAccept}" Value="True"> | ||
<Setter Property="IsEnabled" Value="True"/> | ||
</DataTrigger> | ||
|
||
<DataTrigger Binding="{Binding Path=IsChecked, ElementName=rbFalsePositive}" Value="True"> | ||
<Setter Property="IsEnabled" Value="True"/> | ||
</DataTrigger> | ||
</Style.Triggers> | ||
</Style> | ||
<Style x:Key="TextStyle" TargetType="TextBox"> | ||
<Setter Property="Margin" Value="0,225,0,0" /> | ||
<Setter Property="HorizontalAlignment" Value="Center" /> | ||
<Setter Property="Height" Value="60" /> | ||
<Setter Property="TextWrapping" Value="Wrap" /> | ||
<Setter Property="VerticalAlignment" Value="Top" /> | ||
<Setter Property="Width" Value="450" /> | ||
</Style> | ||
<Style x:Key="TopBorderStyle" BasedOn="{StaticResource BorderStyle}" TargetType="Border"> | ||
<Setter Property="Margin" Value="25,25,0,0" /> | ||
</Style> | ||
<Style x:Key="BottomBorderStyle" BasedOn="{StaticResource BorderStyle}" TargetType="Border"> | ||
<Setter Property="Margin" Value="25,115,0,0" /> | ||
</Style> | ||
</vsui:DialogWindow.Resources> | ||
<Grid Height="350" Width="500"> | ||
<Border Name="BorderWontFix" Style="{StaticResource TopBorderStyle}" Visibility="{Binding WontFixVisibility}"> | ||
<Grid> | ||
<RadioButton Name="rbWontFix" Content="{x:Static resx:Strings.MuteWindow_WontFixTitle}" Style="{StaticResource RadioButtonStyle}" Checked="RadioButton_Checked"/> | ||
<Label Content="{x:Static resx:Strings.MuteWindow_WontFixContent}" Style="{StaticResource TransitionLabelStyle}" /> | ||
</Grid> | ||
</Border> | ||
|
||
<Border Name="BorderAccept" Style="{StaticResource TopBorderStyle}" Visibility="{Binding AcceptVisibility}"> | ||
<Grid> | ||
<RadioButton Name="rbAccept" Content="{x:Static resx:Strings.MuteWindow_AcceptTitle}" Style="{StaticResource RadioButtonStyle}" Checked="RadioButton_Checked"/> | ||
<Label Content="{x:Static resx:Strings.MuteWindow_AcceptContent}" Style="{StaticResource TransitionLabelStyle}" /> | ||
</Grid> | ||
</Border> | ||
|
||
<Border Style="{StaticResource BottomBorderStyle}"> | ||
<Grid> | ||
<RadioButton x:Name="rbFalsePositive" Content="{x:Static resx:Strings.MuteWindow_FalsePositiveTitle}" Style="{StaticResource RadioButtonStyle}" Checked="RadioButton_Checked"/> | ||
<Label Content="{x:Static resx:Strings.MuteWindow_FalsePositiveContent}" Style="{StaticResource TransitionLabelStyle}" /> | ||
</Grid> | ||
</Border> | ||
<Label Content="{x:Static resx:Strings.MuteWindow_CommentLabel}" Style="{StaticResource LabelStyle}" /> | ||
<TextBox Name="txtComment" Style="{StaticResource TextStyle}"/> | ||
<Button Name="Cancel" Content="{x:Static resx:Strings.MuteWindow_CancelButton}" Style="{StaticResource CancelButtonStyle}" Click="Cancel_Click"/> | ||
<Button Name="Submit" Content="{x:Static resx:Strings.MuteWindow_SubmitButton}" Style="{StaticResource SubmitButtonStyle}" Click="Submit_Click"/> | ||
</Grid> | ||
</vsui:DialogWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* 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.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Markup; | ||
using Microsoft.VisualStudio.PlatformUI; | ||
using SonarQube.Client.Models; | ||
|
||
namespace SonarLint.VisualStudio.Integration.Transition | ||
{ | ||
/// <summary> | ||
/// Interaction logic for UserControl1.xaml | ||
/// </summary> | ||
[ContentProperty(nameof(MuteWindowDialog))] | ||
[ExcludeFromCodeCoverage] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. UI Code not testable |
||
public partial class MuteWindowDialog : DialogWindow | ||
{ | ||
private readonly Dictionary<RadioButton, SonarQubeIssueTransition> Transitions; | ||
|
||
public MuteWindowDialog(bool showAccept) | ||
{ | ||
InitializeComponent(); | ||
|
||
SetVisibility(showAccept); | ||
|
||
Transitions = InitializeTransitions(); | ||
} | ||
|
||
private Dictionary<RadioButton, SonarQubeIssueTransition> InitializeTransitions() | ||
{ | ||
return new Dictionary<RadioButton, SonarQubeIssueTransition> | ||
{ | ||
{ rbWontFix, SonarQubeIssueTransition.WontFix }, | ||
{ rbAccept, SonarQubeIssueTransition.Accept }, | ||
{ rbFalsePositive, SonarQubeIssueTransition.FalsePositive } | ||
}; | ||
} | ||
|
||
private void SetVisibility(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) | ||
{ | ||
SelectedIssueTransition = Transitions[(RadioButton)sender]; | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same content as Accept 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I'll talk about it with Marco during the meet