/** * 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); }
/** * 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()); }
/** * 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)); }