1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.atlassian.theplugin.idea.crucible;
17
18 import com.atlassian.theplugin.commons.crucible.CrucibleServerFacade;
19 import com.atlassian.theplugin.commons.crucible.api.model.Review;
20 import com.atlassian.theplugin.commons.exception.ServerPasswordNotProvidedException;
21 import com.atlassian.theplugin.commons.remoteapi.RemoteApiException;
22 import com.atlassian.theplugin.commons.remoteapi.ServerData;
23 import com.atlassian.theplugin.idea.config.ProjectCfgManagerImpl;
24 import com.intellij.openapi.project.Project;
25 import com.intellij.openapi.vcs.changes.ChangeList;
26 import org.jetbrains.annotations.NotNull;
27
28 public class CrucibleCreatePostCommitReviewFromChangeListForm extends AbstractCrucibleCreatePostCommitReviewForm {
29 private final ChangeList[] changes;
30
31 private static String getReviewTitle(final ChangeList[] changes) {
32 if (changes != null && changes.length == 1) {
33 return changes[0].getName();
34 } else {
35 return "";
36 }
37
38 }
39
40 public CrucibleCreatePostCommitReviewFromChangeListForm(final Project project,
41 final CrucibleServerFacade crucibleServerFacade,
42 final ChangeList[] changes, @NotNull final ProjectCfgManagerImpl projectCfgManager) {
43 super(project, crucibleServerFacade, getReviewTitle(changes), projectCfgManager);
44 this.changes = changes;
45 setCustomComponent(null);
46 pack();
47 }
48
49 @Override
50 protected Review createReview(final ServerData server, final ReviewProvider reviewProvider)
51 throws RemoteApiException, ServerPasswordNotProvidedException {
52 return createReviewImpl(server, reviewProvider, changes);
53 }
54
55 }