mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[Project Structure] [IJPL-10393] Do not register new disposable on each module editor
There is no need to use the disposable mechanism to clear the listeners on dispose. Creating new disposable for each module is not noticable on low number of modules, but with bigger projects (20_000) modules this takes more time and causes freeze GitOrigin-RevId: 6391c4fd47bb5683f86f931721eefb7ddf697701
This commit is contained in:
committed by
intellij-monorepo-bot
parent
176d69eba6
commit
fc34652be6
@@ -96,14 +96,13 @@ public abstract class ModuleEditor implements Place.Navigator, Disposable {
|
||||
void moduleStateChanged(ModifiableRootModel moduleRootModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listeners are automatically unsubscribed on dispose
|
||||
*/
|
||||
public void addChangeListener(ChangeListener listener) {
|
||||
myEventDispatcher.addListener(listener);
|
||||
}
|
||||
|
||||
public void removeChangeListener(ChangeListener listener) {
|
||||
myEventDispatcher.removeListener(listener);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Module getModule() {
|
||||
return myModulesProvider.getModule(myName);
|
||||
@@ -286,6 +285,7 @@ public abstract class ModuleEditor implements Place.Navigator, Disposable {
|
||||
@Override
|
||||
public void dispose() {
|
||||
try {
|
||||
myEventDispatcher.getListeners().clear();
|
||||
for (final ModuleConfigurationEditor myEditor : myEditors) {
|
||||
myEditor.disposeUIResources();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 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.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.facet.Facet;
|
||||
@@ -11,7 +11,6 @@ import com.intellij.ide.projectWizard.NewProjectWizard;
|
||||
import com.intellij.ide.util.newProjectWizard.AbstractProjectWizard;
|
||||
import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.ide.util.projectWizard.ProjectBuilder;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -192,12 +191,6 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
|
||||
myModuleEditors.put(moduleEditor.getModule(), moduleEditor);
|
||||
|
||||
moduleEditor.addChangeListener(this);
|
||||
Disposer.register(moduleEditor, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
moduleEditor.removeChangeListener(ModulesConfigurator.this);
|
||||
}
|
||||
});
|
||||
return moduleEditor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user