0

I am working on an eclipse plugin, and I'm trying to implement F3 (Open Declaration) functionality. After finding the project that contains a class, I use findType to get the IType of the class. If it a .java file in my workspace, I can use getResource to get the IFile, and then open its editor (as is described here).

However, if it's a BinaryType, then getResource returns null. I can get the class file using getClassFile, but when I use its getResource I also get null. If I try using its getPath method, I get an IPath to the jar file which contains it.

There must be some way to reach the source file, and open it in an editor, but I can't seem to find it.

Community
  • 1
  • 1
Eyal
  • 3,412
  • 1
  • 44
  • 60

1 Answers1

1

Use

JavaUI.openInEditor(IJavaElement element);

to open all Java elements (such as your IType).

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • I'm assuming you mean "openInEditor" since that's the method I found (but it does work :-) ) – Eyal Mar 08 '15 at 13:28