Hello Guys, I want to thank you all for your previous replies. I am showing package names, class names, methods and fields in a view(in tree and table format) of a plugin. I am using the method below so that anytime the user clicks on the package/class/method/field name then the source code in the workspace will open and that particular element will be revealed in the editor.
void showMethod(IMember member) throws PartInitException, JavaModelException {
ICompilationUnit cu = member.getCompilationUnit();
IEditorPart javaEditor = JavaUI.openInEditor(cu);
JavaUI.revealInEditor(javaEditor, (IJavaElement)member);
}
It is working fine but: (1) what i want now is that when source code is open and the package/class/method/field name is revealed in the editor, I want that I can let a ToolTip appear when the user hover his mouse on that particular element whether it is : package or class or method or field name.
(2) For instance when a variable is declared in de source editor of Eclipse and it is never used/referenced. You will see that there appears a small warning icon on de left side of the editor and when you hover the mouse over it there pops up a tooltip telling you that the variable is never referenced.
I would like to implement that functionality if there is no other way of doing it. how can I make those warning icons appear in the source code in the same line that the element whether package/ class/method/field is revealed.
Thanks for all your help.