private boolean isSupportedFormat(final URL sourceURL) { final String file = sourceURL.getFile(); if (StringUtils.endsWithIgnoreCase(file, ".png")) { return true; } if (StringUtils.endsWithIgnoreCase(file, ".jpg") || StringUtils.endsWithIgnoreCase(file, ".jpeg")) { return true; } if (StringUtils.endsWithIgnoreCase(file, ".bmp") || StringUtils.endsWithIgnoreCase(file, ".ico")) { return true; } return false; }
/** Selects a file to use as target for the report processing. */ protected void performSelectFile() { if (fileChooser == null) { fileChooser = new JFileChooser(); final FilesystemFilter filter = new FilesystemFilter( CSVDataExportDialog.CSV_FILE_EXTENSION, getResources().getString("csvexportdialog.csv-file-description")); // $NON-NLS-1$ fileChooser.addChoosableFileFilter(filter); fileChooser.setMultiSelectionEnabled(false); } fileChooser.setSelectedFile(new File(getFilename())); final int option = fileChooser.showSaveDialog(this); if (option == JFileChooser.APPROVE_OPTION) { final File selFile = fileChooser.getSelectedFile(); String selFileName = selFile.getAbsolutePath(); // Test if ends on csv if (StringUtils.endsWithIgnoreCase(selFileName, CSVDataExportDialog.CSV_FILE_EXTENSION) == false) { selFileName = selFileName + CSVDataExportDialog.CSV_FILE_EXTENSION; } setFilename(selFileName); } }