Reputation: 323
I would like to get a reference to a view in my application from my TitleAreaDialog
.
There are many information to pass to the controls on the view
. I have created many getters
and setters
to handle changes the values, but I still need a reference to the view
which is not a static class
.
I searched on the Internet but I couldn't find a good example.
Many thanks,
Upvotes: 0
Views: 341
Reputation: 1023
If I understand what it is you're after (a reference to an instance of your view class that's visible in the workbench), try this:
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow activeBenchWindow = wb.getActiveWorkbenchWindow();
IWorkbenchPage[] pages = activeBenchWindow.getPages();
IWorkbenchPage page = pages[0];
IViewPart yourView = page.findView(YourView.ID);
Upvotes: 1