razieh babaee
razieh babaee

Reputation: 298

Programmatically adding text to the editor eclipse plugin

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();

Upvotes: 0

Views: 405

Answers (1)

greg-449
greg-449

Reputation: 111142

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.

Upvotes: 1

Related Questions