I am trying to draw some shapes (boxed ans arrows) into, i.e., "over" the text in an eclipse editor. To get started, I wrote the following code:
IWorkbenchPage activePage = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); final Shell shell2 = activePage.getActiveEditor().getSite().getShell(); shell2.addPaintListener(new PaintListener(){ public void paintControl(PaintEvent e){ Rectangle clientArea = shell2.getClientArea(); e.gc.drawLine(0,0,clientArea.width,clientArea.height); } });
The problem with this code is twofold: (1) The line is drawn not across the editor but across the entire workbench, i.e., Eclipse window, and (2) the line is drawn behind (!) all other controls like toolbars and editors. This causes the line to be almost invisible: it only shows at some pixels between other controls.
How can I draw a line across a control like a text editor in Eclipse?