mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
platform tests:
register fake EP for virtualfilemanager for avoiding coping listeners to the new area We have to it because virtualfilemanagerimpl has non-static KeyedExtensionCollector and the listener is registered every time when the virtualfilemanagerimpl instance is created + minor: avoid non-static and non-final KeyedExtensionCollector in other places
This commit is contained in:
@@ -51,6 +51,7 @@ import com.intellij.psi.meta.MetaDataRegistrar;
|
||||
import com.intellij.psi.stubs.CoreStubTreeLoader;
|
||||
import com.intellij.psi.stubs.StubTreeLoader;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.KeyedLazyInstanceEP;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.graph.GraphAlgorithms;
|
||||
import com.intellij.util.graph.impl.GraphAlgorithmsImpl;
|
||||
@@ -105,6 +106,9 @@ public class CoreApplicationEnvironment {
|
||||
: new VirtualFileSystem[]{myLocalFileSystem, myJarFileSystem};
|
||||
VirtualFileManagerImpl virtualFileManager = new VirtualFileManagerImpl(fs, myApplication.getMessageBus());
|
||||
registerComponentInstance(appContainer, VirtualFileManager.class, virtualFileManager);
|
||||
|
||||
//fake EP for cleaning resources after area disposing (otherwise KeyedExtensionCollector listener will be copied to the next area)
|
||||
registerApplicationExtensionPoint(new ExtensionPointName<>("com.intellij.virtualFileSystem"), KeyedLazyInstanceEP.class);
|
||||
|
||||
registerApplicationService(EncodingManager.class, new CoreEncodingRegistry());
|
||||
registerApplicationService(VirtualFilePointerManager.class, createVirtualFilePointerManager());
|
||||
|
||||
+18
-19
@@ -66,25 +66,24 @@ public class ExtensionsAreaImpl implements ExtensionsArea {
|
||||
}
|
||||
//this code is required because we have a lot of static extensions e.g. LanguageExtension that are initialized only once
|
||||
//for the extensions AvailabilityListeners will be broken if the initialization happened in "fake" area which doesn't have required EP
|
||||
//commented because of memory leak in VirtualFileManagerImpl in kotlin
|
||||
//if (myAvailabilityListeners.size() > 0) {
|
||||
// for (Map.Entry<String, Collection<ExtensionPointAvailabilityListener>> entry : myAvailabilityListeners.entrySet()) {
|
||||
// String key = entry.getKey();
|
||||
// if (!processedEPs.contains(key)) {
|
||||
// boolean wasAdded = false;
|
||||
// //if listeners are "detached" for any EP we have to transfer them to the new area (otherwise it will affect area searching)
|
||||
// for (ExtensionPointAvailabilityListener listener : entry.getValue()) {
|
||||
// if (!newArea.hasAvailabilityListener(key, listener)) {
|
||||
// newArea.addAvailabilityListener(key, listener);
|
||||
// wasAdded = true;
|
||||
// }
|
||||
// }
|
||||
// if (wasAdded) {
|
||||
// processedEPs.add(key);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
if (myAvailabilityListeners.size() > 0) {
|
||||
for (Map.Entry<String, Collection<ExtensionPointAvailabilityListener>> entry : myAvailabilityListeners.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (!processedEPs.contains(key)) {
|
||||
boolean wasAdded = false;
|
||||
//if listeners are "detached" for any EP we have to transfer them to the new area (otherwise it will affect area searching)
|
||||
for (ExtensionPointAvailabilityListener listener : entry.getValue()) {
|
||||
if (!newArea.hasAvailabilityListener(key, listener)) {
|
||||
newArea.addAvailabilityListener(key, listener);
|
||||
wasAdded = true;
|
||||
}
|
||||
}
|
||||
if (wasAdded) {
|
||||
processedEPs.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ExtensionPointImpl point : newArea.myExtensionPoints.values()) {
|
||||
if (!processedEPs.contains(point.getName())) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class LineMarkerProviders extends LanguageExtension<LineMarkerProvider> {
|
||||
public static LineMarkerProviders INSTANCE = new LineMarkerProviders();
|
||||
public static final LineMarkerProviders INSTANCE = new LineMarkerProviders();
|
||||
@NonNls public static final String EP_NAME = "com.intellij.codeInsight.lineMarkerProvider";
|
||||
|
||||
private LineMarkerProviders() {
|
||||
|
||||
@@ -450,7 +450,7 @@ public class TargetElementUtil extends TargetElementUtilBase {
|
||||
return PsiSearchHelper.SERVICE.getInstance(element.getProject()).getUseScope(file != null ? file : element);
|
||||
}
|
||||
|
||||
protected final LanguageExtension<TargetElementEvaluator> targetElementEvaluator =
|
||||
protected static final LanguageExtension<TargetElementEvaluator> targetElementEvaluator =
|
||||
new LanguageExtension<>("com.intellij.targetElementEvaluator");
|
||||
@Nullable
|
||||
private TargetElementEvaluatorEx getElementEvaluatorsEx(@NotNull Language language) {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import com.intellij.lang.LanguageExtension;
|
||||
* @author yole
|
||||
*/
|
||||
public class CodeBlockProviders extends LanguageExtension<CodeBlockProvider> {
|
||||
public static CodeBlockProviders INSTANCE = new CodeBlockProviders();
|
||||
public static final CodeBlockProviders INSTANCE = new CodeBlockProviders();
|
||||
|
||||
private CodeBlockProviders() {
|
||||
super("com.intellij.codeBlockProvider");
|
||||
|
||||
Reference in New Issue
Block a user