Open external files via SDK in text editor

Answered

I am working over plugin for intellij idea and the plugin keeps some files in it's own directory like ~/.plugin/ . The plugin needs to open some files from the directory in text editor, but the existing solutin I found like 

val project = ProjectManager.getInstance().openProjects[0]
val textEditor: Editor? = FileEditorManager.getInstance(project).openTextEditor(
OpenFileDescriptor(project, node.file, 0),
true
)

doesn't work. Probably because virtual files out of project. So my question is what the propery way to open such kind of external files?

2 comments
Comment actions Permalink

Hi,

It should work correctly even for files not being part of the project.

There are two potential issues:

0
Comment actions Permalink

thank you, the cause was that files were without extension, when I added .txt it correctly works

0

Please sign in to leave a comment.