From d28b8cccea21973aa134685bea85228debdac439 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Thu, 24 Nov 2016 14:37:25 +0300 Subject: [PATCH] vcs: cleanup - rearrange methods --- .../changes/ui/CommitChangeListDialog.java | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java index be78315df714..6f2b036bd787 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java @@ -129,6 +129,40 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj private String myLastSelectedListName; + public static void commitPaths(final Project project, Collection paths, final LocalChangeList initialSelection, + @Nullable final CommitExecutor executor, final String comment) { + final ChangeListManager manager = ChangeListManager.getInstance(project); + final Collection changes = new HashSet<>(); + for (FilePath path : paths) { + changes.addAll(manager.getChangesIn(path)); + } + + commitChanges(project, changes, initialSelection, executor, comment); + } + + public static boolean commitChanges(final Project project, final Collection changes, final LocalChangeList initialSelection, + @Nullable final CommitExecutor executor, final String comment) { + if (executor == null) { + return commitChanges(project, changes, initialSelection, collectExecutors(project, changes), true, comment, null); + } + else { + return commitChanges(project, changes, initialSelection, Collections.singletonList(executor), false, comment, null); + } + } + + /** + * Shows the commit dialog, and performs the selected action: commit, commit & push, create patch, etc. + * @param customResultHandler If this is not null, after commit is completed, custom result handler is called instead of + * showing the default notification in case of commit or failure. + * @return true if user agreed to commit, false if he pressed "Cancel". + */ + public static boolean commitChanges(final Project project, final Collection changes, final LocalChangeList initialSelection, + final List executors, final boolean showVcsCommit, final String comment, + @Nullable CommitResultHandler customResultHandler) { + return commitChanges(project, new ArrayList<>(changes), initialSelection, executors, showVcsCommit, comment, + customResultHandler, true); + } + public static boolean commitChanges(final Project project, final List changes, final LocalChangeList initialSelection, @@ -188,34 +222,6 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj ProjectLevelVcsManager.getInstance(project).getAllActiveVcss()); } - // Used in plugins - @SuppressWarnings("unused") - @NotNull - public List getAdditionalComponents() { - return Collections.unmodifiableList(myAdditionalComponents); - } - - public static void commitPaths(final Project project, Collection paths, final LocalChangeList initialSelection, - @Nullable final CommitExecutor executor, final String comment) { - final ChangeListManager manager = ChangeListManager.getInstance(project); - final Collection changes = new HashSet<>(); - for (FilePath path : paths) { - changes.addAll(manager.getChangesIn(path)); - } - - commitChanges(project, changes, initialSelection, executor, comment); - } - - public static boolean commitChanges(final Project project, final Collection changes, final LocalChangeList initialSelection, - @Nullable final CommitExecutor executor, final String comment) { - if (executor == null) { - return commitChanges(project, changes, initialSelection, collectExecutors(project, changes), true, comment, null); - } - else { - return commitChanges(project, changes, initialSelection, Collections.singletonList(executor), false, comment, null); - } - } - public static List collectExecutors(@NotNull Project project, @NotNull Collection changes) { List result = new ArrayList<>(); for (AbstractVcs vcs : ChangesUtil.getAffectedVcses(changes, project)) { @@ -225,19 +231,6 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj return result; } - /** - * Shows the commit dialog, and performs the selected action: commit, commit & push, create patch, etc. - * @param customResultHandler If this is not null, after commit is completed, custom result handler is called instead of - * showing the default notification in case of commit or failure. - * @return true if user agreed to commit, false if he pressed "Cancel". - */ - public static boolean commitChanges(final Project project, final Collection changes, final LocalChangeList initialSelection, - final List executors, final boolean showVcsCommit, final String comment, - @Nullable CommitResultHandler customResultHandler) { - return commitChanges(project, new ArrayList<>(changes), initialSelection, executors, showVcsCommit, comment, - customResultHandler, true); - } - public static void commitAlienChanges(final Project project, final List changes, final AbstractVcs vcs, final String changelistName, final String comment) { final LocalChangeList lcl = new AlienLocalChangeList(changes, changelistName); @@ -1115,6 +1108,13 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj } } + // Used in plugins + @SuppressWarnings("unused") + @NotNull + public List getAdditionalComponents() { + return Collections.unmodifiableList(myAdditionalComponents); + } + private void updateButtons() { if (myDisposed || myUpdateDisabled) return; final boolean enabled = hasDiffs();