From 7cdbebbda39e16d9ec8afbec803529833f5f2ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Thu, 17 Jun 2021 11:49:17 +0200 Subject: [PATCH] maxOpenProjects: avoid ServiceManager --- .../sdk/maxOpenProjects/ProjectOpenCloseListener.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/max_opened_projects/src/main/java/org/intellij/sdk/maxOpenProjects/ProjectOpenCloseListener.java b/max_opened_projects/src/main/java/org/intellij/sdk/maxOpenProjects/ProjectOpenCloseListener.java index ddedbd3f0..c07bd6897 100644 --- a/max_opened_projects/src/main/java/org/intellij/sdk/maxOpenProjects/ProjectOpenCloseListener.java +++ b/max_opened_projects/src/main/java/org/intellij/sdk/maxOpenProjects/ProjectOpenCloseListener.java @@ -1,9 +1,8 @@ -// Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.intellij.sdk.maxOpenProjects; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManagerListener; import com.intellij.openapi.ui.Messages; @@ -27,7 +26,8 @@ public class ProjectOpenCloseListener implements ProjectManagerListener { return; } // Get the counting service - ProjectCountingService projectCountingService = ServiceManager.getService(ProjectCountingService.class); + ProjectCountingService projectCountingService = + ApplicationManager.getApplication().getService(ProjectCountingService.class); // Increment the project count projectCountingService.incrProjectCount(); // See if the total # of projects violates the limit. @@ -52,7 +52,8 @@ public class ProjectOpenCloseListener implements ProjectManagerListener { return; } // Get the counting service - ProjectCountingService projectCountingService = ServiceManager.getService(ProjectCountingService.class); + ProjectCountingService projectCountingService = + ApplicationManager.getApplication().getService(ProjectCountingService.class); // Decrement the count because a project just closed projectCountingService.decrProjectCount(); }