mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't modify a read-only document during lookup (EA-26547)
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user