21
21
import com .intellij .notification .NotificationGroupManager ;
22
22
import com .intellij .notification .NotificationType ;
23
23
import com .intellij .openapi .project .Project ;
24
- import com .intellij .openapi .project . ProjectManagerListener ;
24
+ import com .intellij .openapi .startup . StartupActivity ;
25
25
import org .jetbrains .annotations .NotNull ;
26
26
27
- final class InitialConfigurationProjectManagerListener implements ProjectManagerListener {
27
+ final class InitialConfigurationStartupActivity implements StartupActivity . Background {
28
28
29
29
private static final String NOTIFICATION_TITLE = "Enable google-java-format" ;
30
30
private static final NotificationGroup NOTIFICATION_GROUP =
31
31
NotificationGroupManager .getInstance ().getNotificationGroup (NOTIFICATION_TITLE );
32
32
33
33
@ Override
34
- public void projectOpened (@ NotNull Project project ) {
34
+ public void runActivity (@ NotNull Project project ) {
35
35
GoogleJavaFormatSettings settings = GoogleJavaFormatSettings .getInstance (project );
36
36
37
37
if (settings .isUninitialized ()) {
@@ -47,11 +47,12 @@ private void displayNewUserNotification(Project project, GoogleJavaFormatSetting
47
47
NOTIFICATION_TITLE ,
48
48
"The google-java-format plugin is disabled by default. "
49
49
+ "<a href=\" enable\" >Enable for this project</a>." ,
50
- NotificationType .INFORMATION ,
51
- (n , e ) -> {
52
- settings .setEnabled (true );
53
- n .expire ();
54
- });
50
+ NotificationType .INFORMATION );
51
+ notification .setListener (
52
+ (n , e ) -> {
53
+ settings .setEnabled (true );
54
+ n .expire ();
55
+ });
55
56
notification .notify (project );
56
57
}
57
58
}
0 commit comments