use of com.intellij.facet.ui.ValidationResult in project intellij-community by JetBrains.
the class ProjectSpecificSettingsStep method createAdvancedSettings.
@Override
@Nullable
protected JPanel createAdvancedSettings() {
JComponent advancedSettings = null;
if (myProjectGenerator instanceof PythonProjectGenerator) {
advancedSettings = ((PythonProjectGenerator) myProjectGenerator).getSettingsPanel(myProjectDirectory);
} else if (myProjectGenerator instanceof WebProjectTemplate) {
advancedSettings = ((WebProjectTemplate) myProjectGenerator).getPeer().getComponent();
}
if (advancedSettings != null) {
final JPanel jPanel = new JPanel(new VerticalFlowLayout());
final HideableDecorator deco = new HideableDecorator(jPanel, "Mor&e Settings", false);
boolean isValid = checkValid();
deco.setOn(!isValid);
if (myProjectGenerator instanceof PythonProjectGenerator && !deco.isExpanded()) {
final ValidationResult result = ((PythonProjectGenerator) myProjectGenerator).warningValidation(getSdk());
deco.setOn(!result.isOk());
}
deco.setContentComponent(advancedSettings);
return jPanel;
}
return null;
}
use of com.intellij.facet.ui.ValidationResult in project intellij-community by JetBrains.
the class BuildoutConfigPanel method initErrorValidation.
private void initErrorValidation() {
FacetErrorPanel facetErrorPanel = new FacetErrorPanel();
myErrorPanel.add(facetErrorPanel.getComponent(), BorderLayout.CENTER);
facetErrorPanel.getValidatorsManager().registerValidator(new FacetEditorValidator() {
@NotNull
@Override
public ValidationResult check() {
if (!myFacetEnabled) {
return ValidationResult.OK;
}
return validateScriptName(getScriptName());
}
}, myScript);
facetErrorPanel.getValidatorsManager().validate();
}
use of com.intellij.facet.ui.ValidationResult in project intellij-community by JetBrains.
the class PyCCProjectGenerator method validate.
@NotNull
@Override
public ValidationResult validate(@NotNull String s) {
String message = "";
message = mySettingsPanel.getDescription().isEmpty() ? "Enter description" : message;
message = mySettingsPanel.getAuthors().length == 0 ? "Enter author name" : message;
message = mySettingsPanel.getName().isEmpty() ? "Enter course name" : message;
return message.isEmpty() ? ValidationResult.OK : new ValidationResult(message);
}
use of com.intellij.facet.ui.ValidationResult in project intellij-community by JetBrains.
the class PyIntegratedToolsConfigurable method initErrorValidation.
private void initErrorValidation() {
final FacetErrorPanel facetErrorPanel = new FacetErrorPanel();
myErrorPanel.add(facetErrorPanel.getComponent(), BorderLayout.CENTER);
facetErrorPanel.getValidatorsManager().registerValidator(new FacetEditorValidator() {
@NotNull
@Override
public ValidationResult check() {
final Sdk sdk = PythonSdkType.findPythonSdk(myModule);
if (sdk != null) {
final Object selectedItem = myTestRunnerComboBox.getSelectedItem();
if (PythonTestConfigurationsModel.PY_TEST_NAME.equals(selectedItem)) {
if (!VFSTestFrameworkListener.getInstance().isPyTestInstalled(sdk)) {
return new ValidationResult(PyBundle.message("runcfg.testing.no.test.framework", "py.test"), createQuickFix(sdk, facetErrorPanel, PyNames.PY_TEST));
}
} else if (PythonTestConfigurationsModel.PYTHONS_NOSETEST_NAME.equals(selectedItem)) {
if (!VFSTestFrameworkListener.getInstance().isNoseTestInstalled(sdk)) {
return new ValidationResult(PyBundle.message("runcfg.testing.no.test.framework", "nosetest"), createQuickFix(sdk, facetErrorPanel, PyNames.NOSE_TEST));
}
}
}
return ValidationResult.OK;
}
}, myTestRunnerComboBox);
facetErrorPanel.getValidatorsManager().validate();
}
Aggregations