}
};
ActionListener removeAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Course course = getSelectedData();
if( course!=null ) {
try {
geco.stageControl().removeCourse(course);
} catch (Exception e1) {
JOptionPane.showMessageDialog(frame,
Messages.uiGet("StagePanel.CourseNoDeletionWarning") + e1.getMessage(), //$NON-NLS-1$
Messages.uiGet("StagePanel.ActionCancelledTitle"), //$NON-NLS-1$
JOptionPane.WARNING_MESSAGE);
}
}
}
};
ActionListener editAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Course course = getSelectedData();
if( course!=null ) {
new CourseControlDialog(frame, course);
}
}
};
ActionListener importAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setSelectedFile(new File(geco.getCurrentStagePath()));
chooser.setFileFilter(new FileFilter() {
@Override
public String getDescription() {
return Messages.uiGet("StagePanel.XMLFilesLabel"); //$NON-NLS-1$
}
@Override
public boolean accept(File f) {
return f.getName().endsWith(".xml"); //$NON-NLS-1$
}
});
int answer = chooser.showDialog(frame, Messages.uiGet("StagePanel.CourseImportXMLLabel")); //$NON-NLS-1$
if( answer==JFileChooser.APPROVE_OPTION ) {
String file = chooser.getSelectedFile().getAbsolutePath();
try {
Vector<Course> courses = CourseSaxImporter.importFromXml(file, geco.stageControl().factory());
for (Course course : courses) {
geco.stageControl().addCourse(course);
}
} catch (Exception e1) {
e1.printStackTrace();
JOptionPane.showMessageDialog(frame,
e1.getMessage(),
Messages.uiGet("StagePanel.XMLLoadError"), //$NON-NLS-1$
JOptionPane.ERROR_MESSAGE);
}
}
}
};
ActionListener refreshAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
Course course = getSelectedData();
if( course!=null ) {
geco.runnerControl().recheckRunnersFromCourse(course);
}
}
};