@Override
    protected void uploadKey(final File sskKey) {
      FeatureUsageTracker.getInstance()
          .triggerFeatureUsed(CloudFeaturesProvider.UPLOAD_SSH_KEY_FEATURE_ID);
      try {
        myServerConfigurable.apply();
      } catch (ConfigurationException e) {
        Messages.showErrorDialog("Cannot upload SSH key: " + e.getMessage(), e.getTitle());
        return;
      }

      RemoteServer<C> server =
          new RemoteServerImpl<C>(
              "<temp server to upload ssh key>", myServerType, myServerConfiguration);

      CloudConnectionTask task =
          new CloudConnectionTask(null, "Uploading SSH key", server) {

            @Override
            protected Object run(CloudServerRuntimeInstance serverRuntime)
                throws ServerRuntimeException {
              ((SshKeyAwareServerRuntime) serverRuntime).addSshKey(sskKey);
              return null;
            }
          };
      task.performSync();
      task.showMessageDialog(myLabel, "SSH key was uploaded", "Public SSH Key");
    }
  private ValidationResult getValidationResult() {
    if (!myValidationResultValid) {
      myLastValidationResult = null;
      try {
        RunnerAndConfigurationSettings snapshot = getSnapshot();
        if (snapshot != null) {
          snapshot.setName(getNameText());
          snapshot.checkSettings();
          for (ProgramRunner runner : RunnerRegistry.getInstance().getRegisteredRunners()) {
            for (Executor executor : ExecutorRegistry.getInstance().getRegisteredExecutors()) {
              if (runner.canRun(executor.getId(), snapshot.getConfiguration())) {
                checkConfiguration(runner, snapshot);
                break;
              }
            }
          }
        }
      } catch (RuntimeConfigurationException exception) {
        myLastValidationResult =
            exception != null
                ? new ValidationResult(
                    exception.getLocalizedMessage(), exception.getTitle(), exception.getQuickFix())
                : null;
      } catch (ConfigurationException e) {
        myLastValidationResult =
            new ValidationResult(
                e.getLocalizedMessage(),
                ExecutionBundle.message("invalid.data.dialog.title"),
                null);
      }

      myValidationResultValid = true;
    }
    return myLastValidationResult;
  }
Example #3
0
 private void updateUi() {
   try {
     check_gxk3ze_a0a0a51(myEditor.getSnapshot());
     myErrorLabel.setText("");
     myApplyAction.setEnabled(myIsModified);
     myResetAction.setEnabled(myIsModified);
   } catch (ConfigurationException e) {
     myErrorLabel.setText(e.getMessage());
   }
 }
 private boolean commitStepData(final ModuleWizardStep step) {
   try {
     if (!step.validate()) {
       return false;
     }
   } catch (ConfigurationException e) {
     Messages.showErrorDialog(myCurrentProject, e.getMessage(), e.getTitle());
     return false;
   }
   step.updateDataModel();
   return true;
 }
 @Override
 protected void doOKAction() {
   try {
     myProjectJdk = myConfigurable.getSelectedJdk(); // before dispose
     myConfigurable.apply();
     super.doOKAction();
   } catch (ConfigurationException e) {
     Messages.showMessageDialog(
         getContentPane(), e.getMessage(),
         ProjectBundle.message("sdk.configure.save.settings.error"), Messages.getErrorIcon());
   }
 }
  @Override
  public void consume(@Nullable AbstractProjectSettingsStep settingsStep) {
    if (myRunnable != null) {
      myRunnable.run();
    }
    if (settingsStep == null) return;

    Sdk sdk = settingsStep.getSdk();
    final Project project = ProjectManager.getInstance().getDefaultProject();
    final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel();
    if (sdk instanceof PyDetectedSdk) {
      final String name = sdk.getName();
      VirtualFile sdkHome =
          ApplicationManager.getApplication()
              .runWriteAction(
                  new Computable<VirtualFile>() {
                    @Override
                    public VirtualFile compute() {
                      return LocalFileSystem.getInstance().refreshAndFindFileByPath(name);
                    }
                  });
      PySdkService.getInstance().solidifySdk(sdk);
      sdk =
          SdkConfigurationUtil.setupSdk(
              ProjectJdkTable.getInstance().getAllJdks(),
              sdkHome,
              PythonSdkType.getInstance(),
              true,
              null,
              null);
      model.addSdk(sdk);
      settingsStep.setSdk(sdk);
      try {
        model.apply();
      } catch (ConfigurationException exception) {
        LOG.error("Error adding detected python interpreter " + exception.getMessage());
      }
    }
    Project newProject = generateProject(project, settingsStep);
    if (newProject != null) {
      SdkConfigurationUtil.setDirectoryProjectSdk(newProject, sdk);
      final List<Sdk> sdks = PythonSdkType.getAllSdks();
      for (Sdk s : sdks) {
        final SdkAdditionalData additionalData = s.getSdkAdditionalData();
        if (additionalData instanceof PythonSdkAdditionalData) {
          ((PythonSdkAdditionalData) additionalData).reassociateWithCreatedProject(newProject);
        }
      }
    }
  }
 protected void doOKAction() {
   for (Configurable configurable : myEnvToConfMap.values()) {
     try {
       configurable.apply();
     } catch (CancelledConfigurationException e) {
       return;
     } catch (ConfigurationException e) {
       Messages.showErrorDialog(
           myProject,
           VcsBundle.message("messge.text.cannot.save.settings", e.getLocalizedMessage()),
           getRealTitle());
       return;
     }
   }
   super.doOKAction();
 }