Getting A Handle to a ViewPart [message #464824] |
Thu, 15 March 2007 22:40  |
Eclipse User |
|
|
|
Hello -
I'm having a problem getting a handle to a ViewPart. I need handle so I
can add the View as a listener to a component I've defined. However,
there doesn't seem to be an easy way to do this. I've grokked the api
and all I can come up with is the following:
IViewDescriptor descriptor =
getSite().getWorkbenchWindow().getWorkbench().getViewRegistr y().find(View.ID);
But this just gives me an IViewDescriptor when I really need a handle to
the view.
I've hacked my way around this by assuming there will only be one
instance of the View in the application so in the no-arg constructor I
set a static instance variable and provide a getInstance() method. Sort
of turning the class into a singleton but without the private
constructor. Because obviously the constructor can't be private or the
workbench framework would never be able to create the instance in the
first place.
This is a BIG hack though. There must be a way to get a handle to a View
but I just can't find it.
Thanks for the help in advance.
- Troy
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05690 seconds