mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-01-02 22:32:45 +00:00
Save disk/file/sectors
This commit is contained in:
parent
438dd9dd4c
commit
5ea96a260d
@ -4,11 +4,15 @@ import javax.swing.JFileChooser;
|
||||
|
||||
import com.bytezone.diskbrowser.utilities.DefaultAction;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
public abstract class AbstractSaveAction extends DefaultAction
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
JFileChooser fileChooser;
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public AbstractSaveAction (String text, String tip)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
super (text, tip);
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ class SaveDiskAction extends AbstractSaveAction implements DiskSelectionListener
|
||||
try
|
||||
{
|
||||
Files.copy (disk.getDisk ().getFile ().toPath (), file.toPath ());
|
||||
JOptionPane.showMessageDialog (null, "Disk saved");
|
||||
JOptionPane.showMessageDialog (null,
|
||||
String.format ("File %s saved", file.getName ()));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
@ -64,6 +65,6 @@ class SaveDiskAction extends AbstractSaveAction implements DiskSelectionListener
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.disk = event.getFormattedDisk ();
|
||||
setEnabled (disk.isTempDisk ());
|
||||
setEnabled (disk != null && disk.isTempDisk ());
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ class SaveFileAction extends AbstractSaveAction implements FileSelectionListener
|
||||
{
|
||||
Files.write (file.toPath (), appleFileSource.getDataSource ().getBuffer (),
|
||||
StandardOpenOption.CREATE_NEW);
|
||||
JOptionPane.showMessageDialog (null, "File saved");
|
||||
JOptionPane.showMessageDialog (null,
|
||||
String.format ("File %s saved", file.getName ()));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
@ -66,5 +67,8 @@ class SaveFileAction extends AbstractSaveAction implements FileSelectionListener
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
this.appleFileSource = event.appleFileSource;
|
||||
setEnabled (
|
||||
event.appleFileSource != null && event.appleFileSource.getDataSource () != null
|
||||
&& event.appleFileSource.getDataSource ().getBuffer () != null);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,8 @@ class SaveSectorsAction extends AbstractSaveAction implements SectorSelectionLis
|
||||
byte[] buffer =
|
||||
event.getFormattedDisk ().getDisk ().readBlocks (event.getSectors ());
|
||||
Files.write (file.toPath (), buffer, StandardOpenOption.CREATE_NEW);
|
||||
JOptionPane.showMessageDialog (null, "File saved");
|
||||
JOptionPane.showMessageDialog (null,
|
||||
String.format ("File %s saved", file.getName ()));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user