JOptionPane.showMessageDialog (null, numDeleted+ " Patches were Deleted","Delete Duplicates", JOptionPane.INFORMATION_MESSAGE); ((LibraryFrame)desktop.getSelectedFrame ()).myModel.fireTableDataChanged (); ((LibraryFrame)desktop.getSelectedFrame ()).statusBar.setText (((LibraryFrame)desktop.getSelectedFrame ()).myModel.PatchList.size ()+" Patches"); } catch (Exception ex) {ErrorMsg.reportError ("Error", "Library to Delete Duplicates in must be Focused",ex);}; PatchEdit.waitDialog.hide ();
PatchEdit.waitDialog.hide();
        public void actionPerformed (ActionEvent e)        {            try            {                if (JOptionPane.showConfirmDialog (null,"This Operation will change the ordering of the Patches. Continue?","Delete Duplicate Patches",JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) return;                PatchEdit.waitDialog.show ();                Collections.sort (((LibraryFrame)desktop.getSelectedFrame ()).myModel.PatchList,new SysexSort ());                int numDeleted=0;                Patch p,q;                Iterator it= ((LibraryFrame)desktop.getSelectedFrame ()).myModel.PatchList.iterator ();                p=(Patch)it.next ();                while (it.hasNext ())                {                    q=(Patch)it.next ();                    if (Arrays.equals (p.sysex,q.sysex))                    {it.remove (); numDeleted++;} else p=q;                }                JOptionPane.showMessageDialog (null, numDeleted+ " Patches were Deleted","Delete Duplicates", JOptionPane.INFORMATION_MESSAGE);                ((LibraryFrame)desktop.getSelectedFrame ()).myModel.fireTableDataChanged ();                ((LibraryFrame)desktop.getSelectedFrame ()).statusBar.setText                (((LibraryFrame)desktop.getSelectedFrame ()).myModel.PatchList.size ()+" Patches");            } catch (Exception ex)            {ErrorMsg.reportError ("Error", "Library to Delete Duplicates in must be Focused",ex);};            PatchEdit.waitDialog.hide ();        }