|
41 | 41 | */ |
42 | 42 | package com.junichi11.netbeans.modules.github.issues.issue; |
43 | 43 |
|
| 44 | +import com.junichi11.netbeans.modules.github.issues.GitHubIssueState; |
44 | 45 | import com.junichi11.netbeans.modules.github.issues.repository.GitHubRepository; |
45 | 46 | import java.beans.PropertyChangeListener; |
46 | 47 | import java.beans.PropertyChangeSupport; |
|
50 | 51 | import java.util.Date; |
51 | 52 | import java.util.LinkedList; |
52 | 53 | import java.util.List; |
| 54 | +import java.util.logging.Level; |
| 55 | +import java.util.logging.Logger; |
53 | 56 | import javax.swing.JTable; |
54 | 57 | import org.eclipse.egit.github.core.Comment; |
55 | 58 | import org.eclipse.egit.github.core.Issue; |
@@ -79,6 +82,7 @@ public final class GitHubIssue { |
79 | 82 | public static final String LABEL_NAME_UPDATED = "github.issue.updated"; // NOI18N |
80 | 83 | public static final String LABEL_NAME_CREATED_BY = "github.issue.created.by"; // NOI18N |
81 | 84 | public static final String LABEL_NAME_ASSIGNEE = "github.issue.assignee"; // NOI18N |
| 85 | + private static final Logger LOGGER = Logger.getLogger(GitHubIssue.class.getName()); |
82 | 86 |
|
83 | 87 | public GitHubIssue(GitHubRepository repository) { |
84 | 88 | this(repository, null); |
@@ -194,8 +198,19 @@ public void refreshIssue() { |
194 | 198 | getRepository().refresh(this); |
195 | 199 | } |
196 | 200 |
|
197 | | - public void addComment(String comment, boolean reresolveAsFixed) { |
198 | | - // TODO addComment |
| 201 | + public void addComment(String comment, boolean resolveAsFixed) { |
| 202 | + if (resolveAsFixed) { |
| 203 | + // close an issue |
| 204 | + Issue i = getIssue(); |
| 205 | + if (i != null) { |
| 206 | + GitHubIssueState state = GitHubIssueState.toEnum(i.getState()); |
| 207 | + if (state != GitHubIssueState.OPEN) { |
| 208 | + LOGGER.log(Level.INFO, "This issue({0} #{1}) state is already closed.", new Object[]{i.getTitle(), i.getNumber()}); // NOI18N |
| 209 | + return; |
| 210 | + } |
| 211 | + GitHubIssueSupport.closeReopen(this); |
| 212 | + } |
| 213 | + } |
199 | 214 | } |
200 | 215 |
|
201 | 216 | public void attachFile(File file, String string, boolean bln) { |
|
0 commit comments