Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How can I prevent a view from closing
How can I prevent a view from closing [message #465622] Tue, 03 April 2007 12:46 Go to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Hi all,

I have a view (part of a plug-in I made) that runs into eclipse.



I would like to be able to stop this view from closing...



What is the best way to do it?

Note: this is not part of an RCP, the plug-in runs in eclipse.



Regards

Kar
Re: How can I prevent a view from closing [message #465625 is a reply to message #465622] Tue, 03 April 2007 13:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: valere.fedronic.ext.streamezzo.com

KarSc wrote:
> Hi all,
>
> I have a view (part of a plug-in I made) that runs into eclipse.
>
>
>
> I would like to be able to stop this view from closing...
>
>
>
> What is the best way to do it?
>
> Note: this is not part of an RCP, the plug-in runs in eclipse.
>
>
>
> Regards
>
> Kar
>
>
>
>

If you declare your own perspective, you can set your view as
non-closeable :

/*IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPa geLayout)*/
layout.getViewLayout(YourViewPart.ID).setCloseable(false);


valere.
Re: How can I prevent a view from closing [message #465627 is a reply to message #465625] Tue, 03 April 2007 14:01 Go to previous messageGo to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Hello Valere,
the problem is that i want to gain control on the closing ... i mean ...
once the view is going down i would like to display a dialog asking for
confirmation ...
if i will go for the YES i will close all the linked editor otherwise
nothing change.

Kar



"valere fedronic" <valere.fedronic.ext@streamezzo.com> wrote in message
news:eutla5$nmu$2@build.eclipse.org...
> KarSc wrote:
>> Hi all,
>>
>> I have a view (part of a plug-in I made) that runs into eclipse.
>>
>>
>>
>> I would like to be able to stop this view from closing...
>>
>>
>>
>> What is the best way to do it?
>>
>> Note: this is not part of an RCP, the plug-in runs in eclipse.
>>
>>
>>
>> Regards
>>
>> Kar
>>
>>
>>
>>
>
> If you declare your own perspective, you can set your view as
> non-closeable :
>
> /*IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPa geLayout)*/
> layout.getViewLayout(YourViewPart.ID).setCloseable(false);
>
>
> valere.
Re: How can I prevent a view from closing [message #465633 is a reply to message #465627] Tue, 03 April 2007 16:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: valere.fedronic.ext.streamezzo.com

You can try to register a partlistener (IPartListener) and hook some
code in the IPartListner#partClosed(IWorkbenchPart part) method.

/*snippet (in your viewpart code)*/
IPartService partService =
(IPartService)getSite().getService(IPartService.class);
partService.addPartListener(listener);

This notifies you that your part is already closed but perhaps you can
try to re-open it if needed.

valere.


KarSc wrote:
> Hello Valere,
> the problem is that i want to gain control on the closing ... i mean ...
> once the view is going down i would like to display a dialog asking for
> confirmation ...
> if i will go for the YES i will close all the linked editor otherwise
> nothing change.
>
> Kar
>
>
>
> "valere fedronic" <valere.fedronic.ext@streamezzo.com> wrote in message
> news:eutla5$nmu$2@build.eclipse.org...
>> KarSc wrote:
>>> Hi all,
>>>
>>> I have a view (part of a plug-in I made) that runs into eclipse.
>>>
>>>
>>>
>>> I would like to be able to stop this view from closing...
>>>
>>>
>>>
>>> What is the best way to do it?
>>>
>>> Note: this is not part of an RCP, the plug-in runs in eclipse.
>>>
>>>
>>>
>>> Regards
>>>
>>> Kar
>>>
>>>
>>>
>>>
>> If you declare your own perspective, you can set your view as
>> non-closeable :
>>
>> /*IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPa geLayout)*/
>> layout.getViewLayout(YourViewPart.ID).setCloseable(false);
>>
>>
>> valere.
>
>
Re: How can I prevent a view from closing [message #465725 is a reply to message #465627] Tue, 03 April 2007 20:23 Go to previous message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
You should use an editor for something that participates in the close/confirm/cancel lifecycle, not a view.

Alex.
Previous Topic:exception-handling in an RCP-based application
Next Topic:RCP on Wall Stree?
Goto Forum:
  


Current Time: Sun Sep 22 15:32:54 GMT 2024

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

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

Back to the top