-
Notifications
You must be signed in to change notification settings - Fork 4
Added a toggle Action Button to allow the user to switch the labelling of warnings in the plugin #134
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
base: main
Are you sure you want to change the base?
Conversation
…g of warnings in the plugin between RuleId or Description. This is useful for users who prefer to see the RuleId instead of the Description, or vice versa.
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.
With few modifications it should work.
Can you also make this toggle saved in the SettingsState
var key = "init" | ||
if (view.ruleIdToggle) | ||
key = result.rule?.id ?: result.correlationGuid?.toString() ?: result.message.text | ||
else | ||
key = result.rule?.id ?: result.correlationGuid?.toString() ?: result.ruleId |
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.
var key = if (view.ruleIdToggle)
(result?.message?.text ?: result.rule?.id ?: result.correlationGuid?.toString())!!
else
(result?.ruleId ?: result.rule?.id ?: result.correlationGuid?.toString())!!
extractSarifFromFile = extractSarifFromFile(selectedFile) | ||
treeBuilding(extractSarifFromFile) | ||
} | ||
} | ||
fun openLocalFile() { | ||
val fileChooser = JFileChooser() | ||
fileChooser.fileFilter = FileNameExtensionFilter("SARIF files", "sarif") | ||
SwingUtilities.invokeLater { | ||
val returnValue = fileChooser.showOpenDialog(null) | ||
if (returnValue == JFileChooser.APPROVE_OPTION) { | ||
val selectedFile: File = fileChooser.selectedFile |
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.
val selectedFile: File = fileChooser.selectedFile | |
selectedFile = fileChooser.selectedFile |
without that the selectedFile attribute is never initiated and the toggle doesn't refresh the tree
@@ -10,6 +10,8 @@ | |||
<resource-bundle>messages.MyBundle</resource-bundle> | |||
|
|||
<actions> | |||
<action id="RuleIDorDescriptionAction" icon="AllIcons.Actions.Diff" class="com.github.adrienpessu.sarifviewer.actions.RuleIDorDescriptionAction" text="Toggle Rule ID or Description"> |
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 found the AllIcons.Actions.Diff
misleading.
Could you use a more neutral icon like : AllIcons.Debugger.VariablesTab
and make it change color when toggled (using AllIcons.Debugger.Value
for example)
Added a toggle Action Button to allow the user to switch the labelling of warnings in the plugin between RuleId or Description. This is useful for users who prefer to see the RuleId instead of the Description, or vice versa.