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

5 comments
Comment actions Permalink

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.

0
Comment actions Permalink

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?

0
Comment actions Permalink

Hello mark,

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?


HttpFileSystem in 7.0 doesn't support downloading anything, so it won't help
you in any case.

I just want to copy a URL to a local Virtual file on disk. Is there an
easier way to do this?


Just use the java.net APIs for downloading.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

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

0
Comment actions Permalink

Hello mark,

So if I download the file and save as File, how can I then turn this
into a ViirtualFile so pass into openFile command?


LocalFileSystem.getInstance().findFileByIoFile()

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.