Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Detecting event for closing view
Detecting event for closing view [message #452684] Wed, 12 July 2006 16:23 Go to next message
Eclipse UserFriend
Originally posted by: alexixlebaulois.yahoo.fr

Hi everybody,

I would like to detect when a user clicks on the cross to close a view. I have tried IPartListener2 but the method "closedView" is called after the view has been closed. What I need is to prevent my view to close until I have performed some instructions. Could you please help me ?

Thank you,

Alex
Re: Detecting event for closing view [message #452709 is a reply to message #452684] Thu, 13 July 2006 08:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.seidel.spiritlink.de

alexixlebaulois wrote:
> Hi everybody,
>
> I would like to detect when a user clicks on the cross to close a view. I have tried IPartListener2 but the method "closedView" is called after the view has been closed. What I need is to prevent my view to close until I have performed some instructions. Could you please help me ?
>
> Thank you,
>
> Alex
Hi Alex,

have you tried to overwrite the #dispose() - Method of your Viewpart?

--
Cheerz,
Tom
-- http://www.spiritlink.de --
Re: Detecting event for closing view [message #452714 is a reply to message #452684] Thu, 13 July 2006 11:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lamont_gilbert.rigidsoftware.com

alexixlebaulois wrote:

> Hi everybody,
>
> I would like to detect when a user clicks on the cross to close a view. I
> have tried IPartListener2 but the method "closedView" is called after the
> view has been closed. What I need is to prevent my view to close until I
> have performed some instructions. Could you please help me ?
>
> Thank you,
>
> Alex


Most editors do this. When you close then and their is unsaved work they
will as to save or not or to cancel. Use debugber and find out how they do
the cancel.


--
Respectfully,

CL Gilbert
"Verily, verily, I say unto you, He that entereth not by the door() into the
sheepfold{}, but climbeth up some other *way, the same is a thief and a
robber."
Re: Detecting event for closing view [message #452796 is a reply to message #452714] Sat, 15 July 2006 07:21 Go to previous messageGo to next message
Mike Evans is currently offline Mike EvansFriend
Messages: 237
Registered: July 2009
Senior Member
On Thu, 13 Jul 2006 07:28:34 -0400, CL [dnoyeb] Gilbert wrote:

> alexixlebaulois wrote:
>
>> Hi everybody,
>>
>> I would like to detect when a user clicks on the cross to close a view. I
>> have tried IPartListener2 but the method "closedView" is called after the
>> view has been closed. What I need is to prevent my view to close until I
>> have performed some instructions. Could you please help me ?
>>
>> Thank you,
>>
>> Alex
>
> Most editors do this. When you close then and their is unsaved work they
> will as to save or not or to cancel. Use debugber and find out how they do
> the cancel.

Alas editors work because the platform expects them to have state - they
implement ISaveablePart and have PROP_DIRTY etc. Views do not have this so
that mechanism is not available to you.

I think Tom's idea of overriding dispose() is the only way.


--
Mike E.
Re: Detecting event for closing view [message #452870 is a reply to message #452796] Tue, 18 July 2006 11:26 Go to previous message
Rainer Rieder is currently offline Rainer RiederFriend
Messages: 11
Registered: July 2009
Junior Member
You can have the behaviour of an unsaved/dirty editor in a view if you

implement the interface ISaveablePart2 in your view and pretend to be dirty:

: : :
: : :
public boolean isDirty() {
return mDirty;
}

public boolean isSaveOnCloseNeeded() {
return mDirty;
}


public int promptToSaveOnClose() {
mDirty = doWhateverYouWantOnViewClose();
return !mDirty
}
: : :
: : :


Although, you will always have the ugly "*" displayed on your view tab.





Mike Evans wrote:
> On Thu, 13 Jul 2006 07:28:34 -0400, CL [dnoyeb] Gilbert wrote:
>
>> alexixlebaulois wrote:
>>
>>> Hi everybody,
>>>
>>> I would like to detect when a user clicks on the cross to close a view. I
>>> have tried IPartListener2 but the method "closedView" is called after the
>>> view has been closed. What I need is to prevent my view to close until I
>>> have performed some instructions. Could you please help me ?
>>>
>>> Thank you,
>>>
>>> Alex
>> Most editors do this. When you close then and their is unsaved work they
>> will as to save or not or to cancel. Use debugber and find out how they do
>> the cancel.
>
> Alas editors work because the platform expects them to have state - they
> implement ISaveablePart and have PROP_DIRTY etc. Views do not have this so
> that mechanism is not available to you.
>
> I think Tom's idea of overriding dispose() is the only way.
>
>
Previous Topic:Plugins vs. Fragments
Next Topic:ActionSets with submenu?
Goto Forum:
  


Current Time: Wed Oct 16 01:31:02 GMT 2024

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

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

Back to the top