[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.jdt] Re: Adding a context sensitive menu to the editor

Erik Wikström wrote:

I'm working on a plugin performing some analysis of code (using ASTNodes) and have managed to add context-menus to the package-explorer which works just fine. However to perform some of the analysis I want to let the user select a specific piece of code an perform some action on it.
My problem is twofold: how to add a popup-menu to the code-editor

Use the "org.eclipse.ui.popupMenus" extension point with "#CompilationUnitEditorContext" as target id for the viewer contribution.


and how to trace whatever the user clicked on to the abstract representation of the code (like a ASTNode or IJavaElement).

There's no such high-level event (unless you want to use internal code). You have to add a post selection listener and get the Java element from the text selection.


Dani

Does anyone have experience with this kind of functionality?

--
Erik Wikström