GoodSpeed
GoodSpeed

Reputation: 323

How to reference an SWT view from a TitleAreaDialog

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

Answers (2)

stracka
stracka

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

user1708860
user1708860

Reputation: 1753

You need to pass to the TitleAreaDialog in the constructor.

Upvotes: 0

Related Questions