Skip to content

Commit

Permalink
feat(gui): close all tabs to the right (#1939)(PR #1940)
Browse files Browse the repository at this point in the history
* feat(gui): close all tabs to the right (#1939)

* remove usage of LinkedHashMap as variable type

---------

Co-authored-by: Skylot <[email protected]>
  • Loading branch information
bytemarx and skylot authored Jul 5, 2023
1 parent ba0e918 commit 219f9eb
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions jadx-gui/src/main/java/jadx/gui/ui/TabComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicButtonUI;

import jadx.core.utils.ListUtils;
import jadx.gui.treemodel.JClass;
import jadx.gui.treemodel.JEditableNode;
import jadx.gui.treemodel.JNode;
Expand Down Expand Up @@ -148,6 +149,24 @@ private JPopupMenu createTabPopupMenu(final ContentPanel contentPanel) {
JMenuItem closeAll = new JMenuItem(NLS.str("tabs.closeAll"));
closeAll.addActionListener(e -> tabbedPane.closeAllTabs());
menu.add(closeAll);

List<ContentPanel> contentPanels = new ArrayList<>(openTabs.values());
if (contentPanel != ListUtils.last(contentPanels)) {
JMenuItem closeAllRight = new JMenuItem(NLS.str("tabs.closeAllRight"));
closeAllRight.addActionListener(e -> {
boolean pastCurrentPanel = false;
for (ContentPanel panel : contentPanels) {
if (!pastCurrentPanel) {
if (panel == contentPanel) {
pastCurrentPanel = true;
}
} else {
tabbedPane.closeCodePanel(panel);
}
}
});
menu.add(closeAllRight);
}
menu.addSeparator();

ContentPanel selectedContentPanel = tabbedPane.getSelectedContentPanel();
Expand Down
1 change: 1 addition & 0 deletions jadx-gui/src/main/resources/i18n/Messages_de_DE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tabs.copy_class_name=Klassennamen kopieren
tabs.close=Schließen
tabs.closeOthers=Andere schließen
tabs.closeAll=Alles schließen
tabs.closeAllRight=Schließe alles rechts
tabs.code=Code
tabs.smali=Smali

Expand Down
1 change: 1 addition & 0 deletions jadx-gui/src/main/resources/i18n/Messages_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tabs.copy_class_name=Copy Name
tabs.close=Close
tabs.closeOthers=Close Others
tabs.closeAll=Close All
tabs.closeAllRight=Close All Right
tabs.code=Code
tabs.smali=Smali

Expand Down
1 change: 1 addition & 0 deletions jadx-gui/src/main/resources/i18n/Messages_es_ES.properties
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tabs.copy_class_name=Copy Name
tabs.close=Cerrar
tabs.closeOthers=Cerrar otros
tabs.closeAll=Cerrar todo
tabs.closeAllRight=Cierra todo a la derecha
#tabs.code=
#tabs.smali=

Expand Down
1 change: 1 addition & 0 deletions jadx-gui/src/main/resources/i18n/Messages_ko_KR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tabs.copy_class_name=이름 복사
tabs.close=닫기
tabs.closeOthers=이 탭을 제외하고 닫기
tabs.closeAll=모두 닫기
tabs.closeAllRight=오른쪽의 모든 것을 닫으십시오
tabs.code=코드
tabs.smali=Smali

Expand Down
1 change: 1 addition & 0 deletions jadx-gui/src/main/resources/i18n/Messages_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tabs.copy_class_name=Copiar nome
tabs.close=Fechar
tabs.closeOthers=Fechar outros
tabs.closeAll=Fechar todos
tabs.closeAllRight=Feche tudo à direita
tabs.code=Código
tabs.smali=Smali

Expand Down
1 change: 1 addition & 0 deletions jadx-gui/src/main/resources/i18n/Messages_ru_RU.properties
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tabs.copy_class_name=Копировать имя
tabs.close=Закрыть
tabs.closeOthers=Закрыть другие
tabs.closeAll=Закрыть все
tabs.closeAllRight=Закройте все справа
tabs.code=Код
tabs.smali=Smali

Expand Down
1 change: 1 addition & 0 deletions jadx-gui/src/main/resources/i18n/Messages_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tabs.copy_class_name=复制名称
tabs.close=关闭
tabs.closeOthers=关闭其他
tabs.closeAll=关闭全部
tabs.closeAllRight=关闭右边的所有
tabs.code=代码
tabs.smali=Smali

Expand Down
1 change: 1 addition & 0 deletions jadx-gui/src/main/resources/i18n/Messages_zh_TW.properties
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tabs.copy_class_name=複製名稱
tabs.close=關閉
tabs.closeOthers=關閉其他
tabs.closeAll=關閉全部
tabs.closeAllRight=關閉右邊的所有
tabs.code=程式碼
tabs.smali=Smali

Expand Down

0 comments on commit 219f9eb

Please sign in to comment.