diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/util/IdeHelper.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/util/IdeHelper.java index 002f6dd30..da5ff383e 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/util/IdeHelper.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/util/IdeHelper.java @@ -2,8 +2,8 @@ import com.intellij.ide.util.PsiNavigationSupport; import com.intellij.notification.Notification; +import com.intellij.notification.NotificationGroupManager; import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.fileTypes.FileType; @@ -16,7 +16,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.util.ui.UIUtil; import fr.adrienbrault.idea.symfony2plugin.Settings; -import fr.adrienbrault.idea.symfony2plugin.SettingsForm; +import fr.adrienbrault.idea.symfony2plugin.Symfony2Icons; import org.apache.commons.lang.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,7 +24,9 @@ import java.awt.*; import java.io.IOException; import java.net.URISyntaxException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.stream.Collectors; @@ -124,25 +126,34 @@ public void run() { } public static void notifyEnableMessage(final Project project) { + Notification notification = NotificationGroupManager.getInstance() + .getNotificationGroup("Symfony Notifications") + .createNotification( + "Enable Symfony Plugin with auto configuration now or dismiss further messages", + NotificationType.INFORMATION + ); - Notification notification = new Notification("Symfony Support", "Symfony", "Enable the Symfony Plugin with auto configuration now, open Project Settings or dismiss further messages", NotificationType.INFORMATION, (notification1, event) -> { + notification.setTitle("Symfony"); + notification.setIcon(Symfony2Icons.SYMFONY); + notification.setListener((notification1, event) -> { // handle html click events - if("config".equals(event.getDescription())) { - - // open settings dialog and show panel - SettingsForm.show(project); - } else if("enable".equals(event.getDescription())) { + if("enable".equals(event.getDescription())) { Collection messages = enablePluginAndConfigure(project); - String message = "Plugin enabled"; + String message = "Plugin enabled for project"; if (!messages.isEmpty()) { List collect = messages.stream().map(s -> "
- " + s).collect(Collectors.toList()); message += StringUtils.join(collect, ""); } - Notifications.Bus.notify(new Notification("Symfony Support", "Symfony", message, NotificationType.INFORMATION), project); + Notification notification2 = NotificationGroupManager.getInstance() + .getNotificationGroup("Symfony Notifications") + .createNotification(message, NotificationType.INFORMATION); + + notification2.setIcon(Symfony2Icons.SYMFONY); + notification2.notify(project); } else if("dismiss".equals(event.getDescription())) { // user doesnt want to show notification again @@ -152,7 +163,7 @@ public static void notifyEnableMessage(final Project project) { notification1.expire(); }); - Notifications.Bus.notify(notification, project); + notification.notify(project); } public static Collection enablePluginAndConfigure(@NotNull Project project) { diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 96128aeb7..b126635e1 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -256,6 +256,7 @@ +