package com.link_intersystems.swing;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;

public class SelectAllAction extends AbstractAction {

	private static final long serialVersionUID = -3842791426045430962L;
	private ListSelectionModel listSelectionModel;
	private ListModel listModel;

	public SelectAllAction(ListSelectionModel listSelectionModel,
			ListModel listModel) {
		this.listSelectionModel = listSelectionModel;
		this.listModel = listModel;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		int size = listModel.getSize();
		listSelectionModel.setValueIsAdjusting(true);
		listSelectionModel.clearSelection();
		listSelectionModel.addSelectionInterval(0, size);
		listSelectionModel.setValueIsAdjusting(false);
	}
}

@@ -720,24 +720,43 @@
 election();%0A
+%09%09if (size %3E 0) %7B%0A%09
 %09%09listSelect
@@ -792,18 +792,26 @@
 (0, size
-);
+ - 1);%0A%09%09%7D
 %0A%09%09listS

Fix #3