Skip to content

Commit

Permalink
fix(gui): correct tabs filter in "Close others" tab action (#2330)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Oct 30, 2024
1 parent cc6a893 commit 61578e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions jadx-gui/src/main/java/jadx/gui/ui/tab/TabComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,10 @@ private JPopupMenu createTabPopupMenu() {
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);
}
}
});
Expand Down Expand Up @@ -310,7 +311,6 @@ public TabBlueprint getBlueprint() {
if (blueprint == null) {
throw new JadxRuntimeException("TabComponent does not have a corresponding TabBlueprint");
}

return blueprint;
}

Expand Down
12 changes: 6 additions & 6 deletions jadx-gui/src/main/java/jadx/gui/ui/tab/TabsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,16 @@ public void closeTab(JNode node) {

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);
Expand All @@ -182,15 +182,15 @@ public void closeTab(JNode node, boolean considerPins) {
}
}

/*
/**
* Removes Tab from everywhere
*/
private void closeTabForce(TabBlueprint blueprint) {
listeners.forEach(l -> l.onTabClose(blueprint));
tabsMap.remove(blueprint.getNode());
}

/*
/**
* Hides Tab from TabbedPane
*/
private void closeTabSoft(TabBlueprint blueprint) {
Expand Down

0 comments on commit 61578e8

Please sign in to comment.