Skip to content

Commit

Permalink
notification to update groovy lib to 2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dkandalov committed Jan 22, 2015
1 parent c26257d commit e98f40d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/liveplugin/LivePluginAppComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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. <a href=\"\">Click here to update groovy to 2.2.1</a> (~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. <a href=\"\">Download Groovy libraries</a> (~6Mb)",
Expand Down

0 comments on commit e98f40d

Please sign in to comment.