TaskAttribute url = getAttribute(data, GoogleCodeAttribute.URL);
url.setValue(this.connector.getTaskUrl(repository.getUrl(), issueId));
}
IGoogleCodeClient client = getClient(repository);
IssueCommentsFeed comments = client.getAllComments(issueId, monitor);
if (!data.isNew()) {
addComments(issueId, data, comments, monitor);
}
// Set the completion date, this allows Mylyn mark the issue as
// completed
// There is no API for this so we make an educated guess
State state = issueEntry.getState();
if (!data.isNew() && Value.CLOSED == state.getValue()) {
// find the last comment that set the issue status to the current
// value
// it would be better to find the last comment to set that state to
// closed
// but as long as we can't do that this will have to do
// initialize with issue creation date in case we don't find any
// comments
DateTime closingDate = issueEntry.getPublished();
for (IssueCommentsEntry comment : comments.getEntries()) {
Updates updates = comment.getUpdates();
if (updates != null && issueEntry.getStatus().equals(updates.getStatus())) {
closingDate = comment.getPublished();
}
}