Ejemplo 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));
 }
Ejemplo n.º 2
0
 /**
  * Save configuration panel state into settings object
  *
  * @param settings the settings object
  */
 public void save(@NotNull GitVcsSettings settings) {
   settings.getAppSettings().setPathToGit(myGitField.getText());
   myVcs.checkVersion();
   settings.setIdeaSsh(IDEA_SSH.equals(mySSHExecutableComboBox.getSelectedItem()));
   Object policyItem = myConvertTextFilesComboBox.getSelectedItem();
   GitVcsSettings.ConversionPolicy conversionPolicy;
   if (CRLF_DO_NOT_CONVERT.equals(policyItem)) {
     conversionPolicy = GitVcsSettings.ConversionPolicy.NONE;
   } else if (CRLF_CONVERT_TO_PROJECT.equals(policyItem)) {
     conversionPolicy = GitVcsSettings.ConversionPolicy.CONVERT;
   } else if (CRLF_ASK.equals(policyItem)) {
     conversionPolicy = GitVcsSettings.ConversionPolicy.ASK;
   } else {
     throw new IllegalStateException("Unknown selected CRLF policy: " + policyItem);
   }
   settings.setLineSeparatorsConversion(conversionPolicy);
 }
Ejemplo n.º 3
0
 /**
  * Get crlf policy item from settings
  *
  * @param settings the settings object
  * @return the item in crlf combobox
  */
 private static String crlfPolicyItem(GitVcsSettings settings) {
   String crlf;
   switch (settings.getLineSeparatorsConversion()) {
     case NONE:
       crlf = CRLF_DO_NOT_CONVERT;
       break;
     case CONVERT:
       crlf = CRLF_CONVERT_TO_PROJECT;
       break;
     case ASK:
       crlf = CRLF_ASK;
       break;
     default:
       assert false : "Unknown crlf policy: " + settings.getLineSeparatorsConversion();
       crlf = null;
   }
   return crlf;
 }
Ejemplo n.º 4
0
 /**
  * Check if fields has been modified with respect to settings object
  *
  * @param settings the settings to load
  */
 public boolean isModified(@NotNull GitVcsSettings settings) {
   return !settings.getAppSettings().getPathToGit().equals(myGitField.getText())
       || (settings.isIdeaSsh() != IDEA_SSH.equals(mySSHExecutableComboBox.getSelectedItem()))
       || !crlfPolicyItem(settings).equals(myConvertTextFilesComboBox.getSelectedItem());
 }
Ejemplo n.º 5
0
 /**
  * Load settings into the configuration panel
  *
  * @param settings the settings to load
  */
 public void load(@NotNull GitVcsSettings settings) {
   myGitField.setText(settings.getAppSettings().getPathToGit());
   mySSHExecutableComboBox.setSelectedItem(settings.isIdeaSsh() ? IDEA_SSH : NATIVE_SSH);
   myConvertTextFilesComboBox.setSelectedItem(crlfPolicyItem(settings));
 }