Skip to content

Commit

Permalink
built ui according guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
ellizio committed Mar 16, 2024
1 parent cabeb11 commit 91063c0
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 71 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# ODataCliUi for Rider and ReSharper
# OData CLI UI

[![Rider](https://img.shields.io/jetbrains/plugin/v/RIDER_PLUGIN_ID.svg?label=Rider&colorB=0A7BBB&style=for-the-badge&logo=rider)](https://plugins.jetbrains.com/plugin/RIDER_PLUGIN_ID)
[![ReSharper](https://img.shields.io/jetbrains/plugin/v/RESHARPER_PLUGIN_ID.svg?label=ReSharper&colorB=0A7BBB&style=for-the-badge&logo=resharper)](https://plugins.jetbrains.com/plugin/RESHARPER_PLUGIN_ID)
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,107 @@ package com.jetbrains.rider.plugins.odatacliui

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.ui.dsl.builder.AlignX
import com.intellij.ui.dsl.builder.panel
import com.intellij.openapi.ui.DialogPanel
import com.intellij.ui.components.JBTabbedPane
import com.intellij.ui.dsl.builder.*
import javax.swing.JComponent

@Suppress("UnstableApiUsage")
class CliDialog : DialogWrapper(false) {
init {
title = "OData Cli UI"
init()
}

override fun createCenterPanel(): JComponent {
val tabbedPane = JBTabbedPane()
val generationTab = buildGenerationArgumentsTab()
val requestTab = buildRequestArgumentsTab()
tabbedPane.addTab("Generation Arguments", generationTab)
tabbedPane.addTab("Request Arguments", requestTab)

return panel {
groupRowsRange("Information") {
row("OData Cli Version:") {
label("todo")
.comment("Not installed? Follow <a href='https://learn.microsoft.com/en-us/odata/odatacli/getting-started#install'>instruction</a>")
}
}
groupRowsRange("Arguments") {
row("--metadata-uri") {
textFieldWithBrowseButton(fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFileDescriptor("xml"))
.align(AlignX.FILL)
.comment("The URI of the metadata document. The value must be set to a valid service document URI or a local file path")
}
row("--custom-headers") {
textField()
.align(AlignX.FILL)
.comment("Headers that will get sent along with the request when fetching the metadata document from the service. Format: Header1:HeaderValue, Header2:HeaderValue")
}
row("--proxy") {
textField()
.align(AlignX.FILL)
.comment("Proxy settings. Format: domain\\\\user:password@SERVER:PORT")
}
row("--file-name") {
textField()
.align(AlignX.FILL)
.comment("The name of the generated file. If not provided, then the default name 'Reference.cs' is used")
}
row("--namespace-prefix") {
textField()
.align(AlignX.FILL)
.comment("The namespace of the client code generated. Example: NorthWindService.Client or it could be a name related to the OData endpoint that you are generating code for")
}
row("--excluded-operation-imports") {
textField()
.align(AlignX.FILL)
.comment("Comma-separated list of the names of operation imports to exclude from the generated code. Example: ExcludedOperationImport1, ExcludedOperationImport2")
}
row("--excluded-bound-operations") {
textField()
.align(AlignX.FILL)
.comment("Comma-separated list of the names of bound operations to exclude from the generated code. Example: BoundOperation1, BoundOperation2")
}
row("--excluded-schema-types") {
textField()
.align(AlignX.FILL)
.comment("Comma-separated list of the names of entity types to exclude from the generated code. Example: EntityType1, EntityType2, EntityType3")
}
row {
checkBox("--upper-camel-case")
.align(AlignX.FILL)
.comment("Transforms names (class and property names) to upper camel-case so that to better conform with C# naming conventions")
}
row {
checkBox("--internal")
.align(AlignX.FILL)
.comment("Applies the internal class modifier on generated classes instead of public thereby making them invisible outside the assembly")
}
row {
checkBox("--multiple-files")
.align(AlignX.FILL)
.comment("Split the generated classes into separate files instead of generating all the code in a single file")
}
row {
checkBox("--ignore-unexpected-elements")
.align(AlignX.FILL)
.comment("This flag indicates whether to ignore unexpected elements and attributes in the metadata document and generate the client code if any")
}
row {
label("Global, 1.2.0")
.label("OData Cli Version:")
.comment("Not installed? Follow <a href='https://learn.microsoft.com/en-us/odata/odatacli/getting-started#install'>instruction</a>")
}.bottomGap(BottomGap.MEDIUM)
row("Service name:") {
textField()
.align(AlignX.FILL)
}
row("Metadata source:") {
textFieldWithBrowseButton(fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFileDescriptor("xml"))
.align(AlignX.FILL)
.comment("The URI of the metadata document. The value must be set to a valid service document URI or a local file path", Int.MAX_VALUE)
}.bottomGap(BottomGap.SMALL)
row {
cell(tabbedPane)
}.resizableRow()
}.apply {
registerIntegratedPanel(generationTab)
registerIntegratedPanel(requestTab)
}
}

private fun buildGenerationArgumentsTab(): DialogPanel = panel {
row("--file-name") {
textField()
.align(AlignX.FILL)
.comment("The name of the generated file. If not provided, then the default name 'Reference.cs' is used", Int.MAX_VALUE)
}
row("--namespace-prefix") {
textField()
.align(AlignX.FILL)
.comment("The namespace of the client code generated. <b>Example: NorthWindService.Client</b> or it could be a name related to the OData endpoint that you are generating code for", Int.MAX_VALUE)
}
row("--excluded-operation-imports") {
textField()
.align(AlignX.FILL)
.comment("Comma-separated list of the names of operation imports to exclude from the generated code. <b>Example: ExcludedOperationImport1, ExcludedOperationImport2</b>", Int.MAX_VALUE)
}
row("--excluded-bound-operations") {
textField()
.align(AlignX.FILL)
.comment("Comma-separated list of the names of bound operations to exclude from the generated code. <b>Example: BoundOperation1, BoundOperation2</b>", Int.MAX_VALUE)
}
row("--excluded-schema-types") {
textField()
.align(AlignX.FILL)
.comment("Comma-separated list of the names of entity types to exclude from the generated code. <b>Example: EntityType1, EntityType2, EntityType3</b>", Int.MAX_VALUE)
}
row {
checkBox("--internal")
.align(AlignX.FILL)
.comment("Applies the internal class modifier on generated classes instead of public thereby making them invisible outside the assembly", Int.MAX_VALUE)
}
row {
checkBox("--multiple-files")
.align(AlignX.FILL)
.comment("Split the generated classes into separate files instead of generating all the code in a single file", Int.MAX_VALUE)
}
row {
checkBox("--ignore-unexpected-elements")
.align(AlignX.FILL)
.comment("This flag indicates whether to ignore unexpected elements and attributes in the metadata document and generate the client code if any", Int.MAX_VALUE)
}
row {
checkBox("--upper-camel-case")
.align(AlignX.FILL)
.comment("Transforms names (class and property names) to upper camel-case so that to better conform with C# naming conventions", Int.MAX_VALUE)
}
}

private fun buildRequestArgumentsTab(): DialogPanel = panel {
row("--custom-headers") {
textField()
.align(AlignX.FILL)
.comment("Headers that will get sent along with the request when fetching the metadata document from the service. <b>Format: Header1:HeaderValue, Header2:HeaderValue</b>", Int.MAX_VALUE)
}
row("--proxy") {
textField()
.align(AlignX.FILL)
.comment("Proxy settings. <b>Format: domain\\\\user:password@SERVER:PORT</b>", Int.MAX_VALUE)
}
}
}

0 comments on commit 91063c0

Please sign in to comment.