void () { super.stop(); myQueue.cancelAllUpdates(); myFreezeSemaphore.up(); myFinishSemaphore.up(); ModalityUiUtil.invokeLaterIfNeeded(myQueue.getModalityState(), () -> { final CompletionPhase phase = CompletionServiceImpl.getCompletionPhase(); if (!(phase instanceof CompletionPhase.BgCalculation) || phase.indicator != this) return; LOG.assertTrue(!getProject().isDisposed(), "project disposed"); if (myEditor.isDisposed()) { myLookup.hideLookup(false); CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion); return; } if (myEditor instanceof EditorWindow) { LOG.assertTrue(((EditorWindow)myEditor).getInjectedFile().isValid(), "injected file !valid"); LOG.assertTrue(((DocumentWindow)myEditor.getDocument()).isValid(), "docWindow !valid"); } PsiFile file = myLookup.getPsiFile(); LOG.assertTrue(file == null || file.isValid(), "file !valid"); myLookup.setCalculating(false); if (myCount == 0) { myLookup.hideLookup(false); if (!isAutopopupCompletion()) { final CompletionProgressIndicator current = CompletionServiceImpl.getCurrentCompletionProgressIndicator(); LOG.assertTrue(current == null, current + "!=" + this); handleEmptyLookup(!((CompletionPhase.BgCalculation)phase).modifiersChanged); } else { CompletionServiceImpl.setCompletionPhase(new CompletionPhase.EmptyAutoPopup(myEditor, myRestartingPrefixConditions)); } } else { updateLookup(); if (!CompletionServiceImpl.isPhase(CompletionPhase.NoCompletion.getClass(), CompletionPhase.EmptyAutoPopup.class)) { CompletionServiceImpl.setCompletionPhase(new CompletionPhase.ItemsCalculated(this)); } } }); }