[Feedback] IDEBIS-37 Implement A/B experiment for evaluation feedback dialogs for Rider

We need to override RiderExternalResourceUrlsBase class to be able to implement a custom feedback reporter in another module. It helps us overcome the problem of dependencies.

IJ-CR-126889

GitOrigin-RevId: e82a47daf9109c6e785bf1df30d45283b8d306f8
This commit is contained in:
Dmitry Pogrebnoy
2024-02-27 12:32:47 +01:00
committed by intellij-monorepo-bot
parent 511c63c0c1
commit 118394f290
8 changed files with 44 additions and 42 deletions

View File

@@ -42,7 +42,8 @@ dialog.feedback.block.required=Rate all options
dialog.feedback.combobox.required=Choose a value
dialog.feedback.checkboxGroup.other.placeholder=Other
dialog.feedback.checkboxGroup.require.not.empty=Choose options or write your own
dialog.feedback.checkboxGroup.require.not.empty=Choose options
dialog.feedback.checkboxGroup.require.not.empty.with.other=Choose options or write your own
dialog.feedback.radioGroup.require.not.empty=Choose an option

View File

@@ -40,7 +40,7 @@ class AquaNewUserFeedbackDialog(
)
},
"primary_daily_tasks"
).addOtherTextField(),
).addOtherTextField().requireAnswer(),
ComboBoxBlock(
AquaFeedbackBundle.message("new.user.dialog.team.size.label"),
List(5) {
@@ -57,7 +57,7 @@ class AquaNewUserFeedbackDialog(
)
},
"primary_testing_targets"
).addOtherTextField(),
).addOtherTextField().requireAnswer(),
)
override val mySystemInfoData: CommonFeedbackSystemData by lazy {

View File

@@ -46,7 +46,7 @@ class DemoFeedbackDialog(
CheckBoxItemData(DemoFeedbackBundle.message("dialog.checkbox.item.${it}.label"),
"checkbox_${it}")
}, "checkbox_group")
.addOtherTextField(),
.addOtherTextField().requireAnswer(),
TextAreaBlock(DemoFeedbackBundle.message("dialog.textarea.label"), "textarea")
)

View File

@@ -50,7 +50,7 @@ class DemoFeedbackDialogWithEmail(
CheckBoxItemData(DemoFeedbackBundle.message("dialog.checkbox.item.${it}.label"),
"checkbox_${it}")
}, "checkbox_group")
.addOtherTextField(),
.addOtherTextField().requireAnswer(),
TextAreaBlock(DemoFeedbackBundle.message("dialog.textarea.label"), "textarea")
)

View File

