Patch myPatch=((Scene)myModel.sceneList.get(table.getSelectedRow())).getPatch(); try{ myPatch.getDriver().getClass().getDeclaredMethod("editPatch", new Class[]{myPatch.getClass()}); PatchEdit.editAction.setEnabled(true); } catch(NoSuchMethodException ex) { if (myPatch.getDriver() instanceof BankDriver) PatchEdit.editAction.setEnabled(true); else PatchEdit.editAction.setEnabled(false); };
Patch myPatch = myModel.getPatchAt(table.getSelectedRow()); try { myPatch.getDriver().getClass() .getDeclaredMethod("editPatch", new Class[]{myPatch.getClass()}); PatchEdit.editAction.setEnabled(true); } catch (NoSuchMethodException ex) { if (myPatch.getDriver() instanceof BankDriver) PatchEdit.editAction.setEnabled(true); else PatchEdit.editAction.setEnabled(false); }
            public void valueChanged(ListSelectionEvent e) {                //ErrorMsg.reportStatus ("ValueChanged"+((ListSelectionModel)e.getSource ()).getMaxSelectionIndex ());                if (((ListSelectionModel)e.getSource()).getMaxSelectionIndex()>=0) {                    PatchEdit.extractAction.setEnabled(true);                    PatchEdit.sendAction.setEnabled(true);                    PatchEdit.sendToAction.setEnabled(true);                    PatchEdit.playAction.setEnabled(true);                    PatchEdit.storeAction.setEnabled(true);                    PatchEdit.reassignAction.setEnabled(true);		    PatchEdit.uploadAction.setEnabled(true);                    Patch myPatch=((Scene)myModel.sceneList.get(table.getSelectedRow())).getPatch();                    try{                        myPatch.getDriver().getClass().getDeclaredMethod("editPatch", new Class[]{myPatch.getClass()});                        PatchEdit.editAction.setEnabled(true);                    }                    catch(NoSuchMethodException ex) {                        if (myPatch.getDriver() instanceof BankDriver)                            PatchEdit.editAction.setEnabled(true);                        else                            PatchEdit.editAction.setEnabled(false);                    };                    PatchEdit.copyAction.setEnabled(true);                    PatchEdit.cutAction.setEnabled(true);                    PatchEdit.deleteAction.setEnabled(true);                    PatchEdit.exportAction.setEnabled(true);                }                else {                    PatchEdit.extractAction.setEnabled(false);                    PatchEdit.sendAction.setEnabled(false);                    PatchEdit.sendToAction.setEnabled(false);                    PatchEdit.playAction.setEnabled(false);                    PatchEdit.storeAction.setEnabled(false);                    PatchEdit.reassignAction.setEnabled(false);                    PatchEdit.editAction.setEnabled(false);                    PatchEdit.copyAction.setEnabled(false);                    PatchEdit.cutAction.setEnabled(false);                    PatchEdit.deleteAction.setEnabled(false);		    PatchEdit.uploadAction.setEnabled(false);                }            }