private void copyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyButtonActionPerformed
        TreePath path = this.studiesList.getSelectionPath();
        if(path == null || path.getLastPathComponent().equals("Root"))
            return; // No study selected.
        
        Study study = (Study)path.getLastPathComponent();
        
        // Can only copy to local connection
        Connection[] connections = new Connection[] { new LocalConnection() };
        
        // Create dialog
        CopyStudyView diag = new CopyStudyView(this, study, connections);
        diag.setVisible(true);
        
        // Update when the window closes, in case we copy to the viewed study.
        diag.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                updateStudiesUI();
            }
        });
    }//GEN-LAST:event_copyButtonActionPerformed