diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/TypedHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/TypedHandler.java index 16a9ae0f7ead..e35a477054a6 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/TypedHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/TypedHandler.java @@ -31,6 +31,7 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorModificationUtil; import com.intellij.openapi.editor.actionSystem.TypedActionHandler; import com.intellij.openapi.extensions.Extensions; +import com.intellij.openapi.fileEditor.FileDocumentManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -54,6 +55,10 @@ public class TypedHandler implements TypedActionHandler { return; } + if (!FileDocumentManager.getInstance().requestWriting(editor.getDocument(), editor.getProject())) { + return; + } + final CharFilter.Result result = getLookupAction(charTyped, lookup); lookup.performGuardedChange(new Runnable() { public void run() { diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java b/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java index 243ad6dd4cfd..3e9b78830fe3 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java +++ b/platform/platform-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java @@ -68,7 +68,7 @@ public abstract class FileDocumentManager { * @return true if writing access allowed * @see com.intellij.openapi.vfs.ReadonlyStatusHandler#ensureFilesWritable(com.intellij.openapi.project.Project, com.intellij.openapi.vfs.VirtualFile...) */ - public abstract boolean requestWriting(@NotNull Document document, Project project); + public abstract boolean requestWriting(@NotNull Document document, @Nullable Project project); public static boolean fileForDocumentCheckedOutSuccessfully(@NotNull Document document, @NotNull Project project) { return getInstance().requestWriting(document, project);