1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.atlassian.theplugin.idea.action.crucible;
18
19
20 import com.atlassian.theplugin.idea.CrucibleReviewWindow;
21 import com.atlassian.theplugin.idea.IdeaHelper;
22 import com.atlassian.theplugin.idea.VcsIdeaHelper;
23 import com.atlassian.theplugin.idea.crucible.CrucibleTableToolWindowPanel;
24 import com.atlassian.theplugin.idea.crucible.ReviewData;
25 import com.atlassian.theplugin.idea.crucible.CrucibleConstants;
26 import com.atlassian.theplugin.idea.crucible.comments.CrucibleReviewActionListener;
27 import com.atlassian.theplugin.idea.crucible.events.ShowReviewEvent;
28 import com.intellij.openapi.actionSystem.AnActionEvent;
29 import com.intellij.openapi.actionSystem.DataKeys;
30 import com.intellij.openapi.project.Project;
31 import com.intellij.openapi.ui.Messages;
32
33 import javax.swing.*;
34
35 public class GetCommentsAction extends TableSelectedAction {
36
37 public void actionPerformed(final AnActionEvent e) {
38 Project project = IdeaHelper.getCurrentProject(e);
39
40
41 if (project != null && e.getPlace() != null
42 && e.getPlace().equals(CrucibleTableToolWindowPanel.PLACE_PREFIX + project.getName())) {
43 if (!VcsIdeaHelper.isUnderVcsControl(e)) {
44 Messages.showInfoMessage(project, CrucibleConstants.CRUCIBLE_MESSAGE_NOT_UNDER_VCS,
45 CrucibleConstants.CRUCIBLE_TITLE_NOT_UNDER_VCS);
46
47 } else {
48 CrucibleReviewWindow.getInstance(project);
49 super.actionPerformed(e);
50 }
51 }
52
53 }
54
55 protected void itemSelected(final Project project, Object row) {
56
57 IdeaHelper.getReviewActionEventBroker(project).trigger(new ShowReviewEvent(
58 CrucibleReviewActionListener.ANONYMOUS, (ReviewData) row));
59
60 }
61 }