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