Don't hide configure project notification
This commit is contained in:
+20
-20
@@ -18,10 +18,7 @@ package org.jetbrains.jet.plugin.configuration;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.notification.Notification;
|
import com.intellij.notification.*;
|
||||||
import com.intellij.notification.NotificationListener;
|
|
||||||
import com.intellij.notification.NotificationType;
|
|
||||||
import com.intellij.notification.Notifications;
|
|
||||||
import com.intellij.openapi.extensions.Extensions;
|
import com.intellij.openapi.extensions.Extensions;
|
||||||
import com.intellij.openapi.module.Module;
|
import com.intellij.openapi.module.Module;
|
||||||
import com.intellij.openapi.module.ModuleManager;
|
import com.intellij.openapi.module.ModuleManager;
|
||||||
@@ -41,6 +38,7 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ConfigureKotlinInProjectUtils {
|
public class ConfigureKotlinInProjectUtils {
|
||||||
|
private static final NotificationGroup CONFIGURE_KOTLIN_STICKY_BALLOON_GROUP = new NotificationGroup("Configure Kotlin: balloon", NotificationDisplayType.STICKY_BALLOON, true);
|
||||||
|
|
||||||
public static boolean isProjectConfigured(@NotNull Project project) {
|
public static boolean isProjectConfigured(@NotNull Project project) {
|
||||||
Collection<Module> modules = getModulesWithKotlinFiles(project);
|
Collection<Module> modules = getModulesWithKotlinFiles(project);
|
||||||
@@ -89,23 +87,25 @@ public class ConfigureKotlinInProjectUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void showConfigureKotlinNotification(@NotNull final Project project) {
|
private static void showConfigureKotlinNotification(@NotNull final Project project) {
|
||||||
Notifications.Bus.notify(
|
CONFIGURE_KOTLIN_STICKY_BALLOON_GROUP.
|
||||||
new Notification("Configure Kotlin",
|
createNotification(
|
||||||
"Kotlin files found in your project.",
|
"Configure Kotlin",
|
||||||
getNotificationString(project),
|
getNotificationString(project),
|
||||||
NotificationType.WARNING, new NotificationListener() {
|
NotificationType.WARNING,
|
||||||
@Override
|
new NotificationListener() {
|
||||||
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
|
@Override
|
||||||
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
|
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
|
||||||
KotlinProjectConfigurator configurator = getConfiguratorByName(event.getDescription());
|
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
|
||||||
if (configurator == null) {
|
KotlinProjectConfigurator configurator = getConfiguratorByName(event.getDescription());
|
||||||
throw new AssertionError("Missed action: " + event.getDescription());
|
if (configurator == null) {
|
||||||
|
throw new AssertionError("Missed action: " + event.getDescription());
|
||||||
|
}
|
||||||
|
configurator.configure(project);
|
||||||
|
notification.expire();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
configurator.configure(project);
|
|
||||||
notification.expire();
|
|
||||||
}
|
}
|
||||||
}
|
).notify(project);
|
||||||
}), project);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getNotificationString(Project project) {
|
private static String getNotificationString(Project project) {
|
||||||
@@ -190,6 +190,6 @@ public class ConfigureKotlinInProjectUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showInfoNotification(@NotNull String message) {
|
public static void showInfoNotification(@NotNull String message) {
|
||||||
Notifications.Bus.notify(new Notification("Configure Kotlin", "Configure Kotlin", message, NotificationType.INFORMATION));
|
Notifications.Bus.notify(new Notification("Configure Kotlin: info notification", "Configure Kotlin", message, NotificationType.INFORMATION));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user