private void btnReplaceItemActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnReplaceItemActionPerformed
    {//GEN-HEADEREND:event_btnReplaceItemActionPerformed
        if (!archive.fileExists(selectedPath))
            throw new UnsupportedOperationException("oops, bug");
        
        JFileChooser fc = new JFileChooser();
        fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fc.setDialogTitle("Choose a file to import");
        String lastfile = Preferences.userRoot().get("lastFileReplaced", null);
        if (lastfile != null) fc.setSelectedFile(new File(lastfile));
        if (fc.showOpenDialog(this) != JFileChooser.APPROVE_OPTION)
            return;
        
        String selfile = fc.getSelectedFile().getPath();
        Preferences.userRoot().put("lastFileReplaced", selfile);
        
        try
        {
            FileBase srcfile = new ExternalFile(selfile, "r");
            FileBase dstfile = archive.openFile(selectedPath);

            dstfile.setLength(srcfile.getLength());
            dstfile.setContents(srcfile.getContents());

            dstfile.save();
            trySave();
            dstfile.close();
            srcfile.close();
        }
        catch (IOException ex)
        {
            lblStatusLabel.setText("Failed to replace file: "+ex.getMessage());
        }
        
        setFileDescription(treeNodes.get(selectedPath));
    }//GEN-LAST:event_btnReplaceItemActionPerformed