private void doUpdate(@Nullable Runnable onComplete) { try { List<Task> issues = getIssuesFromRepositories( null, myConfig.updateIssuesCount, 0, false, new EmptyProgressIndicator()); if (issues == null) return; synchronized (myIssueCache) { myIssueCache.clear(); for (Task issue : issues) { myIssueCache.put(issue.getId(), issue); } } // update local tasks synchronized (myTasks) { for (Map.Entry<String, LocalTask> entry : myTasks.entrySet()) { Task issue = myIssueCache.get(entry.getKey()); if (issue != null) { entry.getValue().updateFromIssue(issue); } } } } finally { if (onComplete != null) { onComplete.run(); } myUpdating = false; } }
public String suggestBranchName(Task task) { if (task.isIssue() && StringUtil.isNotEmpty(task.getNumber())) { return task.getId().replace(' ', '-'); } else { String summary = task.getSummary(); List<String> words = StringUtil.getWordsIn(summary); String[] strings = ArrayUtil.toStringArray(words); return StringUtil.join(strings, 0, Math.min(2, strings.length), "-"); } }
@Override public String convert(Task o) { return o.getId(); }