Create virtual file problem!

I want to create a file by using

ToolWindowManager.getInstance(ProjectController.instance().getProject()).invokeLater(new Runnable() {
public void run() {

..i get a virtual file, and the use call createChildData(...)


}});

After that it will throw Throwable why?



java.lang.Throwable

at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:32)

at com.intellij.openapi.application.a.d.assertWriteAccessAllowed(d.java:291)

at com.intellij.openapi.vfs.VirtualFileSystem.fireFileCreated(VirtualFileSystem.java:78)

at com.intellij.openapi.vfs.a.a.bj.fireFileCreated(bj.java:92)

at com.intellij.openapi.vfs.a.a.bi.createChildDirectory(bi.java:273)

at vpsdeij.VPSDEIJDiagramController.createVPUMLProjectDirectory(VPSDEIJDiagramController.java:112)

at vpsdeij.VPSDEIJDiagramController.createDiagramFile(VPSDEIJDiagramController.java:59)

at vpsdeij.VPSDEIJ$1.run(VPSDEIJ.java:65)

at com.intellij.openapi.wm.impl.b.c.run(c.java)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at com.intellij.ide.s.a(s.java:12)

at com.intellij.ide.s.dispatchEvent(s.java:48)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

1 comment

Sorry!
i know the problem can be solved by

ApplicationManager.getApplication().runWriteAction(..)

0

Please sign in to leave a comment.