vcs: Added "Show unversioned files in Commit dialog" option to "Version Control" settings (to control if unversioned files should be shown in "Commit Changes" dialog)

This commit is contained in:
Konstantin Kolosovsky
2016-03-29 16:38:04 +03:00
parent 293a731010
commit 2d6b411ee0
3 changed files with 17 additions and 1 deletions
@@ -83,6 +83,7 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
public boolean USE_COMMIT_MESSAGE_MARGIN = false;
public int COMMIT_MESSAGE_MARGIN_SIZE = 72;
public boolean WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = false;
public boolean SHOW_UNVERSIONED_FILES_WHILE_COMMIT = false;
public boolean LOCAL_CHANGES_DETAILS_PREVIEW_SHOWN = false;
@AbstractCollection(surroundWithTag = false, elementTag = "path")
@@ -289,6 +289,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
myBrowser = new AlienChangeListBrowser(project, changeLists, changes, initialSelection, true, true, singleVcs);
} else {
//noinspection unchecked
boolean showUnversioned = myShowVcsCommit && VcsConfiguration.getInstance(myProject).SHOW_UNVERSIONED_FILES_WHILE_COMMIT;
MultipleChangeListBrowser browser = new MultipleChangeListBrowser(project, changeLists, (List)changes, initialSelection, true, true,
new Runnable() {
@Override
@@ -303,7 +304,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
handler.includedChangesChanged();
}
}
}, myShowVcsCommit) {
}, showUnversioned) {
@Override
protected void afterDiffRefresh() {
myBrowser.rebuildList();
@@ -85,6 +85,7 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
private final VcsLimitHistoryConfigurable myLimitHistory;
private final VcsUpdateInfoScopeFilterConfigurable myScopeFilterConfig;
private VcsCommitMessageMarginConfigurable myCommitMessageMarginConfigurable;
private JCheckBox myShowUnversionedFiles;
private static class MapInfo {
static final MapInfo SEPARATOR = new MapInfo(new VcsDirectoryMapping("SEPARATOR", "SEP"), Type.SEPARATOR);
@@ -387,6 +388,7 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
myBaseRevisionTexts.setSelected(myVcsConfiguration.INCLUDE_TEXT_INTO_SHELF);
myShowChangedRecursively.setSelected(myVcsConfiguration.SHOW_DIRTY_RECURSIVELY);
myCommitMessageMarginConfigurable.reset();
myShowUnversionedFiles.setSelected(myVcsConfiguration.SHOW_UNVERSIONED_FILES_WHILE_COMMIT);
}
@NotNull
@@ -521,6 +523,7 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
panel.add(createShowChangedOption(), gb.nextLine().next());
panel.add(myScopeFilterConfig.createComponent(), gb.nextLine().next());
panel.add(createUseCommitMessageRightMargin(), gb.nextLine().next().fillCellHorizontally());
panel.add(createShowUnversionedFilesOption(), gb.nextLine().next());
return panel;
}
@@ -644,6 +647,13 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
return myShowChangedRecursively;
}
@NotNull
private JComponent createShowUnversionedFilesOption() {
myShowUnversionedFiles =
new JCheckBox("Show unversioned files in Commit dialog", myVcsConfiguration.SHOW_UNVERSIONED_FILES_WHILE_COMMIT);
return myShowUnversionedFiles;
}
@Override
public void reset() {
initializeModel();
@@ -658,6 +668,7 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
myVcsConfiguration.INCLUDE_TEXT_INTO_SHELF = myBaseRevisionTexts.isSelected();
myVcsConfiguration.SHOW_DIRTY_RECURSIVELY = myShowChangedRecursively.isSelected();
myCommitMessageMarginConfigurable.apply();
myVcsConfiguration.SHOW_UNVERSIONED_FILES_WHILE_COMMIT = myShowUnversionedFiles.isSelected();
initializeModel();
}
@@ -673,6 +684,9 @@ public class VcsDirectoryConfigurationPanel extends JPanel implements Configurab
if (myCommitMessageMarginConfigurable.isModified()) {
return true;
}
if (myVcsConfiguration.SHOW_UNVERSIONED_FILES_WHILE_COMMIT != myShowUnversionedFiles.isSelected()) {
return true;
}
return !getModelMappings().equals(myVcsManager.getDirectoryMappings());
}