}
@Override
protected void applyEditorTo(GoApplicationConfiguration configuration) throws ConfigurationException {
if (applicationName.getText().length() == 0 && !goPackageRadioButton.isSelected())
throw new ConfigurationException("Please select the go file to run.");
if (applicationPackage.getText().length() == 0 && goPackageRadioButton.isSelected())
throw new ConfigurationException("Please select the package directory to build.");
if (buildBeforeRunCheckBox.isSelected() && buildDirectoryPathBrowser.getText().equals("")) {
throw new ConfigurationException("Please select the directory for the executable.");
}
if (!buildBeforeRunCheckBox.isSelected() && goPackageRadioButton.isSelected()) {
throw new ConfigurationException("A package has to be build before it can run. Please check the box buld-before-run or select a go gile to run instead of a package.");
}
configuration.scriptName = applicationName.getText();
configuration.packageDir = applicationPackage.getText();
configuration.runPackage = goPackageRadioButton.isSelected();
configuration.scriptArguments = appArguments.getText();
configuration.runBuilderArguments = m_runBuilderArguments.getText();
configuration.runExecutableName = m_runExecutableName.getText();
configuration.goBuildBeforeRun = buildBeforeRunCheckBox.isSelected();
configuration.runDebugger = enableDebuggingCheckBox.isSelected();
configuration.goOutputDir = buildDirectoryPathBrowser.getText();
configuration.workingDir = workingDirectoryBrowser.getText();
configuration.envVars = envVars.getText();
//Debug stuff
String gdbPath = m_gdbPath.getText();
if (enableDebuggingCheckBox.isSelected()) {
if (gdbPath.isEmpty()) {
throw new ConfigurationException("Please select the path to gdb.");
} else if (!GoGdbUtil.doesExecutableExist(gdbPath) || !GoGdbUtil.isValidGdbPath(gdbPath)) {
throw new ConfigurationException("Please select a valid path to gdb.");
} else {
gdbVersionWarning.setVisible(!GoGdbUtil.isKnownGdb(gdbPath));
}
}