Hiding a ViewPart instead of closing [message #841306] |
Wed, 11 April 2012 06:25 |
Kornel Muhi Messages: 1 Registered: February 2012 |
Junior Member |
|
|
Hello!
I have a ViewPart, and it is important for me to keep it's contents if the user "closes it" and opens it up again in the same Eclipse session. But when you click on the upper-right X it closes the view and disposes it's contents - also, recreating the whole contents is not really an option because there would be several ways how the user can get this window - through different operations - and, in general, if he makes no change, just opens it up again, it would be unnecessary to recreate the very same contents instead of just showing it.
Since I have not found anything usable regarding how to hide a viewpart instead of closing it, I would like to ask you if someone was able to do this?
I've read a solution where someone disabled the closing of a view by implementing ISaveablePart2, but this prevents closing of Eclipse too (since it tries to close this ViewPart but fails) - so this way I need to listen somehow to the Eclipse closing event, to re-enable the closeable property of this ViewPart.
Also, the IWorkbenchPage hideView() method is also useless in this case, because instead of hiding it it actually disposes the view.
Any ideas?
[Updated on: Wed, 11 April 2012 16:20] Report message to a moderator
|
|
|
Re: Hiding a ViewPart [message #855068 is a reply to message #841306] |
Tue, 24 April 2012 13:47 |
Greg Pugh Messages: 15 Registered: July 2009 |
Junior Member |
|
|
On 11/04/2012 07:25, Kornel Muhi wrote:
> Hello!
>
> I have a ViewPart, which is important for me to keep it's contents if the user "closes it", and opens it up again in the same Eclipse session. But
> when you click on the upper-right X it closes the view and disposes it's contents - also, recreating the whole contents is not really an option
> because there would be several ways how the user can get this window - through different operations - and, in general, if he makes no change, just
> opens it up again, it would be unnecessary to recreate the very same contents instead of just showing it.
>
> Since I have not found anything usable regarding how to hide a viewpart instead of closing it, I would like to ask you if someone was able to do this?
>
> I've read a solution where someone disabled the closing of a view by implementing ISaveablePart2, but this prevents closing of Eclipse too (since it
> tries to close this ViewPart but fails) - so this way I need to listen somehow to the Eclipse closing event, to re-enable the closeable property of
> this ViewPart.
>
> Also, the IWorkbenchPage hideView() method is also useless in this case, because instead of hiding it it actually disposes the view.
>
> Any ideas?
If you use a Perspective then you can stop the view from being closed using IViewLayout.setCloseable(false)
|
|
|
|
Powered by
FUDForum. Page generated in 0.04779 seconds