anup r
anup r

Reputation: 121

How to get a particular view from user is in selection dialog?

I want to get particular view and it's data when I am in FileDialog. Currently I am using the code :

IWorkbenchPage workbench = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

If I use the above code, I am gettting NPE, as I am currently in FileDialog and clicked 'Save' button.

Upvotes: 1

Views: 58

Answers (1)

Markus Lausberg
Markus Lausberg

Reputation: 12257

The active window is the modal dialog, which does not support views.

You may have to get

IWorkbench.getWorkbenchWindows()

And go thru the list of windows, to be able to find a specific view.

BUT, this sounds like a hack, because if the FileDialog needs something from within a specific view, why not submitting the information in the constructor of your own FileDialog implementation (which extends from FileDialog)? In this case you do not have to search for a specific view, you would have the instance directly.

Upvotes: 3

Related Questions