diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsShowConfirmationOption.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsShowConfirmationOption.java index 0eb8ca02c32d..9322251a1871 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsShowConfirmationOption.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsShowConfirmationOption.java @@ -16,34 +16,27 @@ package com.intellij.openapi.vcs; public interface VcsShowConfirmationOption { + enum Value { - SHOW_CONFIRMATION(0), - DO_NOTHING_SILENTLY(1), - DO_ACTION_SILENTLY(2); + // NB: don't reorder enum values, otherwise you may break user settings based on the obsolete implementation + SHOW_CONFIRMATION, + DO_NOTHING_SILENTLY, + DO_ACTION_SILENTLY; - private final int myId; - - Value(final int id) { - myId = id; - } - - public int getId() { - return myId; - } - public String toString() { - return String.valueOf(myId); + // compatibility with the old implementation + return String.valueOf(ordinal()); } + @Deprecated public static Value fromString(String s){ - if (s == null) return SHOW_CONFIRMATION; if (s.equals("1")) return DO_NOTHING_SILENTLY; if (s.equals("2")) return DO_ACTION_SILENTLY; return SHOW_CONFIRMATION; } } - public static final VcsShowConfirmationOption STATIC_SHOW_CONFIRMATION = new VcsShowConfirmationOption() { + VcsShowConfirmationOption STATIC_SHOW_CONFIRMATION = new VcsShowConfirmationOption() { @Override public Value getValue() { return Value.SHOW_CONFIRMATION; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java index c9bfa4baeaa3..781e4fd949a6 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/VcsGeneralConfigurationPanel.java @@ -216,8 +216,10 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable { myForceNonEmptyComment.setSelected(settings.FORCE_NON_EMPTY_COMMENT); myClearInitialCommitMessage.setSelected(settings.CLEAR_INITIAL_COMMIT_MESSAGE); myCbOfferToMoveChanges.setSelected(settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT); - int id = settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS.getId(); - UIUtil.setSelectedButton(myEmptyChangelistRemovingGroup, id == 0 ? 0 : id == 1 ? 2 : 1); + VcsShowConfirmationOption.Value value = settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS; + UIUtil.setSelectedButton(myEmptyChangelistRemovingGroup, value == VcsShowConfirmationOption.Value.SHOW_CONFIRMATION + ? 0 + : value == VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY ? 2 : 1); myShowReadOnlyStatusDialog.setSelected(getReadOnlyStatusHandler().getState().SHOW_DIALOG); if (settings.MOVE_TO_FAILED_COMMIT_CHANGELIST == VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY) { myFailedCommitChangelistCombo.setSelectedIndex(0);