From 18 Jan, 2021 0:00 UTC: All services will be temporary unavailable for maintenance
  • R/O
  • SSH

JdbcAcsess2: Commit

全てを再実装したJdbcAcsessです。


Commit MetaInfo

Revision1f299e0d3d20e95ebb5f66589f03eeb466dfba9c (tree)
Time2012-02-16 23:15:34
Authorshimakazuro
Commitershimakazuro

Log Message

[SQLパネル選択中以外を全て閉じる]に、CopyOnWriteArrayListを使用する

Change Summary

Incremental Difference

diff -r 222c1d59e36e -r 1f299e0d3d20 src/jdbcacsess2/main/MainController.java
--- a/src/jdbcacsess2/main/MainController.java Thu Feb 16 21:21:12 2012 +0900
+++ b/src/jdbcacsess2/main/MainController.java Thu Feb 16 23:15:34 2012 +0900
@@ -30,6 +30,7 @@
3030 import java.sql.SQLException;
3131 import java.util.ArrayList;
3232 import java.util.List;
33+import java.util.concurrent.CopyOnWriteArrayList;
3334
3435 import javax.swing.AbstractAction;
3536 import javax.swing.Action;
@@ -585,30 +586,18 @@
585586 @Override
586587 public void actionPerformed(ActionEvent e) {
587588 JTabbedPane tab = view.getCurrentJPanelSession().getJTabbedPaneSql();
588- if (tab.getTabCount() <= 1) {
589- return;
590- }
591589
592590 int index = view.getCurrentJPanelSession().tabbedPaneMousePointer.getFocusedComponentIndex();
593591 if (index == -1) {
594592 return;
595593 }
596594
597- // Iterator操作中に削除出来無いのでコピーする
598- ArrayList<JPanelSql> list = new ArrayList<JPanelSql>();
599- for (int i = 1; i < tab.getTabCount(); i++) {
600- if (i != index) {
601- Object o = tab.getComponentAt(i);
602- if (o instanceof JPanelSql) {
603- list.add((JPanelSql) o);
604- }
595+ Component c = tab.getComponentAt(index);
596+ for (Component component : new CopyOnWriteArrayList<Component>(tab.getComponents())) {
597+ if (component instanceof JPanelSql && component != c) {
598+ tab.remove(component);
605599 }
606600 }
607-
608- for (JPanelSql component : list) {
609- tab.remove(component);
610- }
611- list.clear();
612601 }
613602 };
614603
Show on old repository browser