Example usage for javax.swing JFileChooser setAcceptAllFileFilterUsed

List of usage examples for javax.swing JFileChooser setAcceptAllFileFilterUsed

Introduction

In this page you can find the example usage for javax.swing JFileChooser setAcceptAllFileFilterUsed.

Prototype

@BeanProperty(preferred = true, description = "Sets whether the AcceptAll FileFilter is used as an available choice in the choosable filter list.")
public void setAcceptAllFileFilterUsed(boolean b) 

Source Link

Document

Determines whether the AcceptAll FileFilter is used as an available choice in the choosable filter list.

Usage

From source file:com.xyphos.vmtgen.GUI.java

private String selectVTF() {
    JFileChooser fc = new JFileChooser(txtWorkFolder.getText());
    fc.setAcceptAllFileFilterUsed(false);
    fc.setFileFilter(new FileFilterVTF());
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);

    int result = fc.showOpenDialog(this);
    if (JFileChooser.APPROVE_OPTION == result) {
        String file = fc.getSelectedFile().getName();
        return FilenameUtils.separatorsToUnix(FilenameUtils.concat(basePath, FilenameUtils.getBaseName(file)))
                .replaceFirst("/", "");
    }/*from   ww  w .j a  v  a2 s .com*/

    return null;
}

From source file:base.BasePlayer.AddGenome.java

