[Jiemamy-notify:1814] commit [2987] table.setSelected() してもselectionListenerに通知が来ない件。UIからの行選択操作とプログラムからの行選択操作が同じ処理を行うよう、選択行変更時のメソッドをひとつにまとめた。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 3月 24日 (火) 14:01:21 JST


Revision: 2987
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2987
Author:   shin1
Date:     2009-03-24 14:01:21 +0900 (Tue, 24 Mar 2009)

Log Message:
-----------
table.setSelected()してもselectionListenerに通知が来ない件。UIからの行選択操作とプログラムからの行選択操作が同じ処理を行うよう、選択行変更時のメソッドをひとつにまとめた。

Modified Paths:
--------------
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java


-------------- next part --------------
Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java	2009-03-23 23:11:12 UTC (rev 2986)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java	2009-03-24 05:01:21 UTC (rev 2987)
@@ -599,12 +599,7 @@
 				
 				@Override
 				public void widgetSelected(SelectionEvent e) {
-					int index = table.getSelectionIndex();
-					if (index >= 0) {
-						indexColumnsTableEditor.updateInput();
-					} else {
-						indexColumnsTableEditor.disableEditControls();
-					}
+					onTableRowSelected(table.getSelectionIndex());
 				}
 			});
 		}
@@ -692,9 +687,8 @@
 			jiemamyFacade.addIndex(tableModel, indexModel);
 			
 			int addedIndex = tableModel.getIndexes().indexOf(indexModel);
-			table.select(addedIndex);
 			table.setSelection(addedIndex);
-			indexColumnsTableEditor.updateInput();
+			onTableRowSelected(addedIndex);
 			enableEditControls(addedIndex);
 			txtIndexName.setFocus();
 			
@@ -720,7 +714,7 @@
 			
 			int addedIndex = tableModel.getIndexes().indexOf(indexModel);
 			table.setSelection(addedIndex);
-			indexColumnsTableEditor.updateInput();
+			onTableRowSelected(addedIndex);
 			enableEditControls(addedIndex);
 			txtIndexName.setFocus();
 			
@@ -771,16 +765,24 @@
 			int nextSelection = table.getItemCount() > index ? index : index - 1;
 			if (nextSelection >= 0) {
 				table.setSelection(nextSelection);
+				onTableRowSelected(nextSelection);
 				enableEditorControls(nextSelection);
 			} else {
 				disableEditorControls();
 			}
 			table.setFocus();
-			indexColumnsTableEditor.updateInput();
 			
 			return indexModel;
 		}
 		
+		private void onTableRowSelected(int index) {
+			if (index >= 0) {
+				indexColumnsTableEditor.updateInput();
+			} else {
+				indexColumnsTableEditor.disableEditControls();
+			}
+		}
+		
 		private void updateModel() {
 			Table table = getTableViewer().getTable();
 			int index = table.getSelectionIndex();



Jiemamy-notify メーリングリストの案内
Back to archive index