Open a specified File in the editor using FileEditorManager

When the user clicks on a button in my plugin window I am expecting a certain file to be opened into the 
editor. So the code is within action performed method

ProjectManager pm = ProjectManager.getInstance();
Project project = pm.getOpenProjects()[0];
VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(<File Path>));
OpenFileDescriptor openFileDescriptor=new OpenFileDescriptor(project,file);
For the last line in the snippet openTextEditor() I am getting the following exption:
com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: EventQueue.isDispatchThread()=false Toolkit.getEventQueue()=com.intellij.ide.IdeEventQueue@5e2cbf7f
Can someone help me understanding what is causing this issue? 

1 comment
Comment actions Permalink

Please provide a full stack trace.


Please sign in to leave a comment.