public void openFile() {
        // Create and display a file open dialog
        final JFileChooser fileChooser = new JFileChooser();
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.addChoosableFileFilter(FileExtensionUtils.getPDFFileFilter());
        if (ViewModel.getDefaultFile() != null) {
            fileChooser.setCurrentDirectory(ViewModel.getDefaultFile());
            fileChooser.setSelectedFile(ViewModel.getDefaultFile());
            fileChooser.ensureFileIsVisible(ViewModel.getDefaultFile());
        }
        // show the dialog
        fileChooser.setDialogTitle(messageBundle.getString("viewer.dialog.openFile.title"));
        int returnVal = fileChooser.showOpenDialog(viewer);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            final File file = fileChooser.getSelectedFile();
            // trying to get rid of shadow left by file chooser
            fileChooser.setVisible(false);
            // make sure file being opened is valid
            String extension = FileExtensionUtils.getExtension(file);
            if (extension != null) {
                if (extension.equals(FileExtensionUtils.pdf)) {
                    if (viewer != null) {
                        viewer.toFront();
                        viewer.requestFocus();
                        Graphics g = viewer.getGraphics();
                        if (g != null)
                            viewer.paint(g);
                    }
                    openFileInSomeViewer(file);
                } else {
                    org.icepdf.ri.util.Resources.showMessageDialog(viewer,
                            JOptionPane.INFORMATION_MESSAGE,
                            messageBundle,
                            "viewer.dialog.openFile.error.title",
                            "viewer.dialog.openFile.error.msg",
                            file.getPath());
                }

                // save the default directory
                ViewModel.setDefaultFile(file);
            }
        }
        fileChooser.setVisible(false);
    }