fix(gui): correct tabs filter in "Close others" tab action (#2330)

This commit is contained in:
Skylot 2024-10-30 17:20:16 +00:00
parent cc6a893402
commit 61578e8793
No known key found for this signature in database
GPG Key ID: 47A4975761262B6A
2 changed files with 9 additions and 9 deletions

View File

@ -243,9 +243,10 @@ public class TabComponent extends JPanel {
if (tabs.size() > 1) {
JMenuItem closeOther = new JMenuItem(NLS.str("tabs.closeOthers"));
closeOther.addActionListener(e -> {
JNode currentNode = getNode();
for (TabBlueprint tab : tabs) {
if (tab != getBlueprint()) {
tabsController.closeTab(getNode(), true);
if (tab.getNode() != currentNode) {
tabsController.closeTab(tab, true);
}
}
});
@ -310,7 +311,6 @@ public class TabComponent extends JPanel {
if (blueprint == null) {
throw new JadxRuntimeException("TabComponent does not have a corresponding TabBlueprint");
}
return blueprint;
}

View File

@ -163,16 +163,16 @@ public class TabsController {
public void closeTab(JNode node, boolean considerPins) {
TabBlueprint blueprint = getTabByNode(node);
if (blueprint == null) {
return;
if (blueprint != null) {
closeTab(blueprint, considerPins);
}
}
public void closeTab(TabBlueprint blueprint, boolean considerPins) {
if (forceClose) {
closeTabForce(blueprint);
return;
}
if (!considerPins || !blueprint.isPinned()) {
if (!blueprint.isReferenced()) {
closeTabForce(blueprint);
@ -182,7 +182,7 @@ public class TabsController {
}
}
/*
/**
* Removes Tab from everywhere
*/
private void closeTabForce(TabBlueprint blueprint) {
@ -190,7 +190,7 @@ public class TabsController {
tabsMap.remove(blueprint.getNode());
}
/*
/**
* Hides Tab from TabbedPane
*/
private void closeTabSoft(TabBlueprint blueprint) {