@Override
public void mousePressed(MouseEvent e) {

    if (e.getSource() == tree) {

        if (selectedNode != null && selectedNode.toString().contains("Add new refe")) {
            try {
                FileDialog fs = new FileDialog(frame, "Select reference fasta-file", FileDialog.LOAD);
                fs.setDirectory(Main.downloadDir);
                fs.setVisible(true);//from   ww  w. j a  va 2  s  . c om
                String filename = fs.getFile();
                fs.setFile("*.fasta;*.fa");
                fs.setFilenameFilter(new FilenameFilter() {
                    public boolean accept(File dir, String name) {
                        return name.toLowerCase().contains(".fasta") || name.toLowerCase().contains(".fa");
                    }
                });
                if (filename != null) {
                    File addfile = new File(fs.getDirectory() + "/" + filename);

                    if (addfile.exists()) {

                        genomeFile = addfile;
                        Main.downloadDir = genomeFile.getParent();
                        Main.writeToConfig("DownloadDir=" + genomeFile.getParent());
                        OutputRunner runner = new OutputRunner(genomeFile.getName().replace(".fasta", "")
                                .replace(".fa", "").replace(".gz", ""), genomeFile, null);
                        runner.createGenome = true;
                        runner.execute();
                    } else {
                        Main.showError("File does not exists.", "Error", frame);
                    }

                }
                if (1 == 1) {
                    return;
                }
                JFileChooser chooser = new JFileChooser(Main.downloadDir);
                chooser.setMultiSelectionEnabled(false);
                chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
                chooser.setAcceptAllFileFilterUsed(false);
                MyFilterFasta fastaFilter = new MyFilterFasta();

                chooser.addChoosableFileFilter(fastaFilter);
                chooser.setDialogTitle("Select reference fasta-file");
                if (Main.screenSize != null) {
                    chooser.setPreferredSize(new Dimension((int) Main.screenSize.getWidth() / 3,
                            (int) Main.screenSize.getHeight() / 3));
                }

                int returnVal = chooser.showOpenDialog((Component) this.getParent());

                if (returnVal == JFileChooser.APPROVE_OPTION) {

                    genomeFile = chooser.getSelectedFile();
                    Main.downloadDir = genomeFile.getParent();
                    Main.writeToConfig("DownloadDir=" + genomeFile.getParent());
                    OutputRunner runner = new OutputRunner(
                            genomeFile.getName().replace(".fasta", "").replace(".gz", ""), genomeFile, null);
                    runner.createGenome = true;
                    runner.execute();

                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        } else if (selectedNode != null && selectedNode.isLeaf()
                && selectedNode.toString().contains("Add new anno")) {
            try {
                FileDialog fs = new FileDialog(frame, "Select annotation gff3/gtf-file", FileDialog.LOAD);
                fs.setDirectory(Main.downloadDir);
                fs.setVisible(true);
                String filename = fs.getFile();
                fs.setFile("*.gff3;*.gtf");
                fs.setFilenameFilter(new FilenameFilter() {
                    public boolean accept(File dir, String name) {
                        return name.toLowerCase().contains(".gff3") || name.toLowerCase().contains(".gtf");
                    }
                });

                if (filename != null) {
                    File addfile = new File(fs.getDirectory() + "/" + filename);

                    if (addfile.exists()) {
                        annotationFile = addfile;
                        Main.downloadDir = annotationFile.getParent();
                        Main.writeToConfig("DownloadDir=" + annotationFile.getParent());
                        OutputRunner runner = new OutputRunner(selectedNode.getParent().toString(), null,
                                annotationFile);
                        runner.createGenome = true;
                        runner.execute();
                    } else {
                        Main.showError("File does not exists.", "Error", frame);
                    }

                }
                if (1 == 1) {
                    return;
                }
                JFileChooser chooser = new JFileChooser(Main.downloadDir);
                chooser.setMultiSelectionEnabled(false);
                chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
                chooser.setAcceptAllFileFilterUsed(false);
                MyFilterGFF gffFilter = new MyFilterGFF();

                chooser.addChoosableFileFilter(gffFilter);
                chooser.setDialogTitle("Select annotation gff3-file");
                if (Main.screenSize != null) {
                    chooser.setPreferredSize(new Dimension((int) Main.screenSize.getWidth() / 3,
                            (int) Main.screenSize.getHeight() / 3));
                }
                int returnVal = chooser.showOpenDialog((Component) this.getParent());

                if (returnVal == JFileChooser.APPROVE_OPTION) {

                    annotationFile = chooser.getSelectedFile();
                    Main.downloadDir = annotationFile.getParent();

                    Main.writeToConfig("DownloadDir=" + annotationFile.getParent());
                    OutputRunner runner = new OutputRunner(selectedNode.getParent().toString(), null,
                            annotationFile);
                    runner.createGenome = true;
                    runner.execute();
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
    if (e.getSource() == genometable) {

        if (new File(".").getFreeSpace()
                / 1048576 < sizeHash.get(genometable.getValueAt(genometable.getSelectedRow(), 0))[0]
                        / 1048576) {
            sizeError.setVisible(true);
            download.setEnabled(false);
            AddGenome.getLinks.setEnabled(false);
        } else {
            sizeError.setVisible(false);
            download.setEnabled(true);
            AddGenome.getLinks.setEnabled(true);
        }
        tree.clearSelection();
        remove.setEnabled(false);
        checkUpdates.setEnabled(false);
    }

}

From source file:base.BasePlayer.AddGenome.java

public void actionPerformed(ActionEvent event) {
    if (event.getSource() == download) {
        if (!downloading) {
            downloading = true;/*from w  w w  . j ava 2 s  . c o  m*/
            downloadGenome(genometable.getValueAt(genometable.getSelectedRow(), 0).toString());
            downloading = false;
        }
    } else if (event.getSource() == getLinks) {
        URL[] urls = AddGenome.genomeHash
                .get(genometable.getValueAt(genometable.getSelectedRow(), 0).toString());
        JPopupMenu menu = new JPopupMenu();
        JTextArea area = new JTextArea();
        JScrollPane menuscroll = new JScrollPane();
        area.setFont(Main.menuFont);
        menu.add(menuscroll);
        menu.setPreferredSize(new Dimension(
                menu.getFontMetrics(Main.menuFont).stringWidth(urls[0].toString()) + Main.defaultFontSize * 10,
                (int) menu.getFontMetrics(Main.menuFont).getHeight() * 4));
        //area.setMaximumSize(new Dimension(300, 600));
        area.setLineWrap(true);
        area.setWrapStyleWord(true);
        for (int i = 0; i < urls.length; i++) {
            area.append(urls[i].toString() + "\n");
        }

        area.setCaretPosition(0);
        area.revalidate();
        menuscroll.getViewport().add(area);
        menu.pack();
        menu.show(this, 0, 0);

    } else if (event.getSource() == checkEnsembl) {
        if (ensemblfetch) {
            menu.show(AddGenome.treescroll, 0, 0);
        } else {
            EnsemblFetch fetcher = new EnsemblFetch();
            fetcher.execute();
        }
    } else if (event.getSource() == checkUpdates) {
        URL testfile = null;
        try {
            // kattoo onko paivityksia annotaatioon
            String ref = selectedNode.toString();
            if (AddGenome.genomeHash.get(ref) != null) {
                ArrayList<String> testfiles = new ArrayList<String>();
                if (Main.drawCanvas != null) {
                    for (int i = 0; i < Main.genomehash.get(ref).size(); i++) {
                        testfiles.add(Main.genomehash.get(ref).get(i).getName().replace(".bed.gz", ""));
                    }
                }
                testfile = AddGenome.genomeHash.get(ref)[1];
                String result = Main.checkFile(testfile, testfiles);

                if (result.length() == 0) {
                    Main.showError("You have newest annotation file.", "Note");
                } else {
                    int n = JOptionPane.showConfirmDialog(Main.drawCanvas,
                            "New annotation file found: " + result + "\nDownload it now?", "Note",
                            JOptionPane.YES_NO_OPTION);
                    if (n == JOptionPane.YES_OPTION) {
                        URL fileurl = new URL(testfile.getProtocol() + "://" + testfile.getHost()
                                + testfile.getPath().substring(0, testfile.getPath().lastIndexOf("/") + 1)
                                + result);
                        OutputRunner runner = new OutputRunner(fileurl, ref);
                        runner.downloadAnnotation = true;
                        runner.execute();
                    }
                }
            } else {
                Main.showError("This genome is not from Ensembl list, could not check for updates.", "Note",
                        AddGenome.genometable);
            }
        } catch (Exception e) {
            Main.showError("Cannot connect to " + testfile.getHost() + ".\nTry again later.", "Error");
            e.printStackTrace();
        }
    } else if (event.getSource() == remove) {
        if (!selectedNode.isLeaf()) {
            String removeref = selectedNode.toString();
            //   Boolean same = false;
            try {
                if (Main.drawCanvas != null) {
                    if (removeref.equals(Main.refDropdown.getSelectedItem().toString())) {
                        Main.referenceFile.close();
                        //      same = true;
                        if (ChromDraw.exonReader != null) {
                            ChromDraw.exonReader.close();
                        }
                    }
                }
                if (Main.genomehash.containsKey(removeref)) {
                    for (int i = Main.genomehash.get(removeref).size() - 1; i >= 0; i--) {
                        Main.genomehash.get(removeref).remove(i);
                    }
                    Main.genomehash.remove(removeref);

                }
                if (Main.drawCanvas != null) {
                    Main.refModel.removeElement(removeref);
                    Main.refDropdown.removeItem(removeref);
                    Main.refDropdown.revalidate();
                }

                for (int i = 0; i < Main.genome.getItemCount(); i++) {
                    if (Main.genome.getItem(i).getName() != null) {

                        if (Main.genome.getItem(i).getName().equals(removeref)) {
                            Main.genome.remove(Main.genome.getItem(i));
                            break;
                        }
                    }
                }

                FileUtils.deleteDirectory(new File(Main.genomeDir.getCanonicalPath() + "/" + removeref));
                checkGenomes();
                Main.setAnnotationDrop("");

                if (Main.genomehash.size() == 0) {
                    Main.refDropdown.setSelectedIndex(0);
                    Main.setChromDrop("-1");
                }
            } catch (Exception e) {
                e.printStackTrace();
                try {
                    Main.showError("Could not delete genome folder.\nYou can do it manually by deleting folder "
                            + Main.genomeDir.getCanonicalPath() + "/" + removeref, "Note");
                } catch (IOException e1) {

                    e1.printStackTrace();
                }
            }
        } else {
            try {
                if (Main.drawCanvas != null) {
                    if (ChromDraw.exonReader != null) {
                        ChromDraw.exonReader.close();
                    }
                }

                Main.removeAnnotationFile(selectedNode.getParent().toString(), selectedNode.toString());

                FileUtils.deleteDirectory(new File(Main.genomeDir.getCanonicalPath() + "/"
                        + selectedNode.getParent().toString() + "/annotation/" + selectedNode.toString()));

                //   root.remove(selectedNode.getParent().getIndex(selectedNode));
                //   root.remove
                //   checkGenomes();

            } catch (Exception e) {
                e.printStackTrace();
                try {
                    Main.showError("Could not delete genome folder.\nYou can do it manually by deleting folder "
                            + Main.genomeDir.getCanonicalPath() + "/" + selectedNode.getParent().toString()
                            + "/annotation/" + selectedNode.toString(), "Note");
                } catch (IOException e1) {

                    e1.printStackTrace();
                }
            }
            treemodel.removeNodeFromParent(selectedNode);
        }

    } else if (event.getSource() == add) {

        if (genomeFile == null) {
            if (new File(genomeFileText.getText()).exists()) {
                genomeFile = new File(genomeFileText.getText());

            } else {
                genomeFileText.setText("Select reference genome fasta-file.");
                genomeFileText.setForeground(Color.red);
                return;
            }
        }

        /*if(genomeName.getText().contains("Give name") || genomeName.getText().length() == 0) {
           genomeName.setText("Give name of the genome");
           genomeName.setForeground(Color.red);
           genomeName.revalidate();
                   
        }
        else if(!annotation && new File(Main.userDir +"/genomes/"+genomeName.getText().trim().replace("\\s+", "_")).exists()) {
           genomeName.setText("This genome exists already.");
           genomeName.setForeground(Color.red);
           genomeName.revalidate();
        }
        else */

        if ((genomeFileText.getText().length() == 0
                || genomeFileText.getText().startsWith("Select reference"))) {
            genomeFileText.setText("Select reference genome fasta-file.");
            genomeFileText.setForeground(Color.red);
            genomeFileText.revalidate();
        }

        else {

            OutputRunner runner = new OutputRunner(
                    genomeFile.getName().replace(".fasta", "").replace(".gz", ""), genomeFile, annotationFile);
            runner.execute();
        }

    } else if (event.getSource() == openRef) {
        try {

            JFileChooser chooser = new JFileChooser(Main.downloadDir);
            chooser.setMultiSelectionEnabled(false);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            MyFilterFasta fastaFilter = new MyFilterFasta();

            chooser.addChoosableFileFilter(fastaFilter);
            chooser.setDialogTitle("Select reference fasta-file");
            if (Main.screenSize != null) {
                chooser.setPreferredSize(new Dimension((int) Main.screenSize.getWidth() / 3,
                        (int) Main.screenSize.getHeight() / 3));
            }

            int returnVal = chooser.showOpenDialog((Component) this.getParent());

            if (returnVal == JFileChooser.APPROVE_OPTION) {
                genomeFile = chooser.getSelectedFile();
                Main.downloadDir = genomeFile.getParent();
                Main.writeToConfig("DownloadDir=" + genomeFile.getParent());
                genomeFileText.setText(genomeFile.getName());
                genomeFileText.revalidate();
                frame.pack();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    } else if (event.getSource() == openAnno) {
        try {

            JFileChooser chooser = new JFileChooser(Main.downloadDir);
            chooser.setMultiSelectionEnabled(false);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            MyFilterGFF gffFilter = new MyFilterGFF();

            chooser.addChoosableFileFilter(gffFilter);
            chooser.setDialogTitle("Select annotation gff3-file");
            if (Main.screenSize != null) {
                chooser.setPreferredSize(new Dimension((int) Main.screenSize.getWidth() / 3,
                        (int) Main.screenSize.getHeight() / 3));
            }
            int returnVal = chooser.showOpenDialog((Component) this.getParent());

            if (returnVal == JFileChooser.APPROVE_OPTION) {
                if (genomeFile == null) {
                    genomeFile = Main.fastahash.get(Main.hoverGenome);
                }
                annotationFile = chooser.getSelectedFile();
                Main.downloadDir = annotationFile.getParent();
                Main.writeToConfig("DownloadDir=" + annotationFile.getParent());

                OutputRunner runner = new OutputRunner(
                        genomeFile.getName().replace(".fasta", "").replace(".gz", ""), genomeFile,
                        annotationFile);
                runner.execute();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

From source file:com.jug.MoMA.java

/**
 * Shows a JFileChooser set up to accept the selection of folders. If
 * 'cancel' is pressed this method terminates the MotherMachine app.
 *
 * @param guiFrame//from  w ww .  j av  a2  s  .c om
 *            parent frame
 * @param path
 *            path to the folder to open initially
 * @return an instance of {@link File} pointing at the selected folder.
 */
private File showFolderChooser(final JFrame guiFrame, final String path) {
    File selectedFile = null;

    if (SystemUtils.IS_OS_MAC) {
        // --- ON MAC SYSTEMS --- ON MAC SYSTEMS --- ON MAC SYSTEMS --- ON MAC SYSTEMS --- ON MAC SYSTEMS ---
        System.setProperty("apple.awt.fileDialogForDirectories", "true");
        final FileDialog fd = new FileDialog(guiFrame, "Select folder containing image sequence...",
                FileDialog.LOAD);
        fd.setDirectory(path);
        //         fd.setLocation(50,50);
        fd.setVisible(true);
        selectedFile = new File(fd.getDirectory() + "/" + fd.getFile());
        if (fd.getFile() == null) {
            System.exit(0);
            return null;
        }
        System.setProperty("apple.awt.fileDialogForDirectories", "false");
    } else {
        // --- NOT ON A MAC --- NOT ON A MAC --- NOT ON A MAC --- NOT ON A MAC --- NOT ON A MAC --- NOT ON A MAC ---
        final JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(new java.io.File(path));
        chooser.setDialogTitle("Select folder containing image sequence...");
        chooser.setFileFilter(new FileFilter() {

            @Override
            public final boolean accept(final File file) {
                return file.isDirectory();
            }

            @Override
            public String getDescription() {
                return "We only take directories";
            }
        });
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        chooser.setAcceptAllFileFilterUsed(false);

        if (chooser.showOpenDialog(guiFrame) == JFileChooser.APPROVE_OPTION) {
            selectedFile = chooser.getSelectedFile();
        } else {
            System.exit(0);
            return null;
        }
    }

    return selectedFile;
}

From source file:ffx.ui.MainPanel.java

/**
 * Prompt the user to select an alternate key file.
 *//*from ww  w .jav a 2 s. c  om*/
private void chooseKey() {
    JFileChooser d = MainPanel.resetFileChooser();
    d.setFileFilter(new KeyFileFilter());
    d.setAcceptAllFileFilterUsed(false);
    FFXSystem sys = getHierarchy().getActive();
    if (sys != null) {
        File newCWD = sys.getFile();
        if (newCWD != null && newCWD.getParentFile() != null) {
            d.setCurrentDirectory(newCWD.getParentFile());
        }
    } else {
        return;
    }
    int result = d.showOpenDialog(this);
    if (result == JFileChooser.APPROVE_OPTION) {
        File f = d.getSelectedFile();
        sys.setKeyFile(f);
        sys.setKeywords(KeyFilter.open(f));
        getKeywordPanel().loadActive(sys);
    }
}

From source file:fi.hoski.remote.ui.Admin.java

private File openFile(String lastDir, String suffix, String description) {
    JFileChooser fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fc.setAcceptAllFileFilterUsed(false);
    if (suffix != null && description != null) {
        FileFilter ff = new SuffixFileFilter(suffix, description);
        fc.setFileFilter(ff);//from w w w  . java2 s  .  c o  m
    }
    File currentDirectory = LastInput.getDirectory(lastDir);
    if (currentDirectory != null) {
        fc.setCurrentDirectory(currentDirectory);
    }
    if (fc.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        LastInput.set(lastDir, file);
        return file;
    }
    return null;
}

From source file:fi.hoski.remote.ui.Admin.java

private File saveFile(String lastDir, String nameCandidate, String suffix, String description) {
    JFileChooser fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fc.setAcceptAllFileFilterUsed(false);
    FileFilter ff = new SuffixFileFilter(suffix, description);
    fc.setFileFilter(ff);/*from   ww  w  .  j av a2  s  .  c o  m*/
    fc.setSelectedFile(new File(nameCandidate));
    File currentDirectory = LastInput.getDirectory(lastDir);
    if (currentDirectory != null) {
        fc.setCurrentDirectory(currentDirectory);
    }
    if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        if (file != null) {
            if (!file.getName().endsWith(suffix)) {
                file = new File(file.getPath() + suffix);
            }
            LastInput.set(lastDir, file);
        }
        return file;
    }
    return null;
}

From source file:ca.canucksoftware.ipkpackager.IpkPackagerView.java

private File loadFileChooser(boolean dir, FileFilter filter, String text) {
    File result = null;//from   www .  j a v a  2s .c o  m
    JFileChooser fc = new JFileChooser(); //Create a file chooser
    disableNewFolderButton(fc);
    if (text != null) {
        fc.setSelectedFile(new File(text));
    }
    if (dir) {
        fc.setDialogTitle("");
        File lastDir = new File(
                Preferences.userRoot().get("lastDir", fc.getCurrentDirectory().getAbsolutePath()));
        fc.setCurrentDirectory(lastDir);
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        if (fc.showDialog(null, "Select") == JFileChooser.APPROVE_OPTION) {
            result = fc.getSelectedFile();
            jTextField1.setText(result.getAbsolutePath());
            Preferences.userRoot().put("lastDir", result.getParentFile().getAbsolutePath());
        }
    } else {
        File lastSaved = null;
        File lastSelected = null;
        if (filter != null) {
            fc.setDialogTitle("Save As...");
            lastSaved = new File(
                    Preferences.userRoot().get("lastSaved", fc.getCurrentDirectory().getAbsolutePath()));
            fc.setCurrentDirectory(lastSaved);
            fc.setFileFilter(filter);
        } else {
            fc.setDialogTitle("");
            lastSelected = new File(
                    Preferences.userRoot().get("lastSelected", fc.getCurrentDirectory().getAbsolutePath()));
            fc.setCurrentDirectory(lastSelected);
            fc.setAcceptAllFileFilterUsed(true);
        }
        if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            result = fc.getSelectedFile();
            if (lastSaved != null) {
                Preferences.userRoot().put("lastSaved", result.getParentFile().getAbsolutePath());
            }
            if (lastSelected != null) {
                Preferences.userRoot().put("lastSelected", result.getParentFile().getAbsolutePath());
            }
        }
    }
    return result;
}

From source file:ffx.ui.MainPanel.java

/**
 * Trys to convert a file picked from a JFileChooser
 *//* www .  ja v a  2s  . c om*/
private Thread open() {
    if (openThread != null && openThread.isAlive()) {
        return null;
    }
    JFileChooser fc = resetFileChooser();
    fc.setDialogTitle("Choose FFX, PDB, XYZ or ARC");
    fc.addChoosableFileFilter(xyzFileFilter);
    fc.addChoosableFileFilter(pdbFileFilter);
    fc.addChoosableFileFilter(intFileFilter);
    fc.addChoosableFileFilter(arcFileFilter);
    fc.addChoosableFileFilter(ffxFileFilter);
    fc.setAcceptAllFileFilterUsed(true);
    int result = fc.showOpenDialog(this);
    if (result == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        return open(file, null);
    }
    return null;
}

From source file:ffx.ui.MainPanel.java

/**
 * Prompt the user to select an alternate log file
 *//*from  www .  j  a  v a  2s  . c  o m*/
private void chooseLog() {
    JFileChooser d = resetFileChooser();
    FFXSystem sys = getHierarchy().getActive();
    if (sys != null) {
        File newCWD = sys.getFile();
        if (newCWD != null && newCWD.getParentFile() != null) {
            d.setCurrentDirectory(newCWD.getParentFile());
        }
    } else {
        return;
    }
    d.setDialogTitle("Select a log file");
    d.setAcceptAllFileFilterUsed(true);
    int result = d.showOpenDialog(this);
    if (result == JFileChooser.APPROVE_OPTION) {
        File f = d.getSelectedFile();
        if (f != null) {
            sys.setLogFile(f);
            setCWD(d.getCurrentDirectory());
            //getModelingPanel().selected();
        }
    }
}