|
Re: Identify when Eclipse is closed [message #713947 is a reply to message #713933] |
Tue, 09 August 2011 13:16 |
Eclipse User |
|
|
|
Originally posted by:
On 2011-08-09 14:30, MarcoGT wrote:
> Hi all,
>
> I am working on Eclipse XML editor source code and in particular on
> plug-in org.eclipse.wst.xml.ui.
>
> I would like to know which class/classes are involved when Eclipse in
> closing, that means when user selects File->Exit (or similar on other
> not Windows OS).
It depends what you want to achieve. E.g. you can override
preWindowShellClose of your WorkbenchWindowAdvisor, but there are other
similar life-cycle functions of your RCP application. If you are not
defining your own RCP appliaction, you could also add a listener of type
IWorkbenchListener via IWorkbench#addWorkbenchListener and handle the
preShutdown event.
HTH & Greetings from Bremen,
Daniel Krügler
|
|
|
|
Re: Identify when Eclipse is closed [message #713966 is a reply to message #713955] |
Tue, 09 August 2011 13:51 |
Eclipse User |
|
|
|
Originally posted by:
On 2011-08-09 15:40, MarcoGT wrote:
> Uhm...I have a problem.
>
> I created a class which implements IWorkbenchListener
>
>
> public class CleanResources implements IWorkbenchListener {
>
> @Override
> public void postShutdown(IWorkbench arg0) {
> // TODO Auto-generated method stub
>
> }
>
> @Override
> public boolean preShutdown(IWorkbench arg0, boolean arg1) {
>
> System.out.println("ciao");
>
> return false;
> }
>
> }
>
>
> But, of course, this class should be called by someone somewhere,
> shouldn't it? How?
I answered this question in my previous reply (you need to register your
listener).
- Daniel Krügler
|
|
|
|
Re: Identify when Eclipse is closed [message #714234 is a reply to message #713976] |
Wed, 10 August 2011 06:18 |
Eclipse User |
|
|
|
Originally posted by:
On 2011-08-09 16:02, MarcoGT wrote:
> And how can I register the listener?
Well, the documentation of IWorkbenchListener refers to
IWorkbench#addWorkbenchListener,so you need an instance of IWorkbench to
register, right? If you check the interface documentation of IWorkbench,
you are delegated to org.eclipse.ui.PlatformUI#getWorkbench, so here you
could go. I strongly recommend to study the (very short) interface
documentation of the related types, which usually give you the right answer.
HTH & Greetings from Bremen,
- Daniel Krügler
|
|
|
Powered by
FUDForum. Page generated in 0.02968 seconds