@Override
public boolean execute(IActionHandler actionHandler,
Map<String, Object> context) {
JFileChooser currentFileChooser = createFileChooser(context);
int returnVal = currentFileChooser.showOpenDialog(SwingUtil
.getVisibleWindow(getSourceComponent(context)));
IFileOpenCallback openCallback = getFileOpenCallback(context);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = currentFileChooser.getSelectedFile();
if (file != null) {
try {
openCallback.fileChosen(file.getName(),
new FileInputStream(file), actionHandler, context);
} catch (FileNotFoundException ex) {
openCallback.cancel(actionHandler, context);
}
} else {
openCallback.cancel(actionHandler, context);
}
} else {
openCallback.cancel(actionHandler, context);
}
return super.execute(actionHandler, context);
}