Skip to content

Commit 5f59e72

Browse files
committed
CsvTableModelSwing: add docstring for getColumnName and add back in original comments
1 parent 36ba098 commit 5f59e72

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableModelSwing.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
public 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

Comments
 (0)