From 8fcf420a673c57294ff1eee3e0959a62e9a5d35c Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Fri, 17 Jul 2015 12:38:02 +0200 Subject: [PATCH] =?UTF-8?q?save=20memory=20=E2=80=94=20don't=20keep=20list?= =?UTF-8?q?=20of=20componentConfigs=20avoid=20list=20(of=20componentConfig?= =?UTF-8?q?s)=20to=20array=20transformation=20just=20to=20get=20size=20sim?= =?UTF-8?q?plify=20code=20=E2=80=94=20we=20don't=20need=20to=20use=20and?= =?UTF-8?q?=20keep=20bool=20flag=20myClassesLoaded,=20we=20can=20just=20mo?= =?UTF-8?q?ve=20init=20logic=20to=20constructor=20and,=20so,=20we=20don't?= =?UTF-8?q?=20have=20to=20assert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make app init progress bar more precise — component could require other components, and, so, we should call setFraction not in init() after getComponent() call, but on each component initialization (as it was implemented in case of Project — now this logic is unified) --- .../components/ex/ComponentManagerEx.java | 10 +- .../impl/ComponentManagerConfigurator.java | 46 ------ .../components/impl/ComponentManagerImpl.java | 155 +++++++----------- .../openapi/module/impl/ModuleImpl.java | 14 +- .../application/impl/ApplicationImpl.java | 50 +++--- .../impl/PlatformComponentManagerImpl.java | 17 +- .../openapi/project/impl/ProjectImpl.java | 20 +-- .../src/com/intellij/core/CoreModule.java | 6 +- .../openapi/module/impl/ModuleEx.java | 2 - 9 files changed, 115 insertions(+), 205 deletions(-) delete mode 100644 platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerConfigurator.java diff --git a/platform/core-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java b/platform/core-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java index 8fc6a8e8e74e..215d5159b289 100644 --- a/platform/core-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java +++ b/platform/core-impl/src/com/intellij/openapi/components/ex/ComponentManagerEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,18 +15,12 @@ */ package com.intellij.openapi.components.ex; -import com.intellij.openapi.components.ComponentConfig; import com.intellij.openapi.components.ComponentManager; -import com.intellij.openapi.extensions.PluginDescriptor; import org.jetbrains.annotations.NotNull; /** * @author max */ public interface ComponentManagerEx extends ComponentManager { - - void registerComponent(@NotNull ComponentConfig config); - void registerComponent(@NotNull ComponentConfig config, PluginDescriptor pluginDescriptor); - void initializeComponent(@NotNull Object component, boolean service); -} +} \ No newline at end of file diff --git a/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerConfigurator.java b/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerConfigurator.java deleted file mode 100644 index ebd8dfc0f1c3..000000000000 --- a/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerConfigurator.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.components.impl; - -import com.intellij.openapi.components.ComponentConfig; -import com.intellij.openapi.extensions.PluginDescriptor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -class ComponentManagerConfigurator { - private final ComponentManagerImpl myComponentManager; - - public ComponentManagerConfigurator(@NotNull ComponentManagerImpl componentManager) { - myComponentManager = componentManager; - } - - private void loadSingleConfig(@NotNull ComponentConfig config, - @Nullable PluginDescriptor descriptor, - boolean defaultProject) { - if (defaultProject && !config.isLoadForDefaultProject()) return; - if (!myComponentManager.isComponentSuitable(config.options)) return; - - myComponentManager.registerComponent(config, descriptor); - } - - void loadComponentsConfiguration(@NotNull ComponentConfig[] components, - @Nullable PluginDescriptor descriptor, - final boolean defaultProject) { - for (ComponentConfig config : components) { - loadSingleConfig(config, descriptor, defaultProject); - } - } -} diff --git a/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java b/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java index cdc97ef157d4..913b3166b1cb 100644 --- a/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/components/impl/ComponentManagerImpl.java @@ -22,7 +22,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.*; import com.intellij.openapi.components.ex.ComponentManagerEx; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.extensions.PluginDescriptor; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; @@ -47,6 +46,7 @@ import org.picocontainer.*; import java.lang.reflect.Array; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -66,9 +66,8 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements private MessageBus myMessageBus; - private final ComponentManagerConfigurator myConfigurator = new ComponentManagerConfigurator(this); private final ComponentManager myParentComponentManager; - private ComponentsRegistry myComponentsRegistry = new ComponentsRegistry(); + private ComponentsRegistry myComponentsRegistry; private final Condition myDisposedCondition = new Condition() { @Override public boolean value(final Object o) { @@ -76,44 +75,50 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements } }; - protected ComponentManagerImpl(ComponentManager parentComponentManager) { + protected ComponentManagerImpl(@Nullable ComponentManager parentComponentManager) { myParentComponentManager = parentComponentManager; bootstrapPicoContainer(toString()); } - protected ComponentManagerImpl(ComponentManager parentComponentManager, @NotNull String name) { + protected ComponentManagerImpl(@Nullable ComponentManager parentComponentManager, @NotNull String name) { myParentComponentManager = parentComponentManager; bootstrapPicoContainer(name); } - protected void init() { - init(null); + protected final void init(@Nullable ProgressIndicator progressIndicator) { + init(progressIndicator, null); } - protected final void init(@Nullable Runnable classesLoaded) { + protected final void init(@Nullable ProgressIndicator indicator, @Nullable Runnable componentsRegistered) { try { - myComponentsRegistry.loadClasses(); + ArrayList componentConfigs = new ArrayList(); + registerComponents(componentConfigs); + myComponentsRegistry = new ComponentsRegistry(componentConfigs); - if (classesLoaded != null) { - classesLoaded.run(); + if (componentsRegistered != null) { + componentsRegistered.run(); } - ProgressManager progressManager = ProgressManager.getInstance(); - for (Class componentInterface : myComponentsRegistry.getComponentInterfaces()) { - ProgressIndicator indicator = progressManager.getProgressIndicator(); - if (indicator != null) { - indicator.checkCanceled(); - } - - getComponent(componentInterface); - componentCreatedDuringInit(); + if (indicator != null) { + indicator.setIndeterminate(false); } + createComponents(indicator); } finally { myComponentsCreated = true; } } - protected void componentCreatedDuringInit() { + protected void setProgressDuringInit(@NotNull ProgressIndicator indicator) { + indicator.setFraction(getPercentageOfComponentsLoaded()); + } + + protected void createComponents(@Nullable ProgressIndicator indicator) { + for (Class componentInterface : myComponentsRegistry.myComponentInterfaces) { + getComponent(componentInterface); + if (indicator != null) { + indicator.checkCanceled(); + } + } } @NotNull @@ -134,7 +139,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements protected synchronized void disposeComponents() { assert !myDisposeCompleted : "Already disposed!"; - final List components = myComponentsRegistry.getRegisteredImplementations(); + final List components = myComponentsRegistry == null ? Collections.emptyList() : myComponentsRegistry.getRegisteredImplementations(); myDisposed = true; for (int i = components.size() - 1; i >= 0; i--) { @@ -207,7 +212,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements return ProgressManager.getInstance().getProgressIndicator(); } - protected float getPercentageOfComponentsLoaded() { + protected final double getPercentageOfComponentsLoaded() { return myComponentsRegistry.getPercentageOfComponentsLoaded(); } @@ -219,15 +224,6 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements LOG.error(ex); } - @Override - @SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext") - public synchronized void registerComponent(@NotNull final ComponentConfig config, final PluginDescriptor pluginDescriptor) { - if (!config.prepareClasses(isHeadless())) return; - - config.pluginDescriptor = pluginDescriptor; - myComponentsRegistry.registerComponent(config); - } - public synchronized void registerComponentImplementation(@NotNull Class componentKey, @NotNull Class componentImplementation) { getPicoContainer().registerComponentImplementation(componentKey.getName(), componentImplementation); myInitializedComponents.remove(componentKey); @@ -301,12 +297,22 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements return myDisposed; } - protected void loadComponents() { - final IdeaPluginDescriptor[] plugins = PluginManagerCore.getPlugins(); + private void registerComponents(@NotNull ArrayList componentConfigs) { boolean isDefaultProject = this instanceof Project && ((Project)this).isDefault(); - for (IdeaPluginDescriptor plugin : plugins) { - if (PluginManagerCore.shouldSkipPlugin(plugin)) continue; - myConfigurator.loadComponentsConfiguration(getMyComponentConfigsFromDescriptor(plugin), plugin, isDefaultProject); + boolean headless = ApplicationManager.getApplication().isHeadlessEnvironment(); + for (IdeaPluginDescriptor plugin : PluginManagerCore.getPlugins()) { + if (PluginManagerCore.shouldSkipPlugin(plugin)) { + continue; + } + + ComponentConfig[] configs = getMyComponentConfigsFromDescriptor(plugin); + componentConfigs.ensureCapacity(componentConfigs.size() + configs.length); + for (ComponentConfig config : configs) { + if ((!isDefaultProject || config.isLoadForDefaultProject()) && isComponentSuitable(config.options) && config.prepareClasses(headless)) { + config.pluginDescriptor = plugin; + componentConfigs.add(config); + } + } } } @@ -328,21 +334,8 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements return myParentComponentManager; } - private static class HeadlessHolder { - private static final boolean myHeadless = ApplicationManager.getApplication().isHeadlessEnvironment(); - } - private static boolean isHeadless() { - return HeadlessHolder.myHeadless; - } - - @Override - public void registerComponent(@NotNull final ComponentConfig config) { - registerComponent(config, null); - } - - @NotNull - public ComponentConfig[] getComponentConfigurations() { - return myComponentsRegistry.getComponentConfigurations(); + protected final int getComponentConfigurationsSize() { + return myComponentsRegistry.myComponentConfigsSize; } @Nullable @@ -375,24 +368,21 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements private class ComponentsRegistry { private final Map myInterfaceToLockMap = new THashMap(); private final Map myInterfaceToClassMap = new THashMap(); - private final List myComponentInterfaces = new ArrayList(); // keeps order of component's registration + private final List myComponentInterfaces; // keeps order of component's registration private final Map myNameToComponent = new THashMap(); - private final List myComponentConfigs = new ArrayList(); + private final int myComponentConfigsSize; private final List myImplementations = new ArrayList(); private final Map myComponentClassToConfig = new THashMap(); - private boolean myClassesLoaded; - private void loadClasses() { - assert !myClassesLoaded; - - for (ComponentConfig config : myComponentConfigs) { + public ComponentsRegistry(@NotNull List componentConfigs) { + myComponentInterfaces = new ArrayList(componentConfigs.size()); + for (ComponentConfig config : componentConfigs) { loadClasses(config); } - - myClassesLoaded = true; + myComponentConfigsSize = componentConfigs.size(); } - private void loadClasses(final ComponentConfig config) { + private void loadClasses(@NotNull ComponentConfig config) { ClassLoader loader = config.getClassLoader(); try { @@ -436,17 +426,12 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements return lock; } - private Class[] getComponentInterfaces() { - assert myClassesLoaded; - return myComponentInterfaces.toArray(new Class[myComponentInterfaces.size()]); - } - private boolean containsInterface(final Class interfaceClass) { return myInterfaceToClassMap.containsKey(interfaceClass); } - private float getPercentageOfComponentsLoaded() { - return ((float)myImplementations.size()) / myComponentConfigs.size(); + private double getPercentageOfComponentsLoaded() { + return ((double)myImplementations.size()) / myComponentConfigsSize; } private void registerComponentInstance(final Object component) { @@ -474,14 +459,6 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements return myImplementations; } - private void registerComponent(ComponentConfig config) { - myComponentConfigs.add(config); - - if (myClassesLoaded) { - loadClasses(config); - } - } - private BaseComponent getComponentByName(final String name) { return myNameToComponent.get(name); } @@ -502,11 +479,6 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements return array.toArray((T[])Array.newInstance(baseClass, array.size())); } - @NotNull - private ComponentConfig[] getComponentConfigurations() { - return myComponentConfigs.toArray(new ComponentConfig[myComponentConfigs.size()]); - } - public ComponentConfig getConfig(final Class componentImplementation) { return myComponentClassToConfig.get(componentImplementation); } @@ -525,21 +497,9 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements myDelegate = new ConstructorInjectionComponentAdapter(componentKey, implementationClass, null, true) { @Override public Object getComponentInstance(PicoContainer picoContainer) throws PicoInitializationException, PicoIntrospectionException, ProcessCanceledException { - if (myInitialized) { - // so, instance cached and we don't need to do anything - // we have to avoid getProgressIndicator() because it could lead to cyclic call - // (get app component -> get app state store to init component -> get progress indicator -> get app state store to init progress indicator -> get progress indicator -> ... ) - return super.getComponentInstance(picoContainer); - } - - ProgressIndicator indicator = getProgressIndicator(); - if (indicator != null) { - indicator.checkCanceled(); - } - Object componentInstance = null; try { - long startTime = myInitialized ? 0 : System.nanoTime(); + long startTime = System.nanoTime(); componentInstance = super.getComponentInstance(picoContainer); @@ -558,6 +518,11 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements myInitializing = true; myComponentsRegistry.registerComponentInstance(componentInstance); + ProgressIndicator indicator = getProgressIndicator(); + if (indicator != null) { + indicator.checkCanceled(); + setProgressDuringInit(indicator); + } initializeComponent(componentInstance, false); if (componentInstance instanceof BaseComponent) { ((BaseComponent)componentInstance).initComponent(); diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java index 5f05767ed81b..7def1647dd49 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java @@ -33,6 +33,8 @@ import com.intellij.openapi.module.ModifiableModuleModel; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleComponent; import com.intellij.openapi.module.impl.scopes.ModuleScopeProviderImpl; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.impl.storage.ClasspathStorage; import com.intellij.openapi.util.Comparing; @@ -93,11 +95,6 @@ public class ModuleImpl extends PlatformComponentManagerImpl implements ModuleEx return (ModuleStoreImpl)getPicoContainer().getComponentInstance(IComponentStore.class); } - @Override - public void initializeComponent(@NotNull Object component, boolean service) { - getStateStore().initComponent(component, service); - } - private void init(String filePath) { getStateStore().setModuleFilePath(filePath); myName = moduleNameByFileName(PathUtil.getFileName(filePath)); @@ -107,13 +104,12 @@ public class ModuleImpl extends PlatformComponentManagerImpl implements ModuleEx @Override public void init() { - loadComponents(); - super.init(); + init(ProgressManager.getInstance().getProgressIndicator()); } @Override - public void loadModuleComponents() { - loadComponents(); + protected void setProgressDuringInit(@NotNull ProgressIndicator indicator) { + // module loading progress is not tracked, progress updated by ModuleManagerImpl on module load } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index d875089860a8..67919044d43b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -29,7 +29,10 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.application.*; import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.command.CommandProcessor; -import com.intellij.openapi.components.*; +import com.intellij.openapi.components.ComponentConfig; +import com.intellij.openapi.components.ComponentsPackage; +import com.intellij.openapi.components.StateStorageException; +import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.components.impl.PlatformComponentManagerImpl; import com.intellij.openapi.components.impl.ServiceManagerImpl; import com.intellij.openapi.components.impl.stores.IComponentStore; @@ -175,13 +178,6 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App return ComponentsPackage.getStateStore(this); } - @Override - public void initializeComponent(@NotNull Object component, boolean service) { - if (!service || !(component instanceof PathMacroManager || component instanceof IComponentStore)) { - ComponentsPackage.getStateStore(this).initComponent(component, service); - } - } - public ApplicationImpl(boolean isInternal, boolean isUnitTestMode, boolean isHeadless, @@ -337,13 +333,6 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App return BitUtil.isSet(status.flags, IS_READ_LOCK_ACQUIRED_FLAG); } - @Override - protected void componentCreatedDuringInit() { - if (mySplash != null) { - mySplash.showProgress("", 0.65f + getPercentageOfComponentsLoaded() * 0.35f); - } - } - @NotNull @Override protected MutablePicoContainer createPicoContainer() { @@ -471,9 +460,12 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App AccessToken token = HeavyProcessLatch.INSTANCE.processStarted("Loading application components"); try { long t = System.currentTimeMillis(); - loadComponents(); - - init(new Runnable() { + init(mySplash == null ? null : new EmptyProgressIndicator() { + @Override + public void setFraction(double fraction) { + mySplash.showProgress("", (float)(0.65 + getPercentageOfComponentsLoaded() * 0.35)); + } + }, new Runnable() { @Override public void run() { // create ServiceManagerImpl at first to force extension classes registration @@ -494,7 +486,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App } }); t = System.currentTimeMillis() - t; - LOG.info(getComponentConfigurations().length + " application components initialized in " + t + " ms"); + LOG.info(getComponentConfigurationsSize() + " application components initialized in " + t + " ms"); } catch (StateStorageException e) { throw new IOException(e); @@ -507,6 +499,26 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App createLocatorFile(); } + @Override + protected void createComponents(@Nullable final ProgressIndicator indicator) { + // we cannot wrap "init()" call because ProgressManager instance could be created only after component registration (our "componentsRegistered" callback) + Runnable task = new Runnable() { + @Override + public void run() { + ApplicationImpl.super.createComponents(indicator); + } + }; + + if (indicator == null) { + // no splash, no need to to use progress manager + task.run(); + } + else { + ProgressManager.getInstance().runProcess(task, indicator); + } + } + + @Override @Nullable protected ProgressIndicator getProgressIndicator() { // could be called before full initialization diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/PlatformComponentManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/PlatformComponentManagerImpl.java index ea1e77be2415..312b78445c91 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/PlatformComponentManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/PlatformComponentManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,20 @@ package com.intellij.openapi.components.impl; import com.intellij.ide.plugins.PluginManager; import com.intellij.openapi.components.ComponentConfig; import com.intellij.openapi.components.ComponentManager; +import com.intellij.openapi.components.ComponentsPackage; +import com.intellij.openapi.components.PathMacroManager; +import com.intellij.openapi.components.impl.stores.IComponentStore; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public abstract class PlatformComponentManagerImpl extends ComponentManagerImpl { private boolean myHandlingInitComponentError; - protected PlatformComponentManagerImpl(ComponentManager parent) { + protected PlatformComponentManagerImpl(@Nullable ComponentManager parent) { super(parent); } - protected PlatformComponentManagerImpl(ComponentManager parent, @NotNull String name) { + protected PlatformComponentManagerImpl(@Nullable ComponentManager parent, @NotNull String name) { super(parent, name); } @@ -43,4 +47,11 @@ public abstract class PlatformComponentManagerImpl extends ComponentManagerImpl } } } + + @Override + public void initializeComponent(@NotNull Object component, boolean service) { + if (!service || !(component instanceof PathMacroManager || component instanceof IComponentStore)) { + ComponentsPackage.getStateStore(this).initComponent(component, service); + } + } } diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java index 8bdb9ebd7d9b..cbc2f80e391a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java @@ -36,7 +36,6 @@ import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressIndicatorProvider; -import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.DumbAwareRunnable; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; @@ -202,20 +201,6 @@ public class ProjectImpl extends PlatformComponentManagerImpl implements Project return (IProjectStore)getPicoContainer().getComponentInstance(IComponentStore.class); } - @Override - public void initializeComponent(@NotNull Object component, boolean service) { - if (!service) { - ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); - if (indicator != null) { - // indicator.setText2(getComponentName(component)); - indicator.setIndeterminate(false); - indicator.setFraction(getPercentageOfComponentsLoaded()); - } - } - - getStateStore().initComponent(component, service); - } - @Override public boolean isOpen() { return ProjectManagerEx.getInstanceEx().isProjectOpened(this); @@ -302,14 +287,13 @@ public class ProjectImpl extends PlatformComponentManagerImpl implements Project if (progressIndicator != null) { progressIndicator.pushState(); } - loadComponents(); - super.init(); + super.init(progressIndicator); if (progressIndicator != null) { progressIndicator.popState(); } long time = System.currentTimeMillis() - start; - LOG.info(getComponentConfigurations().length + " project components initialized in " + time + " ms"); + LOG.info(getComponentConfigurationsSize() + " project components initialized in " + time + " ms"); getMessageBus().syncPublisher(ProjectLifecycleListener.TOPIC).projectComponentsInitialized(this); diff --git a/platform/projectModel-impl/src/com/intellij/core/CoreModule.java b/platform/projectModel-impl/src/com/intellij/core/CoreModule.java index e87e2b9ff8a5..22cb2ee198ef 100644 --- a/platform/projectModel-impl/src/com/intellij/core/CoreModule.java +++ b/platform/projectModel-impl/src/com/intellij/core/CoreModule.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,10 +117,6 @@ public class CoreModule extends MockComponentManager implements ModuleEx { public void init() { } - @Override - public void loadModuleComponents() { - } - @Override public void moduleAdded() { } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleEx.java b/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleEx.java index 06dd60bfc0d6..60fe6e73ea6b 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleEx.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleEx.java @@ -22,8 +22,6 @@ import com.intellij.openapi.module.Module; */ public interface ModuleEx extends Module { void init(); - @Deprecated - void loadModuleComponents(); void moduleAdded(); void projectOpened(); void projectClosed();