fShutdownHook = new Thread() {
@Override
public void run() {
/* Shutdown UI */
SafeRunner.run(new LoggingSafeRunnable() {
public void run() throws Exception {
if (Owl.isStarted() || Controller.isInitialized())
Controller.getDefault().shutdown(true);
}
});
/* Shutdown Core */
SafeRunner.run(new LoggingSafeRunnable() {
public void run() throws Exception {
Owl.shutdown(true);
}
});
/* Check for Log Message from Core */
String logMessages = CoreUtils.getAndFlushLogMessages();
if (logMessages != null && logMessages.length() > 0)
safeLogError(logMessages, null);
/* Log Shutdown Info */
safeLogInfo("RSSOwl Shutting Down (emergency)" + fNl); //$NON-NLS-1$
}
};
fShutdownHook.setPriority(Thread.MAX_PRIORITY);
Runtime.getRuntime().addShutdownHook(fShutdownHook);
/* Activate the Core Bundle */
SafeRunner.run(new LoggingSafeRunnable() {
public void run() throws Exception {
startCore();
}
});
/* Propagate startup to Controller */
SafeRunner.run(new LoggingSafeRunnable() {
public void run() throws Exception {
/* Startup Controller */
if (Owl.isStarted())
Controller.getDefault().startup();
}
});
/* Propagate post-ui startup to Controller (Eclipse Integration) */
if (Application.IS_ECLIPSE) {
SafeRunner.run(new LoggingSafeRunnable() {
public void run() throws Exception {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (Owl.isStarted())
Controller.getDefault().postWindowOpen();