mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-81472: VCS: Option to leave the comment field empty by default
This commit is contained in:
@@ -126,6 +126,7 @@ public final class VcsConfiguration implements PersistentStateComponent<Element>
|
||||
}
|
||||
|
||||
public boolean FORCE_NON_EMPTY_COMMENT = false;
|
||||
public boolean CLEAR_INITIAL_COMMIT_MESSAGE = false;
|
||||
|
||||
private final ArrayList<String> myLastCommitMessages = new ArrayList<String>();
|
||||
public String LAST_COMMIT_MESSAGE = null;
|
||||
|
||||
+21
-14
@@ -321,20 +321,8 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
|
||||
|
||||
myCommitMessageArea = new CommitMessage(project);
|
||||
|
||||
if (comment != null) {
|
||||
setCommitMessage(comment);
|
||||
myLastKnownComment = comment;
|
||||
myLastSelectedListName = initialSelection == null ? myBrowser.getSelectedChangeList().getName() : initialSelection.getName();
|
||||
} else {
|
||||
updateComment();
|
||||
|
||||
if (StringUtil.isEmptyOrSpaces(myCommitMessageArea.getComment())) {
|
||||
setCommitMessage(VcsConfiguration.getInstance(project).LAST_COMMIT_MESSAGE);
|
||||
final String messageFromVcs = getInitialMessageFromVcs();
|
||||
if (messageFromVcs != null) {
|
||||
myCommitMessageArea.setText(messageFromVcs);
|
||||
}
|
||||
}
|
||||
if (!VcsConfiguration.getInstance(project).CLEAR_INITIAL_COMMIT_MESSAGE) {
|
||||
setComment(project, initialSelection, comment);
|
||||
}
|
||||
|
||||
myActionName = VcsBundle.message("commit.dialog.title");
|
||||
@@ -471,6 +459,24 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
|
||||
showDetailsIfSaved();
|
||||
}
|
||||
|
||||
private void setComment(Project project, LocalChangeList initialSelection, String comment) {
|
||||
if (comment != null) {
|
||||
setCommitMessage(comment);
|
||||
myLastKnownComment = comment;
|
||||
myLastSelectedListName = initialSelection == null ? myBrowser.getSelectedChangeList().getName() : initialSelection.getName();
|
||||
} else {
|
||||
updateComment();
|
||||
|
||||
if (StringUtil.isEmptyOrSpaces(myCommitMessageArea.getComment())) {
|
||||
setCommitMessage(VcsConfiguration.getInstance(project).LAST_COMMIT_MESSAGE);
|
||||
final String messageFromVcs = getInitialMessageFromVcs();
|
||||
if (messageFromVcs != null) {
|
||||
myCommitMessageArea.setText(messageFromVcs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showDetailsIfSaved() {
|
||||
String value = PropertiesComponent.getInstance().getValue(DETAILS_SHOW_OPTION);
|
||||
if (value != null) {
|
||||
@@ -710,6 +716,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
|
||||
}
|
||||
|
||||
private void updateComment() {
|
||||
if (VcsConfiguration.getInstance(getProject()).CLEAR_INITIAL_COMMIT_MESSAGE) return;
|
||||
final LocalChangeList list = (LocalChangeList) myBrowser.getSelectedChangeList();
|
||||
if (list == null || (list.getName().equals(myLastSelectedListName))) {
|
||||
return;
|
||||
|
||||
+11
-3
@@ -152,7 +152,7 @@
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<grid id="aa6eb" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="aa6eb" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -186,7 +186,7 @@
|
||||
</component>
|
||||
<grid id="da366" layout-manager="FlowLayout" hgap="5" vgap="2" flow-align="0">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -212,7 +212,7 @@
|
||||
</grid>
|
||||
<grid id="6c335" layout-manager="FlowLayout" hgap="5" vgap="2" flow-align="0">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -236,6 +236,14 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="65b72" class="javax.swing.JCheckBox" binding="myClearInitialCommitMessage">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Clear &initial commit message"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
|
||||
+9
@@ -28,6 +28,7 @@ import com.intellij.openapi.vfs.ReadonlyStatusHandler;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -62,6 +63,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
|
||||
private JCheckBox myCbOfferToMoveChanges;
|
||||
private JComboBox myFailedCommitChangelistCombo;
|
||||
private JComboBox myOnPatchCreation;
|
||||
private JCheckBox myClearInitialCommitMessage;
|
||||
private ButtonGroup myEmptyChangelistRemovingGroup;
|
||||
|
||||
public VcsGeneralConfigurationPanel(final Project project) {
|
||||
@@ -101,6 +103,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
|
||||
VcsConfiguration settings = VcsConfiguration.getInstance(myProject);
|
||||
|
||||
settings.FORCE_NON_EMPTY_COMMENT = myForceNonEmptyComment.isSelected();
|
||||
settings.CLEAR_INITIAL_COMMIT_MESSAGE = myClearInitialCommitMessage.isSelected();
|
||||
settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT = myCbOfferToMoveChanges.isSelected();
|
||||
settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS = getSelected(myEmptyChangelistRemovingGroup);
|
||||
settings.MOVE_TO_FAILED_COMMIT_CHANGELIST = getFailedCommitConfirm();
|
||||
@@ -120,6 +123,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
|
||||
settings.SHOW_PATCH_IN_EXPLORER = getShowPatchValue();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Boolean getShowPatchValue() {
|
||||
final int index = myOnPatchCreation.getSelectedIndex();
|
||||
if (index == 0) {
|
||||
@@ -176,6 +180,9 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
|
||||
if (settings.FORCE_NON_EMPTY_COMMENT != myForceNonEmptyComment.isSelected()){
|
||||
return true;
|
||||
}
|
||||
if (settings.CLEAR_INITIAL_COMMIT_MESSAGE != myClearInitialCommitMessage.isSelected()){
|
||||
return true;
|
||||
}
|
||||
if (settings.OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT != myCbOfferToMoveChanges.isSelected()){
|
||||
return true;
|
||||
}
|
||||
@@ -205,6 +212,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
|
||||
public void reset() {
|
||||
VcsConfiguration settings = VcsConfiguration.getInstance(myProject);
|
||||
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);
|
||||
@@ -291,6 +299,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getHelpTopic() {
|
||||
return "project.propVCSSupport.Confirmation";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user