mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
if I invoked another completion instance, the previous one should be canceled, and not restarted
This commit is contained in:
+10
-3
@@ -88,7 +88,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
};
|
||||
private LightweightHint myHint;
|
||||
private final Semaphore myFreezeSemaphore;
|
||||
private boolean myToRestart;
|
||||
private Boolean myToRestart;
|
||||
|
||||
private boolean myModifiersReleased;
|
||||
|
||||
@@ -436,6 +436,8 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
|
||||
private void finishCompletionProcess() {
|
||||
assert myToRestart == null;
|
||||
myToRestart = false;
|
||||
cancel();
|
||||
|
||||
assert !myDisposed;
|
||||
@@ -474,7 +476,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
invokeLaterIfNotDispatch(new Runnable() {
|
||||
public void run() {
|
||||
if (isOutdated()) return;
|
||||
if (isCanceled() && !myToRestart) return; // otherwise
|
||||
if (isCanceled() && myToRestart != Boolean.TRUE) return;
|
||||
|
||||
//what if a new completion was invoked by the user before this 'later'?
|
||||
if (CompletionProgressIndicator.this != CompletionServiceImpl.getCompletionService().getCurrentCompletion()) return;
|
||||
@@ -528,6 +530,11 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
|
||||
public void cancelByWriteAction() {
|
||||
if (myToRestart != null) {
|
||||
assert myToRestart == Boolean.FALSE; //explicit completionFinished was invoked before this write action
|
||||
return;
|
||||
}
|
||||
|
||||
myToRestart = true;
|
||||
cancel();
|
||||
|
||||
@@ -605,7 +612,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
|
||||
public void prefixUpdated() {
|
||||
if (myToRestart) {
|
||||
if (myToRestart == Boolean.TRUE) {
|
||||
scheduleRestart();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user