postpone open files in the editor after write action completes

EA-114507 - assert: NoSwingUnderWriteAction.lambda$watchForEvents$
This commit is contained in:
Anna.Kozlova
2018-01-12 10:49:32 +01:00
parent d25b349873
commit 20ebd5fee1
3 changed files with 8 additions and 6 deletions
@@ -284,7 +284,7 @@ public class CopyClassesHandler extends CopyHandlerDelegateBase {
for (PsiFile file : files) {
CopyHandler.updateSelectionInActiveProjectView(file, project, selectInActivePanel);
}
EditorHelper.openFilesInEditor(files.toArray(new PsiFile[files.size()]));
EditorHelper.openFilesInEditor(files.toArray(PsiFile.EMPTY_ARRAY));
}
}
}
@@ -16,6 +16,7 @@
package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.ide.util.EditorHelper;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -533,7 +534,7 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
}
if (myOpenInEditor) {
EditorHelper.openFilesInEditor(myElementsToMove);
ApplicationManager.getApplication().invokeLater(() -> EditorHelper.openFilesInEditor(Arrays.stream(myElementsToMove).filter(PsiElement::isValid).toArray(PsiElement[]::new)));
}
}
catch (IncorrectOperationException e) {