private List<Task> fetchFromServer(String pattern,boolean everywhere,ProgressIndicator cancelled){
  int offset, limit;
  if (!myOldPattern.equals(pattern)) {
    myCurrentOffset=offset=0;
    limit=GotoTaskAction.PAGE_SIZE;
  }
 else   if (myOldEverywhere != everywhere) {
    offset=0;
    myCurrentOffset=limit=myCurrentOffset + GotoTaskAction.PAGE_SIZE;
  }
 else {
    offset=myCurrentOffset;
    limit=GotoTaskAction.PAGE_SIZE;
    myCurrentOffset+=GotoTaskAction.PAGE_SIZE;
  }
  List<Task> tasks=TaskSearchSupport.getRepositoriesTasks(TaskManager.getManager(myProject),pattern,offset,limit,true,everywhere,cancelled);
  myOldEverywhere=everywhere;
  myOldPattern=pattern;
  return tasks;
}

private List < Task > fetchFromServer ( String pattern , boolean everywhere , ProgressIndicator cancelled ) { int offset , limit ; if ( ! myOldPattern . equals ( pattern ) ) { myCurrentOffset = offset = 0 ; limit = GotoTaskAction . PAGE_SIZE ; } else if ( myOldEverywhere != everywhere ) { offset = 0 ; myCurrentOffset = limit = myCurrentOffset + GotoTaskAction . PAGE_SIZE ; } else { offset = myCurrentOffset ; limit = GotoTaskAction . PAGE_SIZE ; myCurrentOffset += GotoTaskAction . PAGE_SIZE ; } List < Task > tasks = TaskSearchSupport . getRepositoriesTasks ( TaskManager . getManager ( myProject ) , pattern , offset , limit , true , everywhere , cancelled ) ; myOldEverywhere = everywhere ; myOldPattern = pattern ; return tasks ; }
download next page of tasks from server ( s ) . if filtering settings changed , download them all over again , but always increment upper limit to make progress . if server supports search on its side , it should not affect access time much , because only a few tasks will be returned anyway .
