feat(gui): added feature to close all left tabs (#1390) (PR #2484)

feat(gui): added feature to close all left tabs (fix #1390)
This commit is contained in:
Yaroslav
2025-05-15 22:32:05 +03:00
committed by GitHub
parent e19a456642
commit c0d721bea1
10 changed files with 21 additions and 0 deletions
@@ -282,6 +282,18 @@ public class TabComponent extends JPanel {
// We don't use TabsController here because tabs position is
// specific to TabbedPane
List<ContentPanel> contentPanels = tabbedPane.getTabs();
int currentIndex = contentPanels.indexOf(contentPanel);
if (currentIndex > 0) { // Add item only if there are tabs on the left (index > 0)
JMenuItem closeAllLeft = new JMenuItem(NLS.str("tabs.closeAllLeft"));
closeAllLeft.addActionListener(e -> {
// Iterate in reverse order from the index before the current tab to the beginning
for (int i = currentIndex - 1; i >= 0; i--) {
ContentPanel panelToClose = contentPanels.get(i);
tabsController.closeTab(panelToClose.getNode(), true);
}
});
menu.add(closeAllLeft);
}
if (contentPanel != ListUtils.last(contentPanels)) {
JMenuItem closeAllRight = new JMenuItem(NLS.str("tabs.closeAllRight"));
closeAllRight.addActionListener(e -> {
@@ -107,6 +107,7 @@ tabs.unbookmark_all=Alle Lesezeichen entfernen
tabs.pin=Anheften
tabs.closeAll=Alles schließen
tabs.closeAllRight=Alles rechts schließen
#tabs.closeAllLeft=Close All Left
tabs.code=Code
tabs.smali=Smali
@@ -107,6 +107,7 @@ tabs.unbookmark_all=Unbookmark All
tabs.pin=Pin
tabs.closeAll=Close All
tabs.closeAllRight=Close All Right
tabs.closeAllLeft=Close All Left
tabs.code=Code
tabs.smali=Smali
@@ -107,6 +107,7 @@ tabs.closeOthers=Cerrar otros
#tabs.pin=Pin
tabs.closeAll=Cerrar todo
tabs.closeAllRight=Cierra todo a la derecha
#tabs.closeAllLeft=Close All Left
#tabs.code=Code
#tabs.smali=Smali
@@ -107,6 +107,7 @@ tabs.closeOthers=Tutup yang Lain
#tabs.pin=Pin
tabs.closeAll=Tutup Semua
tabs.closeAllRight=Tutup Semua yang Kanan
#tabs.closeAllLeft=Close All Left
tabs.code=Kode
tabs.smali=Smali
@@ -107,6 +107,7 @@ tabs.closeOthers=이 탭을 제외하고 닫기
#tabs.pin=Pin
tabs.closeAll=모두 닫기
tabs.closeAllRight=오른쪽의 모든 것을 닫으십시오
#tabs.closeAllLeft=Close All Left
tabs.code=코드
tabs.smali=Smali
@@ -107,6 +107,7 @@ tabs.closeOthers=Fechar outros
#tabs.pin=Pin
tabs.closeAll=Fechar todos
tabs.closeAllRight=Feche tudo à direita
#tabs.closeAllLeft=Close All Left
tabs.code=Código
tabs.smali=Smali
@@ -107,6 +107,7 @@ tabs.closeOthers=Закрыть другие
#tabs.pin=Pin
tabs.closeAll=Закрыть все
tabs.closeAllRight=Закройте все справа
#tabs.closeAllLeft=Close All Left
tabs.code=Код
tabs.smali=Smali
@@ -107,6 +107,7 @@ tabs.unbookmark_all=取消所有收藏
tabs.pin=固定
tabs.closeAll=关闭全部
tabs.closeAllRight=关闭右边的所有
#tabs.closeAllLeft=Close All Left
tabs.code=代码
tabs.smali=Smali
@@ -107,6 +107,7 @@ tabs.unbookmark_all=全部移除書籤
tabs.pin=釘選
tabs.closeAll=關閉全部
tabs.closeAllRight=關閉右邊的所有
#tabs.closeAllLeft=Close All Left
tabs.code=程式碼
tabs.smali=Smali