Finding and opening a Java source file
Hi all
I'm writing a plugin that will parse a file to find a package and class statement as follows:
$class=my.package.classname
I then want to open the sourcefile that corresponds with the particular class.
I am currently doing the following:
This works as long as the source file can be found in my source directory. However, the source could potentially be found a source directory defined in a library (global or project).
Do I need to loop through all of the VirtualFileSystems looking for the file, or is there a better way?
Thanks
Todd Breiholz
Please sign in to leave a comment.
Just replace
with
since findClass() will return .class version if found in library and
getNavigationElement() will convert it to it's source equivalent if
avaliable.
--
Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"
"Todd Breiholz" <no_mail@jetbrains.com> wrote in message
news:2583560.1062718998612.JavaMail.itn@is.intellij.net...
>
statement as follows:
>
>
class.
>
>
>
However, the source could potentially be found a source directory defined in
a library (global or project).
>
file, or is there a better way?
>
>
If i can understand you, you want to make somethink like that:
http://www.intellij.org/twiki/bin/view/Main/FileAssociations
It have sources and you can see how open it...
Thanks!
--
Alexey Efimov, Software Engineer
Sputnik Labs,
http://www.spklabs.com
"Todd Breiholz" <no_mail@jetbrains.com> wrote in message
news:2583560.1062718998612.JavaMail.itn@is.intellij.net...
>
statement as follows:
>
>
class.
>
>
>
However, the source could potentially be found a source directory defined in
a library (global or project).
>
file, or is there a better way?
>
>
Thanks Maxim
That works perfectly!
Todd Breiholz