Exemplo n.º 1
0
 /**
  * The constructor
  *
  * @param project the context project
  */
 public GitVcsPanel(@NotNull Project project) {
   myVcs = GitVcs.getInstance(project);
   myAppSettings = GitVcsApplicationSettings.getInstance();
   myProjectSettings = GitVcsSettings.getInstance(project);
   myProject = project;
   mySSHExecutableComboBox.addItem(IDEA_SSH);
   mySSHExecutableComboBox.addItem(NATIVE_SSH);
   mySSHExecutableComboBox.setSelectedItem(
       GitVcsSettings.isDefaultIdeaSsh() ? IDEA_SSH : NATIVE_SSH);
   mySSHExecutableComboBox.setToolTipText(
       GitBundle.message(
           "git.vcs.config.ssh.mode.tooltip",
           ApplicationNamesInfo.getInstance().getFullProductName()));
   myTestButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           testConnection();
         }
       });
   myConvertTextFilesComboBox.addItem(CRLF_DO_NOT_CONVERT);
   myConvertTextFilesComboBox.addItem(CRLF_CONVERT_TO_PROJECT);
   myConvertTextFilesComboBox.addItem(CRLF_ASK);
   myConvertTextFilesComboBox.setSelectedItem(CRLF_ASK);
   myGitField.addBrowseFolderListener(
       GitBundle.getString("find.git.title"),
       GitBundle.getString("find.git.description"),
       project,
       new FileChooserDescriptor(true, false, false, false, false, false));
 }
Exemplo n.º 2
0
  /** Test availability of the connection */
  private void testConnection() {
    final String executable = myGitField.getText();
    if (myAppSettings != null) {
      myAppSettings.setPathToGit(executable);
    }
    final GitVersion version;
    try {
      version = GitVersion.identifyVersion(executable);
    } catch (Exception e) {
      Messages.showErrorDialog(
          myProject, e.getMessage(), GitBundle.getString("find.git.error.title"));
      return;
    }

    if (version.isSupported()) {
      Messages.showInfoMessage(
          myProject, version.toString(), GitBundle.getString("find.git.success.title"));
    } else {
      Messages.showWarningDialog(
          myProject,
          GitBundle.message("find.git.unsupported.message", version.toString(), GitVersion.MIN),
          GitBundle.getString("find.git.success.title"));
    }
  }