Access new created file
Completed
Hello,
I'm working on a plugin for my PHPStorm. Works like a charm so far. But sadly, I have a little hung here.
I'm starting an external process which creates a file in the project directory. After this, I want to open the desired file in the editor.
Problem:
final VirtualFile theThestFile = LocalFileSystem.getInstance().findFileByPath(testFilePath);
does not find the file, as it returns null. When the file exists (when it can be seen in the project toolwindow), it loads the file.
I'm opening the file with
FileEditorManager.getInstance(project).openFile(theThestFile, true);
My thought is, that I need to tell PHPStorm to read the directories for new files, so it can open the new project file. Is that correct? The question here is: How?
If this is not my issue, please help me to find a solution. Thanks
Please sign in to leave a comment.
I fixed it with using
refreshAndFindFileByIoFile did the trick.
Hi, In my plugin i want to get the workspace as a virtual file so i am doing something like this,
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(project.getBasePath()))
This works fine , but in PhpStorm 23.x.x i am faxing this issue on windows
com.intellij.diagnostic.PluginException: 387 ms to call on EDT AnalysisConfigurationsComboBoxAction#update@NavBarToolbar (com.x.x.idea.action.AnalysisConfigurationsComboBoxAction). Revise AnAction.getActionUpdateThread property
What could be the reason?
Thanks in advance