Search in sources :

Example 6 with ValidationResult

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;
}
Also used : PythonProjectGenerator(com.jetbrains.python.newProject.PythonProjectGenerator) WebProjectTemplate(com.intellij.ide.util.projectWizard.WebProjectTemplate) HideableDecorator(com.intellij.ui.HideableDecorator) ValidationResult(com.intellij.facet.ui.ValidationResult) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with ValidationResult

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();
}
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 8 with ValidationResult

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

Example 9 with ValidationResult

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();
}
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

ValidationResult (com.intellij.facet.ui.ValidationResult)9 NotNull (org.jetbrains.annotations.NotNull)6 Sdk (com.intellij.openapi.projectRoots.Sdk)3 FacetErrorPanel (com.intellij.facet.impl.ui.FacetErrorPanel)2 FacetEditorValidator (com.intellij.facet.ui.FacetEditorValidator)2 PythonProjectGenerator (com.jetbrains.python.newProject.PythonProjectGenerator)2 LibraryInfo (com.intellij.facet.ui.libraries.LibraryInfo)1 OldCustomLibraryDescription (com.intellij.ide.util.frameworkSupport.OldCustomLibraryDescription)1 WebProjectTemplate (com.intellij.ide.util.projectWizard.WebProjectTemplate)1 WizardInputField (com.intellij.ide.util.projectWizard.WizardInputField)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 Project (com.intellij.openapi.project.Project)1 CustomLibraryDescription (com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 WebProjectGenerator (com.intellij.platform.WebProjectGenerator)1 HideableDecorator (com.intellij.ui.HideableDecorator)1 PyFrameworkProjectGenerator (com.jetbrains.python.newProject.PyFrameworkProjectGenerator)1 PyPackage (com.jetbrains.python.packaging.PyPackage)1 PyDetectedSdk (com.jetbrains.python.sdk.PyDetectedSdk)1 File (java.io.File)1