Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Refreshing a View?
Refreshing a View? [message #244919] Mon, 07 January 2008 19:33 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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.
>
>
Previous Topic:[EMF] Writing an application that writes code
Next Topic:Download source for SWT and/or Junit, per tutorial instructions?
Goto Forum:
  


Current Time: Wed Feb 05 06:36:35 GMT 2025

Powered by FUDForum. Page generated in 0.05254 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top