Search in sources :

Example 1 with MissingTraceFiles

use of com.att.aro.ui.view.menu.file.MissingTraceFiles in project VideoOptimzer by attdevsupport.

the class AROFileMenu method selectTraceFolder.

private File selectTraceFolder(ActionEvent aEvent, boolean isRecent) {
    File traceFolder = null;
    if (!isRecent) {
        traceFolder = chooseFileOrFolder(JFileChooser.DIRECTORIES_ONLY, ResourceBundleHelper.getMessageString(MenuItem.menu_file_open));
        if (traceFolder != null) {
            traceFolder = new File(fileManager.deAlias(traceFolder).toString());
        }
    } else {
        JMenuItem menuItem = (JMenuItem) aEvent.getSource();
        traceFolder = new File(menuItem.getToolTipText());
    }
    if (traceFolder != null && traceFolder.isDirectory()) {
        if (!isTrafficFilePresent(traceFolder)) {
            showErrorDialog(ResourceBundleHelper.getMessageString("trafficFile.notFound"));
            traceFolder = null;
        } else if (isTraceFolderEmpty(traceFolder)) {
            // has a traffic file, but no other trace files, so not a trace folder, should
            // be opened as a pcap file directly
            showErrorDialog(ResourceBundleHelper.getMessageString("invalid.traceFolder"));
            traceFolder = null;
        } else {
            MissingTraceFiles missingTraceFiles = new MissingTraceFiles(traceFolder);
            Set<File> missingFiles = missingTraceFiles.retrieveMissingFiles();
            if (missingFiles.size() > 0) {
                LOG.trace(MessageFormat.format(ResourceBundleHelper.getMessageString(MenuItem.file_missingAlert), missingTraceFiles.formatMissingFiles(missingFiles)));
            }
        }
    }
    return traceFolder;
}
Also used : Set(java.util.Set) JMenuItem(javax.swing.JMenuItem) File(java.io.File) MissingTraceFiles(com.att.aro.ui.view.menu.file.MissingTraceFiles)

Aggregations

MissingTraceFiles (com.att.aro.ui.view.menu.file.MissingTraceFiles)1 File (java.io.File)1 Set (java.util.Set)1 JMenuItem (javax.swing.JMenuItem)1