|
|
|
@ -22,14 +22,22 @@ public class Install4jStartupNotificationProvider implements FineStartupNotifica
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void registerStartupListener(Listener listener) { |
|
|
|
|
Class<?> StartupNotificationListenerClass = Reflect.on("com.install4j.api.launcher.StartupNotification$Listener").type(); |
|
|
|
|
Class<?> StartupNotificationListenerClass = null; |
|
|
|
|
try { |
|
|
|
|
StartupNotificationListenerClass = Reflect.on("com.install4j.api.launcher.StartupNotification$Listener").type(); |
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StartupNotificationListenerClass == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ListenerHandler mHandler = new ListenerHandler(listener); |
|
|
|
|
Object listenerCallbackInstance = Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { StartupNotificationListenerClass }, mHandler); |
|
|
|
|
Reflect.on("com.install4j.api.launcher.StartupNotification").call("registerStartupListener", listenerCallbackInstance); |
|
|
|
|
try { |
|
|
|
|
Reflect.on("com.install4j.api.launcher.StartupNotification").call("registerStartupListener", listenerCallbackInstance); |
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static class ListenerHandler implements InvocationHandler { |
|
|
|
@ -48,4 +56,13 @@ public class Install4jStartupNotificationProvider implements FineStartupNotifica
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
Install4jStartupNotificationProvider.getInstance().registerStartupListener(new Listener() { |
|
|
|
|
@Override |
|
|
|
|
public void startupPerformed(String parameters) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|