Search in sources :

Example 1 with CheckUpdates

use of org.jivesoftware.sparkimpl.updater.CheckUpdates in project Spark by igniterealtime.

the class MainWindow method checkForUpdates.

/**
 * Checks for the latest update on the server.
 *
 * @param forced true if you want to bypass the normal checking security.
 */
private void checkForUpdates(final boolean forced) {
    final CheckUpdates updater = new CheckUpdates();
    try {
        final SwingWorker updateThread = new SwingWorker() {

            @Override
            public Object construct() {
                try {
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    Log.error(e);
                }
                return "ok";
            }

            @Override
            public void finished() {
                try {
                    updater.checkForUpdate(forced);
                } catch (Exception e) {
                    Log.error("There was an error while checking for a new update.", e);
                }
            }
        };
        updateThread.start();
    } catch (Exception e) {
        Log.warning("Error updating.", e);
    }
}
Also used : CheckUpdates(org.jivesoftware.sparkimpl.updater.CheckUpdates) SwingWorker(org.jivesoftware.spark.util.SwingWorker) SmackException(org.jivesoftware.smack.SmackException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 SmackException (org.jivesoftware.smack.SmackException)1 SwingWorker (org.jivesoftware.spark.util.SwingWorker)1 CheckUpdates (org.jivesoftware.sparkimpl.updater.CheckUpdates)1