From e98f40df4bd27e1d24cc6c5a2efb7de26b10daf9 Mon Sep 17 00:00:00 2001 From: Dmitry Kandalov Date: Thu, 22 Jan 2015 21:15:11 +0000 Subject: [PATCH] notification to update groovy lib to 2.2.1 --- src/liveplugin/LivePluginAppComponent.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/liveplugin/LivePluginAppComponent.java b/src/liveplugin/LivePluginAppComponent.java index dde0f53d..b5b864ec 100644 --- a/src/liveplugin/LivePluginAppComponent.java +++ b/src/liveplugin/LivePluginAppComponent.java @@ -160,10 +160,14 @@ private static void installHelloWorldPlugin() { } public static void checkThatGroovyIsOnClasspath() { - if (isGroovyOnClasspath()) return; + final File oldGroovyLibrary = new File(LIVEPLUGIN_LIBS_PATH + File.separator + "groovy-all-2.0.6.jar"); NotificationListener listener = new NotificationListener() { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { + if (oldGroovyLibrary.exists()) { + FileUtil.delete(oldGroovyLibrary); + } + boolean downloaded = downloadFile("http://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/2.2.1/", "groovy-all-2.2.1.jar", LIVEPLUGIN_LIBS_PATH); if (downloaded) { notification.expire(); @@ -174,6 +178,18 @@ public static void checkThatGroovyIsOnClasspath() { } } }; + + if (oldGroovyLibrary.exists()) { + livePluginNotificationGroup.createNotification( + "There is old version of groovy library on LivePlugin classpath", + "It might work incorrectly. Click here to update groovy to 2.2.1 (~6Mb)", + NotificationType.ERROR, + listener + ).notify(null); + } + + if (isGroovyOnClasspath()) return; + livePluginNotificationGroup.createNotification( "LivePlugin didn't find Groovy libraries on classpath", "Without it plugins won't work. Download Groovy libraries (~6Mb)",