tolerate lookup being closed when making the file writable before insertion (EA-39999)

This commit is contained in:
peter
2012-10-15 16:35:09 +02:00
parent e95be20741
commit 33e4020e5d
@@ -600,13 +600,14 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
}
final PsiFile file = getPsiFile();
if (file != null && !WriteCommandAction.ensureFilesWritable(myProject, Arrays.asList(file))) {
doHide(false, true);
fireItemSelected(null, completionChar);
boolean writableOk = file == null || WriteCommandAction.ensureFilesWritable(myProject, Arrays.asList(file));
if (myDisposed) { // ensureFilesWritable could close us by showing a dialog
return;
}
if (myDisposed) { // ensureFilesWritable could close us by showing a dialog
if (!writableOk) {
doHide(false, true);
fireItemSelected(null, completionChar);
return;
}