private void onViewFile() {
int selectedIndex = taskFiles.getSelectedRow();
if (selectedIndex < 0) {
return;
}
BOFile taskFile = (BOFile) taskFiles.getValueAt(selectedIndex, -1);
JFileChooser fileChooser = new JFileChooser() {
@Override
public void cancelSelection() {
Map<Thread, StackTraceElement[]> stackTrace = Thread.getAllStackTraces();
if (stackTrace.get(Thread.currentThread())[4].getFileName().contains("AbstractButton")) {
super.cancelSelection();
}
}
};
File f = null;
if (ApplicationContext.getUserPreferences().getUserSelectedDir() != null) {
f = new File(ApplicationContext.getUserPreferences().getUserSelectedDir() + File.separator + taskFile.getRealFilename());
} else {
f = new File(System.getProperty("java.io.tmpdir") + taskFile.getRealFilename());
}
fileChooser.setSelectedFile(f);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setMultiSelectionEnabled(false);