Merge remote-tracking branch 'origin/master'
[idea/community.git] / platform / lang-impl / src / com / intellij / codeInsight / editorActions / TypedHandler.java
index ff8e7e59ce80e9add785c9d4c057c47064d5e46d..423b95dffc7fcf1a651e8312c8b51294a03cabf2 100644 (file)
@@ -37,6 +37,7 @@ import com.intellij.openapi.editor.ex.EditorEx;
 import com.intellij.openapi.editor.highlighter.EditorHighlighter;
 import com.intellij.openapi.editor.highlighter.HighlighterIterator;
 import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.FileTypes;
 import com.intellij.openapi.fileTypes.LanguageFileType;
@@ -142,6 +143,9 @@ public class TypedHandler extends TypedActionHandlerBase {
     }
 
     if (!CodeInsightUtilBase.prepareEditorForWrite(originalEditor)) return;
+    if (!FileDocumentManager.getInstance().requestWriting(originalEditor.getDocument(), project)) {
+       return;
+    }
 
     final PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project);
     final Document originalDocument = originalEditor.getDocument();