diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/AlienLocalChangeList.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/AlienLocalChangeList.java index 18130b616ca8..908f98fcfd0a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/AlienLocalChangeList.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/AlienLocalChangeList.java @@ -29,7 +29,7 @@ public class AlienLocalChangeList extends LocalChangeList { private String myName; private String myComment; - public AlienLocalChangeList(final List changes, final String name) { + public AlienLocalChangeList(@NotNull List changes, @NotNull String name) { myChanges = changes; myName = name; myComment = ""; 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 6f2b036bd787..9532b03e3bd0 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,8 +129,11 @@ 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) { + public static void commitPaths(@NotNull Project project, + @NotNull Collection paths, + @Nullable LocalChangeList initialSelection, + @Nullable CommitExecutor executor, + @Nullable String comment) { final ChangeListManager manager = ChangeListManager.getInstance(project); final Collection changes = new HashSet<>(); for (FilePath path : paths) { @@ -140,8 +143,11 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj 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) { + public static boolean commitChanges(@NotNull Project project, + @NotNull Collection changes, + @Nullable LocalChangeList initialSelection, + @Nullable final CommitExecutor executor, + @Nullable String comment) { if (executor == null) { return commitChanges(project, changes, initialSelection, collectExecutors(project, changes), true, comment, null); } @@ -152,36 +158,40 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj /** * 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, + public static boolean commitChanges(@NotNull Project project, + @NotNull Collection changes, + @Nullable LocalChangeList initialSelection, + @NotNull List executors, + boolean showVcsCommit, + @Nullable String comment, @Nullable CommitResultHandler customResultHandler) { - return commitChanges(project, new ArrayList<>(changes), initialSelection, executors, showVcsCommit, comment, - customResultHandler, true); + 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, - final List executors, - final boolean showVcsCommit, - final String comment, + public static boolean commitChanges(@NotNull Project project, + @NotNull List changes, + @Nullable LocalChangeList initialSelection, + @NotNull List executors, + boolean showVcsCommit, + @Nullable String comment, @Nullable CommitResultHandler customResultHandler, boolean cancelIfNoChanges) { return commitChanges(project, changes, initialSelection, executors, showVcsCommit, null, comment, customResultHandler, cancelIfNoChanges); } - public static boolean commitChanges(final Project project, - final List changes, - final LocalChangeList initialSelection, - final List executors, - final boolean showVcsCommit, + public static boolean commitChanges(@NotNull Project project, + @NotNull List changes, + @Nullable LocalChangeList initialSelection, + @NotNull List executors, + boolean showVcsCommit, @Nullable final AbstractVcs singleVcs, - final String comment, + @Nullable String comment, @Nullable CommitResultHandler customResultHandler, boolean cancelIfNoChanges) { if (cancelIfNoChanges && changes.isEmpty() && !ApplicationManager.getApplication().isUnitTestMode()) { @@ -217,11 +227,13 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj return dialog.isOK(); } + @NotNull private static List getCheckInFactories(@NotNull Project project) { return CheckinHandlersManager.getInstance().getRegisteredCheckinHandlerFactories( ProjectLevelVcsManager.getInstance(project).getAllActiveVcss()); } + @NotNull public static List collectExecutors(@NotNull Project project, @NotNull Collection changes) { List result = new ArrayList<>(); for (AbstractVcs vcs : ChangesUtil.getAffectedVcses(changes, project)) { @@ -231,8 +243,11 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj return result; } - public static void commitAlienChanges(final Project project, final List changes, final AbstractVcs vcs, - final String changelistName, final String comment) { + public static void commitAlienChanges(@NotNull Project project, + @NotNull List changes, + @NotNull AbstractVcs vcs, + @NotNull String changelistName, + @Nullable String comment) { final LocalChangeList lcl = new AlienLocalChangeList(changes, changelistName); new CommitChangeListDialog(project, changes, null, null, true, AlienLocalChangeList.DEFAULT_ALIEN, Collections.singletonList(lcl), vcs, true, comment, null).show(); @@ -907,7 +922,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj compoundResultRef.set(proceedRunnable.compute()); } }; - for(final CheckinHandler handler: myHandlers) { + for (final CheckinHandler handler : myHandlers) { if (handler instanceof CheckinMetaHandler) { final Runnable previousRunnable = runnable; runnable = new Runnable() { @@ -993,7 +1008,10 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj TITLE, getCommitMessage(), myHandlers, - myAllOfDefaultChangeListChangesIncluded, false, myAdditionalData, customResultHandler); + myAllOfDefaultChangeListChangesIncluded, + false, + myAdditionalData, + customResultHandler); if (myIsAlien) { helper.doAlienCommit(mySingleVcs); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java index 9fc8270670b1..46e465113007 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java @@ -83,7 +83,8 @@ public class CommitHelper { final String commitMessage, final List handlers, final boolean allOfDefaultChangeListChangesIncluded, - final boolean synchronously, final NullableFunction additionalDataHolder, + final boolean synchronously, + final NullableFunction additionalDataHolder, @Nullable CommitResultHandler customResultHandler) { myProject = project; myChangeList = changeList; @@ -108,7 +109,7 @@ public class CommitHelper { return doCommit(new CommitProcessor(vcs)); } - public boolean doAlienCommit(final AbstractVcs vcs) { + public boolean doAlienCommit(@NotNull AbstractVcs vcs) { return doCommit(new AlienCommitProcessor(vcs)); } @@ -292,9 +293,9 @@ public class CommitHelper { } private class AlienCommitProcessor extends GeneralCommitProcessor { - private final AbstractVcs myVcs; + @NotNull private final AbstractVcs myVcs; - private AlienCommitProcessor(final AbstractVcs vcs) { + private AlienCommitProcessor(@NotNull AbstractVcs vcs) { myVcs = vcs; }