Skip to content

Commit

Permalink
Spark Run config bug fix. Main class missing will not block config sa…
Browse files Browse the repository at this point in the history
…ving. Add run config suggested name for aris. (#2837)

#2831 #2811 #2808 #2807 #2810 #2760
  • Loading branch information
konjac authored Mar 6, 2019
1 parent 06e8bd8 commit e0bf73a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ class ArisSparkConfiguration(name: String, val module: ArisSparkConfigurationMod
override fun getConfigurationEditor(): SettingsEditor<out RunConfiguration> {
return LivySparkRunConfigurationSettingsEditor(ArisSparkConfigurable(module.project))
}

override fun getSuggestedNamePrefix(): String {
return "[Spark on SQL]"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton
import com.intellij.openapi.vfs.impl.jar.JarFileSystemImpl
import com.intellij.packaging.impl.elements.ManifestFileUtil
import com.intellij.uiDesigner.core.GridConstraints
import com.microsoft.azure.hdinsight.common.DarkThemeManager
import com.microsoft.intellij.forms.dsl.panel
import com.microsoft.intellij.helpers.ManifestFileUtilsEx
import javax.swing.JComponent
Expand Down Expand Up @@ -55,7 +56,13 @@ class SparkCommonRunParametersPanel(private val myProject: Project, private val
}
}

private val submissionPanel : JPanel by lazy {
private val errorMessageLabel = JLabel("")
.apply {
foreground = DarkThemeManager.getInstance().errorMessageColor
isVisible = true
}

private val submissionPanel: JPanel by lazy {
val formBuilder = panel {
columnTemplate {
col {
Expand All @@ -68,28 +75,30 @@ class SparkCommonRunParametersPanel(private val myProject: Project, private val
fill = GridConstraints.FILL_HORIZONTAL
}
}
row { c(mainClassPrompt); c(mainClassTextField) }
row { c(mainClassPrompt); c(mainClassTextField) }
row { c(); c(errorMessageLabel) }
}

formBuilder.buildPanel()
}

open val component: JComponent
val component: JComponent
get() = submissionPanel

fun setMainClassName(mainClassName: String) {
mainClassTextField.text = mainClassName;
}

fun getMainClassName() : String {
fun getMainClassName(): String {
return mainClassTextField.text
}

@Throws(ConfigurationException::class)
fun validateInputs() {
// Check for command arguments invisible chars
if (mainClassTextField.text.isNullOrBlank()) {
throw ConfigurationException("Main Class Name should not be null")
if(this.mainClassTextField.text.isNullOrBlank()) {
this.errorMessageLabel.text = "Main class name could not be null."
} else {
this.errorMessageLabel.text = ""
}
}
}

0 comments on commit e0bf73a

Please sign in to comment.