Call openFile programatically from a plugin/opening new tabs
Is there an easy way to call openFile from a plugin so that my plugin can open files in new tabs for the user (ie documentation)?
Will this work for URLs (ie http://foo.com/foo.txt)?
Regards,
MArk
请先登录再写评论。
FileEditorManager.getInstance(project).openFile(file, true);
file is a VirtualFile though. So it won't work with the URL.
You could try to use HttpFileSystem Maybe if you pass the URL to findFileByPath(path) it will work and create a VirtualFile for the URL.
I am trying to add com.intellij.openapi.vfs.ex.http.HttpFileSystem but it tells me it cannot find ex.
I have added all the redist jars in the development resources to it. What am I doing wrong?
I just want to copy a URL to a local Virtual file on disk. Is there an easier way to do this?
Hello mark,
HttpFileSystem in 7.0 doesn't support downloading anything, so it won't help
you in any case.
Just use the java.net APIs for downloading.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
So if I download the file and save as File, how can I then turn this into a ViirtualFile so pass into openFile command?
MArk
Hello mark,
LocalFileSystem.getInstance().findFileByIoFile()
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"