GitOrigin-RevId: eb73190d1af092134e01a374b0f4e2730f3fd523
This commit is contained in:
Vladimir Krivosheev
2019-08-01 20:05:37 +03:00
committed by intellij-monorepo-bot
parent 75a78d65a2
commit cd9b7156a6
@@ -1,63 +1,52 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.components.impl;
package com.intellij.openapi.components.impl
import com.intellij.diagnostic.LoadingPhase;
import com.intellij.ide.plugins.ContainerDescriptor;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.IdeaPluginDescriptorImpl;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.openapi.components.ComponentManager;
import com.intellij.openapi.components.PathMacroManager;
import com.intellij.openapi.components.ServiceDescriptor;
import com.intellij.openapi.components.ServiceKt;
import com.intellij.openapi.components.impl.stores.IComponentStore;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.util.messages.MessageBusFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.intellij.diagnostic.LoadingPhase
import com.intellij.ide.plugins.ContainerDescriptor
import com.intellij.ide.plugins.IdeaPluginDescriptor
import com.intellij.ide.plugins.IdeaPluginDescriptorImpl
import com.intellij.ide.plugins.PluginManager
import com.intellij.openapi.components.ComponentManager
import com.intellij.openapi.components.PathMacroManager
import com.intellij.openapi.components.ServiceDescriptor
import com.intellij.openapi.components.impl.stores.IComponentStore
import com.intellij.openapi.components.stateStore
import com.intellij.openapi.extensions.PluginId
import com.intellij.util.messages.MessageBusFactory
public abstract class PlatformComponentManagerImpl extends ComponentManagerImpl {
private boolean myHandlingInitComponentError;
abstract class PlatformComponentManagerImpl : ComponentManagerImpl {
private var handlingInitComponentError = false
protected PlatformComponentManagerImpl(@Nullable ComponentManager parent) {
super(parent);
}
private val componentStore: IComponentStore
get() = this.stateStore
protected PlatformComponentManagerImpl(@Nullable ComponentManager parent, @NotNull String name) {
super(parent, name);
}
protected constructor(parent: ComponentManager?) : super(parent)
@Override
protected void handleInitComponentError(@NotNull Throwable t, String componentClassName, PluginId pluginId) {
if (!myHandlingInitComponentError) {
myHandlingInitComponentError = true;
protected constructor(parent: ComponentManager?, name: String) : super(parent, name)
override fun handleInitComponentError(t: Throwable, componentClassName: String, pluginId: PluginId) {
if (!handlingInitComponentError) {
handlingInitComponentError = true
try {
PluginManager.handleComponentError(t, componentClassName, pluginId);
PluginManager.handleComponentError(t, componentClassName, pluginId)
}
finally {
myHandlingInitComponentError = false;
handlingInitComponentError = false
}
}
}
@Override
public void initializeComponent(@NotNull Object component, @Nullable ServiceDescriptor serviceDescriptor) {
if (serviceDescriptor == null || !(component instanceof PathMacroManager || component instanceof IComponentStore || component instanceof MessageBusFactory)) {
LoadingPhase.assertAtLeast(LoadingPhase.CONFIGURATION_STORE_INITIALIZED);
getComponentStore().initComponent(component, serviceDescriptor);
override fun initializeComponent(component: Any, serviceDescriptor: ServiceDescriptor?) {
if (serviceDescriptor == null || !(component is PathMacroManager || component is IComponentStore || component is MessageBusFactory)) {
LoadingPhase.assertAtLeast(LoadingPhase.CONFIGURATION_STORE_INITIALIZED)
componentStore.initComponent(component, serviceDescriptor)
}
}
@NotNull
protected IComponentStore getComponentStore() {
return ServiceKt.getStateStore(this);
override fun registerServices(pluginDescriptor: IdeaPluginDescriptor) {
ServiceManagerImpl.registerServices(getContainerDescriptor(pluginDescriptor as IdeaPluginDescriptorImpl).services, pluginDescriptor,
this)
}
@Override
protected final void registerServices(@NotNull IdeaPluginDescriptor pluginDescriptor) {
ServiceManagerImpl.registerServices(getContainerDescriptor((IdeaPluginDescriptorImpl)pluginDescriptor).getServices(), pluginDescriptor, this);
}
@NotNull
protected abstract ContainerDescriptor getContainerDescriptor(@NotNull IdeaPluginDescriptorImpl pluginDescriptor);
protected abstract fun getContainerDescriptor(pluginDescriptor: IdeaPluginDescriptorImpl): ContainerDescriptor
}