EA-43239 - assert: JavaFileManagerBase.findClass

Moved the check to a post-startup activity
This commit is contained in:
Andrey Breslav
2013-01-30 13:23:19 +04:00
parent d31e53fa59
commit d633dd7bb7
@@ -24,6 +24,7 @@ import com.intellij.notification.Notifications;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.AbstractProjectComponent; import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.Messages;
import com.intellij.util.text.VersionComparatorUtil; import com.intellij.util.text.VersionComparatorUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -41,6 +42,9 @@ public class OutdatedKotlinRuntimeNotification extends AbstractProjectComponent
@Override @Override
public void projectOpened() { public void projectOpened() {
if (ApplicationManager.getApplication().isInternal()) return; if (ApplicationManager.getApplication().isInternal()) return;
StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() {
@Override
public void run() {
String runtimeVersion = KotlinRuntimeLibraryUtil.getRuntimeVersion(myProject); String runtimeVersion = KotlinRuntimeLibraryUtil.getRuntimeVersion(myProject);
final String pluginVersion = JetPluginUtil.getPluginVersion(); final String pluginVersion = JetPluginUtil.getPluginVersion();
if (runtimeVersion == null) return; // runtime is not present in project if (runtimeVersion == null) return; // runtime is not present in project
@@ -59,7 +63,9 @@ public class OutdatedKotlinRuntimeNotification extends AbstractProjectComponent
String message = String.format("<p>Your version of Kotlin runtime library is %s, while plugin version is %s." + String message = String.format("<p>Your version of Kotlin runtime library is %s, while plugin version is %s." +
" Runtime library should be updated to avoid compatibility problems.</p>" + " Runtime library should be updated to avoid compatibility problems.</p>" +
"<p><a href=\"update\">Update Runtime</a> <a href=\"ignore\">Ignore</a></p>", "<p><a href=\"update\">Update Runtime</a> <a href=\"ignore\">Ignore</a></p>",
KotlinRuntimeLibraryUtil.UNKNOWN_VERSION.equals(runtimeVersion) ? "older than 0.1.2296" : runtimeVersion, pluginVersion); KotlinRuntimeLibraryUtil.UNKNOWN_VERSION.equals(runtimeVersion)
? "older than 0.1.2296"
: runtimeVersion, pluginVersion);
Notifications.Bus.notify(new Notification("Outdated Kotlin Runtime", "Outdated Kotlin Runtime", Notifications.Bus.notify(new Notification("Outdated Kotlin Runtime", "Outdated Kotlin Runtime",
message, message,
NotificationType.WARNING, new NotificationListener() { NotificationType.WARNING, new NotificationListener() {
@@ -80,6 +86,8 @@ public class OutdatedKotlinRuntimeNotification extends AbstractProjectComponent
} }
}), myProject); }), myProject);
} }
});
}
@NotNull @NotNull
public static Runnable showRuntimeJarNotFoundDialog(@NotNull final Project project) { public static Runnable showRuntimeJarNotFoundDialog(@NotNull final Project project) {