private void doEdit() { MemState s = factory.getState(instance, circState); if (s == null) return; HexFrame frame = factory.getHexFrame(proj, instance, circState); frame.setVisible(true); frame.toFront(); }
private void doClear() { MemState s = factory.getState(instance, circState); boolean isAllZero = s.getContents().isClear(); if (isAllZero) return; int choice = JOptionPane.showConfirmDialog(frame, _("ramConfirmClearMsg"), _("ramConfirmClearTitle"), JOptionPane.YES_NO_OPTION); if (choice == JOptionPane.YES_OPTION) { s.getContents().clear(); } }
private void doSave() { MemState s = factory.getState(instance, circState); JFileChooser chooser = proj.createChooser(); File oldSelected = factory.getCurrentImage(instance); if (oldSelected != null) chooser.setSelectedFile(oldSelected); chooser.setDialogTitle(_("ramSaveDialogTitle")); int choice = chooser.showSaveDialog(frame); if (choice == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); try { HexFile.save(f, s.getContents()); factory.setCurrentImage(instance, f); } catch (IOException e) { JOptionPane.showMessageDialog(frame, e.getMessage(), _("ramSaveErrorTitle"), JOptionPane.ERROR_MESSAGE); } } }