Skip to content
Merged
Show file tree
Hide file tree
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 @@ -90,6 +90,8 @@ class CliDialog(private val model: CliDialogModel) : BaseDialog(false) {
.emptyText(UiBundle.text("cli.filename.empty-text"))
.comment(UiBundle.text("cli.filename.comment"))
.bindText(model.fileName)
.validationOnInput(CliDialogValidators.fileNameValidator())
.validationOnApply(CliDialogValidators.fileNameValidator())
}
row("--namespace-prefix") {
textField()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CliDialogModel(project: Project, private val actionMetadata: ActionMetadat
fun buildODataCliCommand(): GeneralCommandLine = CommandLineBuilder(DotnetToolsUtils.getToolDefaultPath("odata-cli"), "generate")
.withParameter("--metadata-uri", metadataUri.get())
.withParameter("--service-name", serviceName.get(), atLeast031)
.withParameter("--file-name", fileName.get())
.withParameter("--file-name", fileName.get().removeSuffix(".cs"))
.withParameter("--custom-headers", customHeaders.get())
.withParameter("--proxy", proxy.get())
.withParameter("--namespace-prefix", namespacePrefix.get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ object CliDialogValidators {
null
}

fun fileNameValidator(): ValidationInfoBuilder.(JTextField) -> ValidationInfo? = {
if (it.text.isNotEmpty() && it.text.isBlank())
error("File name must not be entirely whitespace")
else
null
}

fun namespacePrefixValidator(): ValidationInfoBuilder.(JTextField) -> ValidationInfo? = {
if (it.text.isNotEmpty() && !namespacePrefixRegex.matches(it.text))
error("Namespace prefix must be in a valid format")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CliToolWindowManager(private val project: Project) {
fun instantiateConsole(): ConsoleView {
val consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).console
val content = toolWindow.contentManager.factory.createContent(consoleView.component, UiBundle.text("cli.tab.generate"), true)
content.setDisposer(consoleView);
toolWindow.contentManager.addContent(content)
toolWindow.activate {
toolWindow.contentManager.setSelectedContent(content)
Expand Down