Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Activator stop(): call super first or last?
Activator stop(): call super first or last? [message #460501] Thu, 21 December 2006 12:55 Go to next message
Eclipse UserFriend
R3.2.1

I have several plugins composing an RCP; their Activator's stop() methods do a few things (such as
cancel jobs started by the given plugin/bundle). Question: should the super.stop() call precede all
my code or should it follow? Currently, my local code precedes the super-call, as below, and so far
no trouble ...

thanks,
Paul

@Override
public void stop(final BundleContext context) throws Exception {
_plugin = null;
try {
final IJobManager mgr = Platform.getJobManager();
mgr.cancel(MyBundlesJob.NAME);

} catch (RuntimeException exn) {
exn.printStackTrace();
}

super.stop(context);
}
Re: Activator stop(): call super first or last? [message #460544 is a reply to message #460501] Thu, 21 December 2006 14:49 Go to previous messageGo to next message
Eclipse UserFriend
AFAIK, super.stop(context) should be the last (or almost last) call in
your overridden method, so it looks like you are fine.


That's what the javadoc for both AbstractUIPlugin and Plugin also suggest.

Later,
PW
Re: Activator stop(): call super first or last? [message #460550 is a reply to message #460544] Thu, 21 December 2006 16:03 Go to previous messageGo to next message
Eclipse UserFriend
Aha -- "Subclasses may extend this method, but must send super <b>last</b>" -- there it is: I should
have read more carefully.

thanks,
Paul
Re: Activator stop(): call super first or last? [message #460595 is a reply to message #460501] Fri, 22 December 2006 10:10 Go to previous messageGo to next message
Eclipse UserFriend
You've already got the answer now, but constructors and starters always need to call super first, to ensure that the data is properly set up and initialised for your method to run; similarly, destructors and stoppers always need to call super last, to make sure that they clean themselves up before stopping (or killing) any data structures managed by the super class. The rule applies pretty much whatever programming language or API you're using ...

Alex.
Re: Activator stop(): call super first or last? [message #460794 is a reply to message #460595] Fri, 29 December 2006 09:20 Go to previous message
Eclipse UserFriend
Good way to put it, worth remembering, thanks.

Paul
Previous Topic:Bringing RCP app to the front
Next Topic:Problem opening a file in the RCP application
Goto Forum:
  


Current Time: Mon Mar 24 16:42:15 EDT 2025

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

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

Back to the top