Skip to main content



      Home
Home » Newcomers » Newcomers » How to refresh/reload a view
How to refresh/reload a view [message #870166] Mon, 07 May 2012 02:29 Go to next message
Eclipse UserFriend
Hi,

I'm trying to create a plugin which will have Custom View and a Custom Button. Every time a project is selected and the button is pressed the view should get updated.

To display a view I'm using the following code:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("MyView");

The problem is how to update the view when it is already open. As a work around for this I'm first hiding the view and then reloading it as I couldn't find any refresh method. So now my code is something like:
IViewReference ref = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findViewReference("MyView");

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView(ref);

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("MyView");

When I run this code in Linux, the constructor and createPartControl method of MyView is called most of the times (sometimes it doesn't, dont know why!), but the same code only gives focus to MyView in Windows.

My requirement is that whenever I click on my plugin button, createPartControl method of MyView should get called. If calling createPartControl is not a good idea then I need a method which is called everytime MyView gets focus, so that I can move all my functionality to that method.

Thank You in advance.
Regards,
-Alok
Re: How to refresh/reload a view [message #870489 is a reply to message #870166] Tue, 08 May 2012 08:15 Go to previous message
Eclipse UserFriend
createPartContrl() is for when your part is created--which should happen when your view is opened, not every time it gains focus. If you want a mechanism to refresh your view, just add one that your button can make use of.
Previous Topic:Connection Timed Out
Next Topic:eclipse Helios slow finding plugins
Goto Forum:
  


Current Time: Tue Jul 15 13:33:57 EDT 2025

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

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

Back to the top