List<Task> (String pattern, boolean everywhere, ProgressIndicator cancelled) { int offset, limit; // pattern changed -> reset pagination if (!myOldPattern.equals(pattern)) { myCurrentOffset = offset = 0; limit = GotoTaskAction.PAGE_SIZE; } // include closed tasks -> download all previous + closed, so no one is missing else if (myOldEverywhere != everywhere) { offset = 0; myCurrentOffset = limit = myCurrentOffset + GotoTaskAction.PAGE_SIZE; } // normal pagination step else { offset = myCurrentOffset; limit = GotoTaskAction.PAGE_SIZE; myCurrentOffset += GotoTaskAction.PAGE_SIZE; } List<Task> tasks = TaskSearchSupport.getRepositoriesTasks(myProject, pattern, offset, limit, true, everywhere, cancelled); myOldEverywhere = everywhere; myOldPattern = pattern; return tasks; }