Search in sources :

Example 1 with FacetErrorPanel

use of com.intellij.facet.impl.ui.FacetErrorPanel 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();
}
Also used : FacetErrorPanel(com.intellij.facet.impl.ui.FacetErrorPanel) FacetEditorValidator(com.intellij.facet.ui.FacetEditorValidator) ValidationResult(com.intellij.facet.ui.ValidationResult) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with FacetErrorPanel

use of com.intellij.facet.impl.ui.FacetErrorPanel 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();
}
Also used : FacetErrorPanel(com.intellij.facet.impl.ui.FacetErrorPanel) FacetEditorValidator(com.intellij.facet.ui.FacetEditorValidator) Sdk(com.intellij.openapi.projectRoots.Sdk) ValidationResult(com.intellij.facet.ui.ValidationResult) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

FacetErrorPanel (com.intellij.facet.impl.ui.FacetErrorPanel)2 FacetEditorValidator (com.intellij.facet.ui.FacetEditorValidator)2 ValidationResult (com.intellij.facet.ui.ValidationResult)2 NotNull (org.jetbrains.annotations.NotNull)2 Sdk (com.intellij.openapi.projectRoots.Sdk)1