Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to refresh/reload a view
How to refresh/reload a view [message #870166] Mon, 07 May 2012 06:29 Go to next message
Alok Mishra is currently offline Alok MishraFriend
Messages: 16
Registered: April 2012
Junior Member
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 12:15 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Connection Timed Out
Next Topic:eclipse Helios slow finding plugins
Goto Forum:
  


Current Time: Fri Apr 26 04:43:13 GMT 2024

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

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

Back to the top