2626
2727public class CsvTableModelSwing extends CsvTableModelBase <CsvTableEditor > implements TableModel {
2828
29+ /**
30+ * List of listeners
31+ */
2932 protected EventListenerList listenerList = new EventListenerList ();
3033
3134 protected ScheduledFuture <?> delayedUpdate ;
@@ -62,7 +65,10 @@ private void doNotifyUpdate() {
6265 }
6366
6467 protected void fireTableChanged (TableModelEvent e ) {
68+ // Guaranteed to return a non-null array
6569 Object [] listeners = listenerList .getListenerList ();
70+ // Process the listeners last to first, notifying
71+ // those that are interested in this event
6672 for (int i = listeners .length - 2 ; i >= 0 ; i -= 2 ) {
6773 if (listeners [i ] == TableModelListener .class ) {
6874 ((TableModelListener ) listeners [i + 1 ]).tableChanged (e );
@@ -90,6 +96,10 @@ public void removeTableModelListener(TableModelListener l) {
9096 listenerList .remove (TableModelListener .class , l );
9197 }
9298
99+ /**
100+ * Gets header name for a given column, with index formatting.
101+ * PSI access is wrapped in a read action for thread safety.
102+ */
93103 @ Override
94104 public String getColumnName (int column ) {
95105 return ApplicationManager .getApplication ().runReadAction ((Computable <String >) () -> {
@@ -114,4 +124,4 @@ public Class<?> getColumnClass(int columnIndex) {
114124 public boolean isCellEditable (int rowIndex , int columnIndex ) {
115125 return getPsiFileHolder ().isEditable ();
116126 }
117- }
127+ }
0 commit comments