22
33import com .intellij .ide .util .PsiNavigationSupport ;
44import com .intellij .notification .Notification ;
5+ import com .intellij .notification .NotificationGroupManager ;
56import com .intellij .notification .NotificationType ;
6- import com .intellij .notification .Notifications ;
77import com .intellij .openapi .application .ex .ApplicationManagerEx ;
88import com .intellij .openapi .fileEditor .OpenFileDescriptor ;
99import com .intellij .openapi .fileTypes .FileType ;
1616import com .intellij .psi .codeStyle .CodeStyleManager ;
1717import com .intellij .util .ui .UIUtil ;
1818import fr .adrienbrault .idea .symfony2plugin .Settings ;
19- import fr .adrienbrault .idea .symfony2plugin .SettingsForm ;
19+ import fr .adrienbrault .idea .symfony2plugin .Symfony2Icons ;
2020import org .apache .commons .lang .StringUtils ;
2121import org .jetbrains .annotations .NotNull ;
2222import org .jetbrains .annotations .Nullable ;
2323
2424import java .awt .*;
2525import java .io .IOException ;
2626import java .net .URISyntaxException ;
27- import java .util .*;
27+ import java .util .ArrayList ;
28+ import java .util .Arrays ;
29+ import java .util .Collection ;
2830import java .util .List ;
2931import java .util .stream .Collectors ;
3032
@@ -124,25 +126,34 @@ public void run() {
124126 }
125127
126128 public static void notifyEnableMessage (final Project project ) {
129+ Notification notification = NotificationGroupManager .getInstance ()
130+ .getNotificationGroup ("Symfony Notifications" )
131+ .createNotification (
132+ "Enable Symfony Plugin <a href=\" enable\" >with auto configuration now</a> or <a href=\" dismiss\" >dismiss</a> further messages" ,
133+ NotificationType .INFORMATION
134+ );
127135
128- Notification notification = new Notification ("Symfony Support" , "Symfony" , "Enable the Symfony Plugin <a href=\" enable\" >with auto configuration now</a>, open <a href=\" config\" >Project Settings</a> or <a href=\" dismiss\" >dismiss</a> further messages" , NotificationType .INFORMATION , (notification1 , event ) -> {
136+ notification .setTitle ("Symfony" );
137+ notification .setIcon (Symfony2Icons .SYMFONY );
138+ notification .setListener ((notification1 , event ) -> {
129139
130140 // handle html click events
131- if ("config" .equals (event .getDescription ())) {
132-
133- // open settings dialog and show panel
134- SettingsForm .show (project );
135- } else if ("enable" .equals (event .getDescription ())) {
141+ if ("enable" .equals (event .getDescription ())) {
136142 Collection <String > messages = enablePluginAndConfigure (project );
137143
138- String message = "Plugin enabled" ;
144+ String message = "Plugin enabled for project " ;
139145
140146 if (!messages .isEmpty ()) {
141147 List <String > collect = messages .stream ().map (s -> "<br> - " + s ).collect (Collectors .toList ());
142148 message += StringUtils .join (collect , "" );
143149 }
144150
145- Notifications .Bus .notify (new Notification ("Symfony Support" , "Symfony" , message , NotificationType .INFORMATION ), project );
151+ Notification notification2 = NotificationGroupManager .getInstance ()
152+ .getNotificationGroup ("Symfony Notifications" )
153+ .createNotification (message , NotificationType .INFORMATION );
154+
155+ notification2 .setIcon (Symfony2Icons .SYMFONY );
156+ notification2 .notify (project );
146157 } else if ("dismiss" .equals (event .getDescription ())) {
147158
148159 // user doesnt want to show notification again
@@ -152,7 +163,7 @@ public static void notifyEnableMessage(final Project project) {
152163 notification1 .expire ();
153164 });
154165
155- Notifications . Bus . notify (notification , project );
166+ notification . notify (project );
156167 }
157168
158169 public static Collection <String > enablePluginAndConfigure (@ NotNull Project project ) {
0 commit comments