1 11 package org.eclipse.core.runtime.internal.adaptor; 12 13 import java.lang.reflect.Method ; 14 import org.eclipse.core.runtime.adaptor.EclipseStarter; 15 import org.eclipse.core.runtime.internal.stats.StatsManager; 16 import org.eclipse.osgi.framework.internal.core.FrameworkProperties; 17 import org.eclipse.osgi.service.runnable.StartupMonitor; 18 19 public class DefaultStartupMonitor implements StartupMonitor { 20 21 private Method updateMethod = null; 22 private Runnable splashHandler = null; 23 24 31 public DefaultStartupMonitor(Runnable splashHandler) throws IllegalStateException { 32 this.splashHandler = splashHandler; 33 34 try { 35 updateMethod = splashHandler.getClass().getMethod("updateSplash", null); } catch (SecurityException e) { 37 throw new IllegalStateException (e.getMessage()); 38 } catch (NoSuchMethodException e) { 39 throw new IllegalStateException (e.getMessage()); 41 } 42 } 43 44 47 public void update() { 48 if (updateMethod != null) { 49 try { 50 updateMethod.invoke(splashHandler, null); 51 } catch (Throwable e) { 52 } 54 } else { 55 } 57 } 58 59 public void applicationRunning() { 60 if (EclipseStarter.debug) { 61 String timeString = FrameworkProperties.getProperty("eclipse.startTime"); long time = timeString == null ? 0L : Long.parseLong(timeString); 63 System.out.println("Application Started: " + (System.currentTimeMillis() - time)); } 65 StatsManager.doneBooting(); 66 splashHandler.run(); 67 } 68 } 69 | Popular Tags |