--- org/gudy/azureus2/ui/swt/update/UpdateMonitor.java.orig 2006-05-14 08:10:01.000000000 -0700
+++ org/gudy/azureus2/ui/swt/update/UpdateMonitor.java 2006-05-26 09:27:25.000000000 -0700
@@ -90,206 +90,19 @@
{
azureus_core = _azureus_core;
- UpdateManager um = azureus_core.getPluginManager().getDefaultPluginInterface().getUpdateManager();
-
- um.addListener(
- new UpdateManagerListener()
- {
- public void
- checkInstanceCreated(
- UpdateCheckInstance instance )
- {
- instance.addListener( UpdateMonitor.this );
- }
- });
-
- um.addVerificationListener(
- new UpdateManagerVerificationListener()
- {
- public boolean
- acceptUnVerifiedUpdate(
- final Update update )
- {
- final boolean accept[] = {false};
-
- Utils.execSWTThread(
- new Runnable()
- {
- public void
- run()
- {
- accept[0] = MessageBoxWindow.open(
- "UpdateMonitor.messagebox.accept.unverified",
- SWT.YES | SWT.NO,
- SWT.NULL,
- false,
- _main_window.getDisplay(),
- MessageBoxWindow.ICON_WARNING,
- MessageText.getString( "UpdateMonitor.messagebox.accept.unverified.title" ),
- MessageText.getString(
- "UpdateMonitor.messagebox.accept.unverified.text",
- new String[]{ update.getName()})) == SWT.YES;
-
- }
- },
- false );
-
- return( accept[0] );
- }
-
- public void
- verificationFailed(
- final Update update,
- final Throwable cause )
- {
- final String cause_str = Debug.getNestedExceptionMessage( cause );
-
- Utils.execSWTThread(
- new Runnable()
- {
- public void
- run()
- {
- Utils.openMessageBox(
- _main_window.getShell(),
- SWT.OK,
- "UpdateMonitor.messagebox.verification.failed",
- new String[]{ update.getName(), cause_str });
- }
- });
- }
- });
-
- SimpleTimer.addPeriodicEvent(
- AUTO_UPDATE_CHECK_PERIOD,
- new TimerEventPerformer()
- {
- public void
- perform(
- TimerEvent ev )
- {
- performAutoCheck(false);
- }
- });
-
- // wait a bit before starting check to give rest of AZ time to initialise
-
- new DelayedEvent(
- 2500,
- new AERunnable()
- {
- public void
- runSupport()
- {
- performAutoCheck(true);
- }
- });
}
protected void
performAutoCheck(
final boolean start_of_day )
{
- boolean check_at_start = false;
- boolean check_periodic = false;
- boolean bOldSWT = SWT.getVersion() < 3139;
-
- // no update checks for java web start
-
- if ( !SystemProperties.isJavaWebStartInstance()){
-
- // force check when SWT is really old
- check_at_start = COConfigurationManager.getBooleanParameter( "update.start", true ) || bOldSWT;
- check_periodic = COConfigurationManager.getBooleanParameter( "update.periodic", true );
- }
-
- // periodic -> check at start as well
-
- check_at_start = check_at_start || check_periodic;
-
- if ( ( check_at_start && start_of_day) ||
- ( check_periodic && !start_of_day )){
-
- performCheck(bOldSWT); // this will implicitly do usage stats
-
- }else{
-
- new DelayedEvent(
- 5000,
- new AERunnable()
- {
- public void
- runSupport()
- {
- if ( start_of_day ){
- MainWindow.getWindow().setStatusText("");
- }
- CoreUpdateChecker.doUsageStats();
- }
- });
- }
}
public void
performCheck(final boolean bForce)
{
- if ( SystemProperties.isJavaWebStartInstance()){
-
- // just in case we get here somehome!
- if (Logger.isEnabled())
- Logger.log(new LogEvent(LOGID,
- "skipping update check as java web start"));
-
- return;
- }
- // kill any existing update window
-
- if ( current_update_window != null && ! current_update_window.isDisposed()){
-
- SWTThread.getInstance().getDisplay().syncExec(
- new AERunnable()
- {
- public void
- runSupport()
- {
- current_update_window.dispose();
- }
- });
- }
-
- if ( current_update_instance != null ){
-
- current_update_instance.cancel();
- }
-
- MainWindow mainWindow = MainWindow.getWindow();
-
- mainWindow.setStatusText("MainWindow.status.checking ...");
-
- // take this off this GUI thread in case it blocks for a while
-
- AEThread t =
- new AEThread( "UpdateMonitor:kickoff")
- {
- public void
- runSupport()
- {
- UpdateManager um = azureus_core.getPluginManager().getDefaultPluginInterface().getUpdateManager();
-
- current_update_instance =
- um.createUpdateCheckInstance(
- bForce ? UpdateCheckInstance.UCI_INSTALL : UpdateCheckInstance.UCI_UPDATE,
- "update.instance.update" );
-
- current_update_instance.start();
- }
- };
-
- t.setDaemon( true );
-
- t.start();
}
public void