Question

I have a basic GEF editor where I want to use the model from the currently open/selected java source editor to display extra information, but I can't figure out how to get access to java model from inside my editor.

Any ideas? I'm finding the Eclipse docs hard to navigate.

Was it helpful?

Solution

It is a hard job, as using the GEF editor the current editor is the GEF editor, not the Java one.

If you have the IResource representing the Java file to display, you can use the static methods of the JavaCore class to get the Java Model.

How to get the IResource: maybe you can iterate over the open editors, and select their input, and check whether its an IFileInput, etc., or listen to selection changes in the Package Explorer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top