@@ -14,7 +14,7 @@ import java.awt.event.KeyAdapter
import java.awt.event.KeyEvent
internal fun JBTextArea.adjustBehaviourForFeedbackForm() {
fun JBTextArea.adjustBehaviourForFeedbackForm() {
wrapStyleWord = true
lineWrap = true
addKeyListener(object : KeyAdapter() {
@@ -32,8 +32,7 @@ internal fun JBTextArea.adjustBehaviourForFeedbackForm() {
})
}
internal const val TEXT_AREA_ROW_SIZE = 5
internal const val TEXT_AREA_COLUMN_SIZE = 42
const val TEXT_AREA_ROW_SIZE = 5
internal const val TEXT_FIELD_EMAIL_COLUMN_SIZE = 25
internal const val COMBOBOX_COLUMN_SIZE = 25
@@ -49,7 +48,7 @@ internal fun Row.feedbackAgreement(project: Project?, @NlsContexts.DetailedDescr
}
}
internal fun createBoldJBLabel(@NlsContexts.Label label: String): JBLabel {
fun createBoldJBLabel(@NlsContexts.Label label: String): JBLabel {
return JBLabel(label).apply {
font = JBFont.create(font.deriveFont(Font.BOLD), false)
}

View File

@@ -12,8 +12,8 @@ import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.put
import java.awt.event.FocusEvent
import java.awt.event.FocusListener
import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent
import java.awt.event.MouseListener
import javax.swing.event.ChangeEvent
import javax.swing.event.ChangeListener
@@ -35,17 +35,29 @@ class CheckBoxGroupBlock(
panel.apply {
buttonsGroup(indent = false) {
row {
label(myGroupLabel).bold().errorOnApply(CommonFeedbackBundle.message("dialog.feedback.checkboxGroup.require.not.empty")) {
val isAllCheckboxEmpty = allCheckBoxes.all {
!it.isSelected
}
if (myIncludeOtherTextField) {
return@errorOnApply isAllCheckboxEmpty &&
(otherCheckBox?.isSelected == false ||
(otherCheckBox?.isSelected == true && otherTextField?.text?.isBlank() == true))
}
else {
return@errorOnApply isAllCheckboxEmpty
label(myGroupLabel).apply {
bold()
if (requireAnswer) {
val errorMessage = if (myIncludeOtherTextField) {
CommonFeedbackBundle.message("dialog.feedback.checkboxGroup.require.not.empty.with.other")
}
else {
CommonFeedbackBundle.message("dialog.feedback.checkboxGroup.require.not.empty")
}
errorOnApply(errorMessage) {
val isAllCheckboxEmpty = allCheckBoxes.all {
!it.isSelected
}
if (myIncludeOtherTextField) {
return@errorOnApply isAllCheckboxEmpty &&
(otherCheckBox?.isSelected == false ||
(otherCheckBox?.isSelected == true && otherTextField?.text?.isBlank() == true))
}
else {
return@errorOnApply isAllCheckboxEmpty
}
}
}
}
}.bottomGap(BottomGap.NONE)
@@ -93,23 +105,11 @@ class CheckBoxGroupBlock(
}
}
})
addMouseListener(object : MouseListener {
addMouseListener(object : MouseAdapter() {
override fun mouseClicked(e: MouseEvent?) {
otherCheckBox?.setSelected(true)
requestFocusInWindow()
}
override fun mousePressed(e: MouseEvent?) {
}
override fun mouseReleased(e: MouseEvent?) {
}
override fun mouseEntered(e: MouseEvent?) {
}
override fun mouseExited(e: MouseEvent?) {
}
})
}
otherCheckBox?.apply {

View File

@@ -5,5 +5,5 @@ import com.intellij.openapi.util.NlsContexts
data class CheckBoxItemData(@NlsContexts.Checkbox val label: String,
val jsonElementName: String) {
internal var property: Boolean = false
var property: Boolean = false
}

View File

@@ -3,7 +3,6 @@ package com.intellij.platform.feedback.dialog.uiBlocks
import com.intellij.openapi.util.NlsContexts
import com.intellij.openapi.util.NlsSafe
import com.intellij.platform.feedback.dialog.TEXT_AREA_COLUMN_SIZE
import com.intellij.platform.feedback.dialog.TEXT_AREA_ROW_SIZE
import com.intellij.platform.feedback.dialog.adjustBehaviourForFeedbackForm
import com.intellij.platform.feedback.dialog.createBoldJBLabel
@@ -15,10 +14,10 @@ class TextAreaBlock(@NlsContexts.Label private val myLabel: String,
private val myJsonElementName: String) : FeedbackBlock, TextDescriptionProvider, JsonDataProvider {
private var myProperty: String = ""
private var myTextAreaRowSize: Int = TEXT_AREA_ROW_SIZE
private var myTextAreaColumnSize: Int = TEXT_AREA_COLUMN_SIZE
@NlsSafe
private var myRequireNotEmptyMessage: String? = null
private var myPlaceholder: String? = null
override fun addToPanel(panel: Panel) {
panel.apply {
@@ -37,6 +36,9 @@ class TextAreaBlock(@NlsContexts.Label private val myLabel: String,
it.text.isBlank()
}
}
if (myPlaceholder != null) {
this.component.emptyText.text = myPlaceholder!!
}
}
}.bottomGap(BottomGap.MEDIUM)
}
@@ -61,13 +63,13 @@ class TextAreaBlock(@NlsContexts.Label private val myLabel: String,
return this
}
fun setColumnSize(columnSize: Int): TextAreaBlock {
myTextAreaColumnSize = columnSize
return this
}
fun requireNotEmpty(@NlsContexts.Label requireNotEmptyMessage: String): TextAreaBlock {
myRequireNotEmptyMessage = requireNotEmptyMessage
return this
}
fun setPlaceholder(placeholder: String): TextAreaBlock {
myPlaceholder = placeholder
return this
}
}