Merge remote-tracking branch 'origin/master'

This commit is contained in:
Alexander Marchuk
2014-11-06 18:55:00 +03:00
3 changed files with 22 additions and 7 deletions
@@ -1192,6 +1192,10 @@ public abstract class ChooseByNameBase {
myPostponedOkAction = null;
}
public boolean hasPostponedAction() {
return myPostponedOkAction != null;
}
protected abstract void showList();
protected abstract void hideList();
@@ -54,7 +54,6 @@ public class GotoTaskAction extends GotoActionBase implements DumbAware {
popup.setShowListForEmptyPattern(true);
popup.setSearchInAnyPlace(true);
popup.setFixLostTyping(false);
popup.setAlwaysHasMore(true);
popup.setAdText("<html>Press SHIFT to merge with current context<br/>" +
"Pressing " +
@@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicReference;
class TaskItemProvider implements ChooseByNameItemProvider, Disposable {
private static final Logger LOG = Logger.getInstance(TaskItemProvider.class);
private static final int DELAY_PERIOD = 1000; // ms
private static final int DELAY_PERIOD = 200; // ms
private final Project myProject;
@@ -76,19 +76,31 @@ class TaskItemProvider implements ChooseByNameItemProvider, Disposable {
});
// Newer request always wins
Future<List<Task>> oldFeature = myFutureReference.getAndSet(future);
if (oldFeature != null) {
Future<List<Task>> oldFuture = myFutureReference.getAndSet(future);
if (oldFuture != null) {
LOG.debug("Cancelling existing task");
oldFeature.cancel(true);
oldFuture.cancel(true);
}
if (myAlarm.isDisposed()) {
return false;
}
myAlarm.addRequest(future, DELAY_PERIOD);
myAlarm.addRequest(future, oldFuture == null && pattern.length() > 5 ? 0 : DELAY_PERIOD);
try {
List<Task> tasks = future.get();
List<Task> tasks;
while (true) {
try {
tasks = future.get(10, TimeUnit.MILLISECONDS);
break;
}
catch (TimeoutException ignore) {
}
if (base.hasPostponedAction()) {
future.cancel(true);
return true;
}
}
myFutureReference.compareAndSet(future, null);
// Exclude *all* cached and local issues, not only those returned by TaskSearchSupport.getLocalAndCachedTasks().