Refreshing a View? [message #244919] |
Mon, 07 January 2008 19:33 |
Eclipse User |
|
|
|
Originally posted by: hiteshn.mail.gmail.com
Hi,
I created a View (Sampleview) which shows the outline of the diagram on the
canvas. This view is used for easier navigation. The problem I'm facing is
refreshing the view. When I have multiple diagram files opened, the
SampleView still shows the outline of first file. This problem is rectified
if I close that view and re-open it again. Please help me in solving this
problem.
Thanks,
Hitesh.
|
|
|
Re: Refreshing a View? [message #244924 is a reply to message #244919] |
Mon, 07 January 2008 21:26 |
Eclipse User |
|
|
|
Originally posted by: wayne.beaton._NOSPAM_eclipse.org
Try adding an IPartListener (via the addPartListener method) to the page.
Something like this in your createPartControl method should do it:
public void createPartControl(Composite parent) {
getSite().getPage().addPartListener(new IPartListener() {
public void partActivated(IWorkbenchPart part) {
if (part instanceof MyEditor) refreshFor((MyEditor)part);
}
// snip
});
// snip
}
The partActivated method will be invoked when the user brings any editor
or view to the top. If that editor or view is an editor you care about,
update (refresh) the view. You may also want to override
partBroughtToTheTop; the comments on the method indicate that it is
called when the part is brought forward programmatically.
Make sure you remove the listener in the dispose method.
HTH,
Wayne
Hitesh Nembhwani wrote:
> Hi,
>
> I created a View (Sampleview) which shows the outline of the diagram on the
> canvas. This view is used for easier navigation. The problem I'm facing is
> refreshing the view. When I have multiple diagram files opened, the
> SampleView still shows the outline of first file. This problem is rectified
> if I close that view and re-open it again. Please help me in solving this
> problem.
>
> Thanks,
> Hitesh.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05254 seconds