0
votes

I'm developing an eclipse plugin , and at some point in my plugin , a jframe is opened , and inside the jframe, there is a button . I have added a mouselistener to the button , and when pressed , I want some code to be added to the editor at caret point . but, I get null pointer exception here:
IWorkbenchPage page = PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage();

1
Which of those three calls is returning null? getWorkbench()? getActiveWorkbenchWindow()? getActivePage()? - greg-449
getActivePage() is returning null - razieh babaee

1 Answers

0
votes

It appears you don't have an active page. Maybe your Swing based code is displaying a separate window?

Use IWorkbenchWindow.getPages() to get an array of IWorkbenchPage containing all the pages and look through the pages for the one containing the editor you want.