From b65583d8e4f005ca0a48575fe6ba039f73873afe Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 22 Jul 2015 18:57:29 +0200 Subject: [PATCH] EclipseModuleManagerImpl is a service, so, must be registered as a service --- .../openapi/module/ModuleServiceManager.java | 21 ++++++++++++++++++- plugins/eclipse/resources/META-INF/plugin.xml | 7 ++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/platform/core-api/src/com/intellij/openapi/module/ModuleServiceManager.java b/platform/core-api/src/com/intellij/openapi/module/ModuleServiceManager.java index ab234bacd290..ad7e3b7265e6 100644 --- a/platform/core-api/src/com/intellij/openapi/module/ModuleServiceManager.java +++ b/platform/core-api/src/com/intellij/openapi/module/ModuleServiceManager.java @@ -16,6 +16,9 @@ package com.intellij.openapi.module; +import com.intellij.openapi.application.Application; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.diagnostic.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -23,12 +26,28 @@ import org.jetbrains.annotations.Nullable; * @author yole */ public class ModuleServiceManager { + private static final Logger LOG = Logger.getInstance(ModuleServiceManager.class); + private ModuleServiceManager() { } @Nullable public static T getService(@NotNull Module module, @NotNull Class serviceClass) { //noinspection unchecked - return (T)module.getPicoContainer().getComponentInstance(serviceClass.getName()); + T instance = (T)module.getPicoContainer().getComponentInstance(serviceClass.getName()); + if (instance == null) { + instance = module.getComponent(serviceClass); + if (instance != null) { + Application app = ApplicationManager.getApplication(); + String message = serviceClass.getName() + " requested as a service, but it is a component - convert it to a service or change call to module.getComponent()"; + if (app.isUnitTestMode()) { + LOG.error(message); + } + else { + LOG.warn(message); + } + } + } + return instance; } } \ No newline at end of file diff --git a/plugins/eclipse/resources/META-INF/plugin.xml b/plugins/eclipse/resources/META-INF/plugin.xml index 3c9da31159d6..f53e46d90cbd 100644 --- a/plugins/eclipse/resources/META-INF/plugin.xml +++ b/plugins/eclipse/resources/META-INF/plugin.xml @@ -30,12 +30,9 @@ name="Eclipse XML Profile" implementationClass="org.jetbrains.idea.eclipse.importer.EclipseCodeStyleSchemeImporter" schemeClass="com.intellij.psi.codeStyle.CodeStyleScheme"/> + + - - - org.jetbrains.idea.eclipse.config.EclipseModuleManagerImpl - -