2121import com .intellij .notification .NotificationGroupManager ;
2222import com .intellij .notification .NotificationType ;
2323import com .intellij .openapi .project .Project ;
24- import com .intellij .openapi .project . ProjectManagerListener ;
24+ import com .intellij .openapi .startup . StartupActivity ;
2525import org .jetbrains .annotations .NotNull ;
2626
27- final class InitialConfigurationProjectManagerListener implements ProjectManagerListener {
27+ final class InitialConfigurationStartupActivity implements StartupActivity . Background {
2828
2929 private static final String NOTIFICATION_TITLE = "Enable google-java-format" ;
3030 private static final NotificationGroup NOTIFICATION_GROUP =
3131 NotificationGroupManager .getInstance ().getNotificationGroup (NOTIFICATION_TITLE );
3232
3333 @ Override
34- public void projectOpened (@ NotNull Project project ) {
34+ public void runActivity (@ NotNull Project project ) {
3535 GoogleJavaFormatSettings settings = GoogleJavaFormatSettings .getInstance (project );
3636
3737 if (settings .isUninitialized ()) {
@@ -47,11 +47,12 @@ private void displayNewUserNotification(Project project, GoogleJavaFormatSetting
4747 NOTIFICATION_TITLE ,
4848 "The google-java-format plugin is disabled by default. "
4949 + "<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+ });
5556 notification .notify (project );
5657 }
5758}
0 commit comments