mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
decouple ComponentManagerImpl from more Application impl stuff
This commit is contained in:
@@ -19,6 +19,7 @@ package com.intellij.openapi.module.impl;
|
||||
import com.intellij.ide.highlighter.ModuleFileType;
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginManager;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.components.impl.ComponentManagerImpl;
|
||||
import com.intellij.openapi.components.impl.ModulePathMacroManager;
|
||||
import com.intellij.openapi.components.impl.stores.IComponentStore;
|
||||
@@ -308,6 +309,11 @@ public class ModuleImpl extends ComponentManagerImpl implements Module {
|
||||
return Extensions.getArea(this).getExtensionPoint(extensionPointName).getExtensions();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean logSlowComponents() {
|
||||
return super.logSlowComponents() || ApplicationInfoImpl.getShadowInstance().isEAP();
|
||||
}
|
||||
|
||||
private class MyVirtualFileListener extends VirtualFileAdapter {
|
||||
public void propertyChanged(VirtualFilePropertyEvent event) {
|
||||
if (!isModuleAdded) return;
|
||||
|
||||
@@ -1319,6 +1319,11 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean logSlowComponents() {
|
||||
return super.logSlowComponents() || ApplicationInfoImpl.getShadowInstance().isEAP();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Application" +
|
||||
|
||||
+6
-7
@@ -17,8 +17,6 @@ package com.intellij.openapi.components.impl;
|
||||
|
||||
import com.intellij.diagnostic.PluginException;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.components.*;
|
||||
import com.intellij.openapi.components.ex.ComponentManagerEx;
|
||||
import com.intellij.openapi.components.impl.stores.IComponentStore;
|
||||
@@ -344,7 +342,7 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
|
||||
}
|
||||
|
||||
protected boolean isComponentSuitable(Map<String, String> options) {
|
||||
return !isTrue(options, "internal") || ApplicationManagerEx.getApplicationEx().isInternal();
|
||||
return !isTrue(options, "internal") || ApplicationManager.getApplication().isInternal();
|
||||
}
|
||||
|
||||
private static boolean isTrue(Map<String, String> options, @NonNls final String option) {
|
||||
@@ -446,6 +444,10 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean logSlowComponents() {
|
||||
return LOG.isDebugEnabled();
|
||||
}
|
||||
|
||||
private class ComponentsRegistry {
|
||||
private final Map<Class, Object> myInterfaceToLockMap = new HashMap<Class, Object>();
|
||||
private final Map<Class, Class> myInterfaceToClassMap = new HashMap<Class, Class>();
|
||||
@@ -670,12 +672,9 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
|
||||
long endTime = System.nanoTime();
|
||||
long ms = (endTime - startTime) / 1000000;
|
||||
if (ms > 10) {
|
||||
if (ApplicationInfoImpl.getShadowInstance().isEAP()) {
|
||||
if (logSlowComponents()) {
|
||||
LOG.info(componentInstance.getClass().getName() + " initialized in " + ms + " ms");
|
||||
}
|
||||
else if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(componentInstance.getClass().getName() + " initialized in " + ms + " ms");
|
||||
}
|
||||
}
|
||||
myInitializing = false;
|
||||
myInitialized = true;
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
|
||||
import com.intellij.openapi.application.impl.PluginsFacade;
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
@@ -477,6 +478,11 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean logSlowComponents() {
|
||||
return super.logSlowComponents() || ApplicationInfoImpl.getShadowInstance().isEAP();
|
||||
}
|
||||
|
||||
public static void dropUnableToSaveProjectNotification(@NotNull final Project project, final VirtualFile[] readOnlyFiles) {
|
||||
final UnableToSaveProjectNotification[] notifications =
|
||||
NotificationsManager.getNotificationsManager().getNotificationsOfType(UnableToSaveProjectNotification.class, project);
|
||||
|
||||
Reference in New Issue
Block a user