This repository was archived by the owner on Apr 10, 2024. It is now read-only.
File tree 1 file changed +14
-12
lines changed
Plugin/src/com/ciy/plugin/ui
1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -231,20 +231,22 @@ private void refreshListData() {
231
231
});
232
232
lsApiList .setListData (listData .toArray ());
233
233
lsApiList .setCellRenderer (new SelectApiCellRenderer ());
234
- lsApiList .addListSelectionListener (new ListSelectionListener () {
235
- @ Override
236
- public void valueChanged (ListSelectionEvent e ) {
237
- // 每选择一次,就会触发2次这个回调,这个getValueIsAdjusting能控制只触发后一次
238
- if (e .getValueIsAdjusting ()) {
239
- // 选择位置
240
- int selectIndex = lsApiList .getSelectedIndex ();
241
- Object data = listData .get (selectIndex );
242
- if (data instanceof ApiBean ) {
243
- ((ApiBean ) data ).setSelect (!((ApiBean ) data ).getSelect ());
234
+ if (lsApiList .getListSelectionListeners ().length == 0 ) {
235
+ lsApiList .addListSelectionListener (new ListSelectionListener () {
236
+ @ Override
237
+ public void valueChanged (ListSelectionEvent e ) {
238
+ // 每选择一次,就会触发2次这个回调,这个getValueIsAdjusting能控制只触发后一次
239
+ if (e .getValueIsAdjusting ()) {
240
+ // 选择位置
241
+ int selectIndex = lsApiList .getSelectedIndex ();
242
+ Object data = listData .get (selectIndex );
243
+ if (data instanceof ApiBean ) {
244
+ ((ApiBean ) data ).setSelect (!((ApiBean ) data ).getSelect ());
245
+ }
244
246
}
245
247
}
246
- }
247
- });
248
+ });
249
+ }
248
250
}
249
251
250
252
/**
You can’t perform that action at this time.
0 commit comments