mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[tabs] merge action disposes old contents after creating new ones
This commit is contained in:
+4
-1
@@ -39,6 +39,7 @@ import com.intellij.ui.switcher.SwitchProvider;
|
||||
import com.intellij.ui.switcher.SwitchTarget;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ContentUtilEx;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.update.ComparableObject;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -407,6 +408,7 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
|
||||
final Content selectedContent = manager.getSelectedContent();
|
||||
final List<Pair<String, JComponent>> tabs = new ArrayList<Pair<String, JComponent>>();
|
||||
int selectedTab = -1;
|
||||
List<Content> mergedContent = ContainerUtil.newArrayList();
|
||||
for (Content content : manager.getContents()) {
|
||||
if (tabPrefix.equals(content.getUserData(Content.TAB_GROUP_NAME_KEY))) {
|
||||
final String label = content.getTabName().substring(tabPrefix.length() + 2);
|
||||
@@ -417,7 +419,7 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
|
||||
tabs.add(Pair.create(label, component));
|
||||
manager.removeContent(content, false);
|
||||
content.setComponent(null);
|
||||
Disposer.dispose(content);
|
||||
mergedContent.add(content);
|
||||
}
|
||||
}
|
||||
PropertiesComponent.getInstance().unsetValue(TabbedContent.SPLIT_PROPERTY_PREFIX + tabPrefix);
|
||||
@@ -425,6 +427,7 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
|
||||
final Pair<String, JComponent> tab = tabs.get(i);
|
||||
ContentUtilEx.addTabbedContent(manager, tab.second, tabPrefix, tab.first, i == selectedTab);
|
||||
}
|
||||
mergedContent.forEach(Disposer::dispose);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user