Browse Source

Added option to close all other tabs in ClosableTabbedPane.

pull/188/head
weisj 5 years ago
parent
commit
b50ca187b4
  1. 22
      core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java
  2. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions.properties
  3. 8
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_ar.properties
  4. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_da.properties
  5. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_de.properties
  6. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_en.properties
  7. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_es.properties
  8. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_fr.properties
  9. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_it.properties
  10. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_ja.properties
  11. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_nl.properties
  12. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_no.properties
  13. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_pl.properties
  14. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_ru.properties
  15. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_sv.properties
  16. 7
      core/src/main/resources/com/github/weisj/darklaf/bundles/actions_zh.properties

22
core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java

@ -32,6 +32,7 @@ import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import com.github.weisj.darklaf.ui.tabbedpane.DarkTabbedPaneUI;
import com.github.weisj.darklaf.util.ResourceUtil;
/**
* @author Jannis Weis
@ -161,13 +162,28 @@ public class ClosableTabComponent extends JPanel {
}
};
addMouseListener(mouseListener);
setToolTipText(ResourceUtil.getResourceBundle("actions", tabComponent.pane)
.getString("Actions.closableTabbedPane.close"));
}
@Override
public void actionPerformed(final ActionEvent e) {
int i = tabComponent.pane.indexOfTabComponent(tabComponent);
if (i != -1) {
tabComponent.pane.remove(i);
if ((e.getModifiers() & ActionEvent.ALT_MASK) != 0) {
// Close all other tabs.
int tabCount = tabComponent.pane.getTabCount();
for (int i = tabCount - 1; i >= 0; i--) {
Component tabComp = tabComponent.pane.getTabComponentAt(i);
if (tabComp == tabComponent) continue;
if (tabComp instanceof ClosableTabComponent
&& ((ClosableTabComponent) tabComp).isClosable()) {
tabComponent.pane.removeTabAt(i);
}
}
} else {
int i = tabComponent.pane.indexOfTabComponent(tabComponent);
if (i != -1) {
tabComponent.pane.remove(i);
}
}
}
}

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Cut
Actions.copy = Copy
Actions.paste = Paste
Actions.cut = Cut
Actions.copy = Copy
Actions.paste = Paste
Actions.closableTabbedPane.close = Close. Alt-Click to close others

8
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_ar.properties

@ -24,6 +24,8 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = يقطع
Actions.copy = نسخ
Actions.paste = لصق
Actions.cut = يقطع
Actions.copy = نسخ
Actions.paste = لصق
Actions.closableTabbedPane.close = قريب. Alt انقر لإغلاق الآخرين

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_da.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Skære
Actions.copy = Kopi
Actions.paste = Sæt ind
Actions.cut = Skære
Actions.copy = Kopi
Actions.paste = Sæt ind
Actions.closableTabbedPane.close = Tæt. Alt-Klik for at lukke andre

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_de.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Ausschneiden
Actions.copy = Kopieren
Actions.paste = Einfügen
Actions.cut = Ausschneiden
Actions.copy = Kopieren
Actions.paste = Einfügen
Actions.closableTabbedPane.close = Schließen. Alt-Klicken, um andere zu schließen

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_en.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Cut
Actions.copy = Copy
Actions.paste = Paste
Actions.cut = Cut
Actions.copy = Copy
Actions.paste = Paste
Actions.closableTabbedPane.close = Close. Alt-Click to close others

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_es.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Cortar
Actions.copy = Copiar
Actions.paste = Pegar
Actions.cut = Cortar
Actions.copy = Copiar
Actions.paste = Pegar
Actions.closableTabbedPane.close = Cerca. Alt-Click para cerrar otros

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_fr.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Couper
Actions.copy = Copie
Actions.paste = Pâte
Actions.cut = Couper
Actions.copy = Copie
Actions.paste = Pâte
Actions.closableTabbedPane.close = Proche. Alt-Cliquez pour fermer les autres

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_it.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Taglio
Actions.copy = Copia
Actions.paste = Incolla
Actions.cut = Taglio
Actions.copy = Copia
Actions.paste = Incolla
Actions.closableTabbedPane.close = Vicino. Alt-clic per chiudere gli altri

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_ja.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = 切る
Actions.copy = 写し
Actions.paste = 貼付
Actions.cut = 切る
Actions.copy = 写し
Actions.paste = 貼付
Actions.closableTabbedPane.close = 閉じる。 Alt-クリックして他を閉じる

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_nl.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Knippen
Actions.copy = Kopiëren
Actions.paste = Plakken
Actions.cut = Knippen
Actions.copy = Kopiëren
Actions.paste = Plakken
Actions.closableTabbedPane.close = Dichtbij. Alt-klik om anderen te sluiten

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_no.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Klipp
Actions.copy = Kopi
Actions.paste = Pasta
Actions.cut = Klipp
Actions.copy = Kopi
Actions.paste = Pasta
Actions.closableTabbedPane.close = Lukk. Alt-klikk for å lukke andre

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_pl.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Wytnij
Actions.copy = Kopię
Actions.paste = Wklej
Actions.cut = Wytnij
Actions.copy = Kopię
Actions.paste = Wklej
Actions.closableTabbedPane.close = Blisko. Alt-Kliknij, aby zamknąć inne

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_ru.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Резать
Actions.copy = Копия
Actions.paste = Вставить
Actions.cut = Резать
Actions.copy = Копия
Actions.paste = Вставить
Actions.closableTabbedPane.close = Близко. Alt-Click, чтобы закрыть другие

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_sv.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = Skära
Actions.copy = Kopia
Actions.paste = Klistra
Actions.cut = Skära
Actions.copy = Kopia
Actions.paste = Klistra
Actions.closableTabbedPane.close = Stänga. Alt-Klicka för att stänga andra

7
core/src/main/resources/com/github/weisj/darklaf/bundles/actions_zh.properties

@ -24,6 +24,7 @@
#
# suppress inspection "UnusedProperty" for whole file
#
Actions.cut = 切
Actions.copy = 复制
Actions.paste = 糊
Actions.cut = 切
Actions.copy = 复制
Actions.paste = 糊
Actions.closableTabbedPane.close = 关。 Alt单击以关闭其他人

Loading…
Cancel
Save