Skip to content

Make specify destination package option invisible #488 #495

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

Merged
merged 1 commit into from
Jul 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,11 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
}
row {
component(cbSpecifyTestPackage)
}
}.apply { visible = false }
row("Destination package:") {
component(testPackageField)
}
}.apply { visible = false }

row("Generate test methods for:") {}
row {
scrollPane(membersTable)
Expand Down Expand Up @@ -465,11 +466,6 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m

}

if (cbSpecifyTestPackage.isSelected && testPackageField.text.isEmpty()) {
showTestPackageAbsenceErrorMessage()
return
}

configureJvmTargetIfRequired()
configureTestFrameworkIfRequired()
configureMockFrameworkIfRequired()
Expand Down Expand Up @@ -531,12 +527,6 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m
"Generation error"
)

private fun showTestPackageAbsenceErrorMessage() =
Messages.showErrorDialog(
"Specify a package to store tests in.",
"Generation error"
)

private fun findReadOnlyContentEntry(testSourceRoot: VirtualFile?): ContentEntry? {
if (testSourceRoot == null) return null
if (testSourceRoot is FakeVirtualFile) {
Expand Down Expand Up @@ -866,14 +856,10 @@ class GenerateTestsDialogWindow(val model: GenerateTestsModel) : DialogWrapper(m

cbSpecifyTestPackage.addActionListener {
val testPackageName = findTestPackageComboValue()
val packageNameIsNeeded = testPackageField.isEnabled || testPackageName != SAME_PACKAGE_LABEL

if (testPackageField.isEnabled) {
testPackageField.isEnabled = false
testPackageField.text = testPackageName
} else {
testPackageField.isEnabled = true
testPackageField.text = if (testPackageName != SAME_PACKAGE_LABEL) testPackageName else ""
}
testPackageField.text = if (packageNameIsNeeded) testPackageName else ""
testPackageField.isEnabled = !testPackageField.isEnabled
}
}

Expand Down