use of com.intellij.codeInsight.completion.CompletionPhase in project intellij-community by JetBrains.
the class LookupTypedHandler method execute.
@Override
public void execute(@NotNull Editor originalEditor, char charTyped, @NotNull DataContext dataContext) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
PsiFile file = project == null ? null : PsiUtilBase.getPsiFileInEditor(originalEditor, project);
if (file == null) {
if (myOriginalHandler != null) {
myOriginalHandler.execute(originalEditor, charTyped, dataContext);
}
return;
}
if (!EditorModificationUtil.checkModificationAllowed(originalEditor)) {
return;
}
CompletionPhase oldPhase = CompletionServiceImpl.getCompletionPhase();
if (oldPhase instanceof CompletionPhase.CommittingDocuments && ((CompletionPhase.CommittingDocuments) oldPhase).isRestartingCompletion()) {
assert oldPhase.indicator != null;
oldPhase.indicator.scheduleRestart();
}
Editor editor = TypedHandler.injectedEditorIfCharTypedIsSignificant(charTyped, originalEditor, file);
if (editor != originalEditor) {
file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
}
if (originalEditor.isInsertMode() && beforeCharTyped(charTyped, project, originalEditor, editor, file)) {
return;
}
if (myOriginalHandler != null) {
myOriginalHandler.execute(originalEditor, charTyped, dataContext);
}
}
Aggregations