mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EclipseModuleManagerImpl is a service, so, must be registered as a service
This commit is contained in:
@@ -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> T getService(@NotNull Module module, @NotNull Class<T> 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;
|
||||
}
|
||||
}
|
||||
@@ -30,12 +30,9 @@
|
||||
name="Eclipse XML Profile"
|
||||
implementationClass="org.jetbrains.idea.eclipse.importer.EclipseCodeStyleSchemeImporter"
|
||||
schemeClass="com.intellij.psi.codeStyle.CodeStyleScheme"/>
|
||||
|
||||
<moduleService serviceImplementation="org.jetbrains.idea.eclipse.config.EclipseModuleManagerImpl"/>
|
||||
</extensions>
|
||||
<module-components>
|
||||
<component>
|
||||
<implementation-class>org.jetbrains.idea.eclipse.config.EclipseModuleManagerImpl</implementation-class>
|
||||
</component>
|
||||
</module-components>
|
||||
<actions>
|
||||
<action id="ExportToEclipse" class="org.jetbrains.idea.eclipse.export.ExportEclipseProjectsAction" text="Export to Eclipse...">
|
||||
<add-to-group group-id="ExportImportGroup" anchor="last"/>
|
||||
|
||||
Reference in New Issue
Block a user