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