ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
Properties settings = getSettings();
SimpleMoteManager moteManager = (SimpleMoteManager) getSession()
.getMoteManager();
try {
String cmd = e.getActionCommand();
if (cmd.equals("program")) {
JFileChooser fc = new JFileChooser(settings
.getProperty("flashImagePath", "/"));
fc.setFileFilter(new FlashImageFilter());
int returnVal = fc
.showOpenDialog(getRootWindow());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
FileInputStream fi = new FileInputStream(
file);
byte[] image = new byte[(int) file.length()];
fi.read(image);
moteManager.program(moteid, image);
fi.close();
settings.setProperty("flashImagePath", file
.getParent());
saveSettings();
}
} else if (cmd.equals("cancelprogram")) {
moteManager.cancelProgramming(moteid);
} else if (cmd.equals("start")) {
moteManager.start(moteid);
} else if (cmd.equals("stop")) {
moteManager.stop(moteid);
} else if (cmd.equals("reset")) {
moteManager.reset(moteid);
} else if (cmd.equals("clear")) {
console.clear();
} else if (cmd.equals("log_local")) {
JFileChooser fc = new JFileChooser(settings.getProperty("moteLogPath", "/"));
if (fc.showSaveDialog(getRootWindow()) == JFileChooser.APPROVE_OPTION) {