Throwable: Synchronous execution on EDT on PsiFile.delete() why is this happening, how can I prevent this ?

Answered

Dear Support,

first of all happy new year to you ;) I wish you guys the same success like you had during all these years :)

my issue : 

on my plugin I try deleting a psiFile then add another psiFile with the same name (but of course with a different content) in the same psiDirectory (maybe there is a smarter way to replace a file ? )

 

It is woking but somehow I get following exception

 

java.lang.Throwable: Synchronous execution on EDT: svn --config-dir C:\Users\XXX\AppData\Roaming\Subversion info --depth empty E:\workspace_intellij\preview\XXX --xml --non-interactive
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:145)
at com.intellij.execution.process.OSProcessHandler.checkEdtAndReadAction(OSProcessHandler.java:147)
at com.intellij.execution.process.OSProcessHandler.waitFor(OSProcessHandler.java:92)
at org.jetbrains.idea.svn.commandLine.CommandExecutor.waitFor(CommandExecutor.java:304)
at org.jetbrains.idea.svn.commandLine.CommandExecutor.run(CommandExecutor.java:320)
at org.jetbrains.idea.svn.commandLine.CommandRuntime.runWithAuthenticationAttempt(CommandRuntime.java:55)
at org.jetbrains.idea.svn.api.BaseSvnClient.execute(BaseSvnClient.java:122)
at org.jetbrains.idea.svn.api.BaseSvnClient.execute(BaseSvnClient.java:109)
at org.jetbrains.idea.svn.api.BaseSvnClient.execute(BaseSvnClient.java:95)
at org.jetbrains.idea.svn.info.CmdInfoClient.execute(CmdInfoClient.kt:75)
at org.jetbrains.idea.svn.info.CmdInfoClient.doInfo(CmdInfoClient.kt:96)
at org.jetbrains.idea.svn.SvnVcs.getInfo(SvnVcs.java:589)
at org.jetbrains.idea.svn.SvnVcs.getInfo(SvnVcs.java:568)
at org.jetbrains.idea.svn.SvnUtil.isSvnVersioned(SvnUtil.java:122)
at org.jetbrains.idea.svn.SvnFileSystemListener.delete(SvnFileSystemListener.java:443)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemBase.auxDelete(LocalFileSystemBase.java:253)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemBase.deleteFile(LocalFileSystemBase.java:369)
at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.deleteFile(PersistentFSImpl.java:472)
at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.delete(VirtualFileSystemEntry.java:197)
at com.intellij.psi.impl.file.PsiFileImplUtil.doDelete(PsiFileImplUtil.java:75)
at com.intellij.psi.impl.source.PsiFileImpl.delete(PsiFileImpl.java:424)
at com.swissas.dialog.DtoGeneratorForm.saveFiles(DtoGeneratorForm.java:485)

 

 

here a small portion of my code 

PsiFile existingFile = dtoDir.findFile(this.dtoFile.getName());
if (existingFile != null) {
existingFile.delete(); //this line seems to be the source of the exception
}
dtoDir.add(this.dtoFile);

 

 

any advise how to get rid of the exception ?
Thanks in advance for your help.

1 comment
Comment actions Permalink

Please try com.intellij.openapi.editor.Document#replaceString on the Document from the original psiFile for replacing text directly.

 

http://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/documents.html

0

Please sign in to leave a comment.