Tasks. 1. Bug with task search. 2. Goto task popup list is smaller for faster search.

This commit is contained in:
Evgeny Zakrevsky
2012-11-08 23:38:28 +04:00
parent d41e8927d8
commit e46dda907b
4 changed files with 15 additions and 6 deletions
@@ -1537,6 +1537,10 @@ public abstract class ChooseByNameBase {
return myMaximumListSizeLimit;
}
public void setMaximumListSizeLimit(final int maximumListSizeLimit) {
myMaximumListSizeLimit = maximumListSizeLimit;
}
private static final String ACTION_NAME = "Show All in View";
private abstract class ShowFindUsagesAction extends AnAction {
@@ -61,8 +61,8 @@ public class GotoTaskAction extends GotoActionBase {
boolean everywhere,
@NotNull ProgressIndicator cancelled,
@NotNull Processor<Object> consumer) {
List<Task> cachedTasks = TaskSearchSupport.getLocalAndCachedTasks(TaskManager.getManager(project), pattern, everywhere);
List<TaskPsiElement> taskPsiElements = ContainerUtil.map(cachedTasks, new Function<Task, TaskPsiElement>() {
List<Task> cachedAndLocalTasks = TaskSearchSupport.getLocalAndCachedTasks(TaskManager.getManager(project), pattern, everywhere);
List<TaskPsiElement> taskPsiElements = ContainerUtil.map(cachedAndLocalTasks, new Function<Task, TaskPsiElement>() {
@Override
public TaskPsiElement fun(Task task) {
return new TaskPsiElement(PsiManager.getInstance(project), task);
@@ -86,7 +86,7 @@ public class GotoTaskAction extends GotoActionBase {
List<Task> tasks =
TaskSearchSupport.getRepositoriesTasks(TaskManager.getManager(project), pattern, base.getMaximumListSizeLimit(), 0, true, everywhere);
tasks.removeAll(cachedTasks);
tasks.removeAll(cachedAndLocalTasks);
taskPsiElements = ContainerUtil.map(tasks, new Function<Task, TaskPsiElement>() {
@Override
public TaskPsiElement fun(Task task) {
@@ -105,7 +105,7 @@ public class GotoTaskAction extends GotoActionBase {
}
return true;
}
}, "", false, 0);
}, null, false, 0);
popup.setShowListForEmptyPattern(true);
popup.setSearchInAnyPlace(true);
popup.setAdText("<html>Press SHIFT to merge with current context<br/>" +
@@ -132,6 +132,7 @@ public class GotoTaskAction extends GotoActionBase {
final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
actionToolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
popup.setToolArea(actionToolbar.getComponent());
popup.setMaximumListSizeLimit(10);
showNavigationPopup(new GotoActionCallback<Object>() {
@Override
@@ -99,7 +99,11 @@ public class GenericRepository extends BaseRepositoryImpl {
tasks.add(new GenericTask(id, summary, this));
}
tasks = TaskSearchSupport.filterTasks(query != null ? query : "", tasks);
final boolean searchSupported = getTasksListURL().contains(QUERY_PLACEHOLDER);
if (!searchSupported) {
tasks = TaskSearchSupport.filterTasks(query != null ? query : "", tasks);
}
tasks = tasks.subList(0, Math.min(max, tasks.size()));
return tasks.toArray(new Task[tasks.size()]);
@@ -239,7 +239,7 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe
List<Task> tasks = getIssuesFromRepositories(query, max, since, forceRequest);
if (tasks == null) return getCachedIssues(withClosed);
myIssueCache.putAll(ContainerUtil.newMapFromValues(tasks.iterator(), KEY_CONVERTOR));
return ContainerUtil.filter(myIssueCache.values(), new Condition<Task>() {
return ContainerUtil.filter(tasks, new Condition<Task>() {
@Override
public boolean value(final Task task) {
return withClosed || !task.isClosed();