Monday, March 04, 2019

Open .java file for .class file


M2Eclispe supports resolution of dependencies from Workspace projects. With this you can click on a method from dependency owned class, M2Eclipse will automatically load the .java file for that .class file from. This is fine and dandy as long as your projects are Maven based. No fear...I wrote a simple Eclipse plugin to do just that - Open .java file for .class file.

How it works


Monitors the opening of a .class editor. Then uses the JDT Java search mechanism to locate the corresponding .java file in any of the Java projects in the Eclipse workspace. It also tries to move the caret to the same offset in .java file. By default closes the .class file, however by setting a preference you can opt-in to not close the .class file. The association of source folder with the .jar file containing the .class file is required for this to work.

Preferences


Github

https://github.com/sandipchitale/odjfdc

Update site

https://sandipchitale.github.io/odjfdc/OpenDotJavaForDotClassUpdateSite/site.xml


Eclipse Marketplace

https://marketplace.eclipse.org/content/open-java-file-class-file