Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Identify when Eclipse is closed(Which class is involved?)
Identify when Eclipse is closed [message #713933] Tue, 09 August 2011 12:30 Go to next message
MarcoGT  is currently offline MarcoGT Friend
Messages: 77
Registered: May 2011
Member
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).

Thanks
Marco
Re: Identify when Eclipse is closed [message #713947 is a reply to message #713933] Tue, 09 August 2011 13:16 Go to previous messageGo to next message
Eclipse UserFriend
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 #713955 is a reply to message #713947] Tue, 09 August 2011 13:40 Go to previous messageGo to next message
MarcoGT  is currently offline MarcoGT Friend
Messages: 77
Registered: May 2011
Member
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) {
		
		//TODO: my code here
		
		return false;
	}

}


But, of course, this class should be called by someone somewhere, shouldn't it? How?

Thanks and greets from Munich Smile

[Updated on: Tue, 09 August 2011 13:53]

Report message to a moderator

Re: Identify when Eclipse is closed [message #713966 is a reply to message #713955] Tue, 09 August 2011 13:51 Go to previous messageGo to next message
Eclipse UserFriend
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 #713976 is a reply to message #713966] Tue, 09 August 2011 14:02 Go to previous messageGo to next message
MarcoGT  is currently offline MarcoGT Friend
Messages: 77
Registered: May 2011
Member
Uhm...thanks...but I do not understand in which classes of mine I have to register this listener

What I have to do I basically delete a file on the hard disk when Eclipse closes

[Updated on: Tue, 09 August 2011 15:07]

Report message to a moderator

Re: Identify when Eclipse is closed [message #714234 is a reply to message #713976] Wed, 10 August 2011 06:18 Go to previous message
Eclipse UserFriend
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
Previous Topic:limit search results OR hide search view toolbar icons dynamically
Next Topic:limit search results OR hide search view toolbar icons dynamically
Goto Forum:
  


Current Time: Sat Apr 20 04:01:31 GMT 2024

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

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

Back to the top