Search in sources :

Example 1 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class CreateBranchOrTagDialog method isOKActionEnabled.

public boolean isOKActionEnabled() {
    myErrorLabel.setText(" ");
    if (myURL == null) {
        return false;
    }
    if (myBranchOrTagRadioButton.isSelected() && myBranchTagBaseComboBox.getComboBox().getSelectedItem() == null) {
        myErrorLabel.setText(SvnBundle.message("create.branch.no.base.location.error"));
        return false;
    }
    String url = getToURL();
    if (url != null && url.trim().length() > 0) {
        if (myRepositoryRadioButton.isSelected()) {
            SVNRevision revision;
            try {
                revision = myRevisionPanel.getRevision();
            } catch (ConfigurationException e) {
                revision = SVNRevision.UNDEFINED;
            }
            if (!revision.isValid() || revision.isLocal()) {
                myErrorLabel.setText(SvnBundle.message("create.branch.invalid.revision.error", myRevisionPanel.getRevisionText()));
                return false;
            }
            return true;
        } else if (myWorkingCopyRadioButton.isSelected()) {
            Info info = SvnVcs.getInstance(myProject).getInfo(mySrcFile);
            String srcUrl = info != null && info.getURL() != null ? info.getURL().toString() : null;
            if (srcUrl == null) {
                myErrorLabel.setText(SvnBundle.message("create.branch.no.working.copy.error", myWorkingCopyField.getText()));
                return false;
            }
            return true;
        }
    }
    return false;
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) Info(org.jetbrains.idea.svn.info.Info)

Example 2 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class SvnUpdateRootOptionsPanel method apply.

public void apply(final SvnConfiguration configuration) throws ConfigurationException {
    final UpdateRootInfo rootInfo = configuration.getUpdateRootInfo(myRoot.getIOFile(), myVcs);
    if (myUpdateToSpecificUrl.isSelected()) {
        try {
            rootInfo.setUrl(SvnUtil.createUrl(myURLText.getText(), false));
        } catch (SvnBindException e) {
            throw new ConfigurationException("Invalid url: " + myURLText.getText());
        }
    }
    rootInfo.setUpdateToRevision(myRevisionBox.isSelected());
    final SVNRevision revision = SVNRevision.parse(myRevisionText.getText());
    if (!revision.isValid()) {
        throw new ConfigurationException(SvnBundle.message("invalid.svn.revision.error.message", myRevisionText.getText()));
    }
    rootInfo.setRevision(revision);
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) ConfigurationException(com.intellij.openapi.options.ConfigurationException) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision)

Example 3 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class PythonGenerateProjectCallback method addDetectedSdk.

private static Sdk addDetectedSdk(ProjectSpecificSettingsStep settingsStep, Sdk sdk) {
    final Project project = ProjectManager.getInstance().getDefaultProject();
    final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel();
    final String name = sdk.getName();
    VirtualFile sdkHome = ApplicationManager.getApplication().runWriteAction((Computable<VirtualFile>) () -> LocalFileSystem.getInstance().refreshAndFindFileByPath(name));
    sdk = SdkConfigurationUtil.createAndAddSDK(sdkHome.getPath(), PythonSdkType.getInstance());
    if (sdk != null) {
        PythonSdkUpdater.updateOrShowError(sdk, null, project, null);
    }
    model.addSdk(sdk);
    settingsStep.setSdk(sdk);
    try {
        model.apply();
    } catch (ConfigurationException exception) {
        LOG.error("Error adding detected python interpreter " + exception.getMessage());
    }
    return sdk;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) ProjectSdksModel(com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel) ConfigurationException(com.intellij.openapi.options.ConfigurationException)

Example 4 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class PythonSdkChooserCombo method showOptions.

private void showOptions(final Project project) {
    final PyConfigurableInterpreterList interpreterList = PyConfigurableInterpreterList.getInstance(project);
    final Sdk[] sdks = interpreterList.getModel().getSdks();
    //noinspection unchecked
    final JComboBox<Sdk> comboBox = getComboBox();
    final Sdk oldSelectedSdk = (Sdk) comboBox.getSelectedItem();
    PythonSdkDetailsStep.show(project, sdks, null, this, getButton().getLocationOnScreen(), sdk -> {
        if (sdk == null)
            return;
        final ProjectSdksModel projectSdksModel = interpreterList.getModel();
        if (projectSdksModel.findSdk(sdk) == null) {
            projectSdksModel.addSdk(sdk);
            try {
                projectSdksModel.apply();
            } catch (ConfigurationException e) {
                LOG.error("Error adding new python interpreter " + e.getMessage());
            }
        }
        final List<Sdk> committedSdks = interpreterList.getAllPythonSdks();
        final Sdk copiedSdk = interpreterList.getModel().findSdk(sdk.getName());
        comboBox.setModel(new CollectionComboBoxModel<>(committedSdks, oldSelectedSdk));
        comboBox.setSelectedItem(copiedSdk);
    }, true);
}
Also used : PyConfigurableInterpreterList(com.jetbrains.python.configuration.PyConfigurableInterpreterList) ProjectSdksModel(com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel) ConfigurationException(com.intellij.openapi.options.ConfigurationException) Sdk(com.intellij.openapi.projectRoots.Sdk)

Example 5 with ConfigurationException

use of com.intellij.openapi.options.ConfigurationException in project intellij-community by JetBrains.

the class BuildoutConfigurable method apply.

@Override
public void apply() throws ConfigurationException {
    final BuildoutFacet facet = myModule != null ? BuildoutFacet.getInstance(myModule) : null;
    final boolean got_facet = facet != null;
    boolean facet_is_desired = myEnabledCheckbox.isSelected();
    mySettingsPanel.apply();
    List<String> paths_from_script;
    if (facet_is_desired) {
        String script_name = mySettingsPanel.getScriptName();
        VirtualFile script_file = BuildoutConfigPanel.getScriptFile(script_name);
        paths_from_script = BuildoutFacet.extractBuildoutPaths(script_file);
        if (paths_from_script == null) {
            throw new ConfigurationException("Failed to extract paths from '" + script_file.getPresentableName() + "'");
        }
        mySettingsPanel.getConfiguration().setPaths(paths_from_script);
    }
    if (facet_is_desired && !got_facet)
        addFacet(mySettingsPanel.getConfiguration());
    if (!facet_is_desired && got_facet)
        removeFacet(facet);
    if (facet_is_desired)
        BuildoutFacet.attachLibrary(myModule);
    else
        BuildoutFacet.detachLibrary(myModule);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ConfigurationException(com.intellij.openapi.options.ConfigurationException)

Aggregations

ConfigurationException (com.intellij.openapi.options.ConfigurationException)102 File (java.io.File)25 VirtualFile (com.intellij.openapi.vfs.VirtualFile)24 Project (com.intellij.openapi.project.Project)22 Module (com.intellij.openapi.module.Module)18 IOException (java.io.IOException)14 NotNull (org.jetbrains.annotations.NotNull)11 Nullable (org.jetbrains.annotations.Nullable)8 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)7 Sdk (com.intellij.openapi.projectRoots.Sdk)7 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)6 Disposable (com.intellij.openapi.Disposable)4 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)4 Pair (com.intellij.openapi.util.Pair)4 GradleProjectImporter (com.android.tools.idea.gradle.project.importing.GradleProjectImporter)3 ExecutionException (com.intellij.execution.ExecutionException)3 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)3 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)3 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)3