mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2024-12-21 17:29:55 +00:00
Adding a close listener and validating with user if the file has changed. #117.
This commit is contained in:
parent
e3a0844fbd
commit
c9dcb73b33
@ -41,6 +41,7 @@ public class ByteArrayImageLayout {
|
||||
*/
|
||||
public ByteArrayImageLayout(byte[] diskImage) {
|
||||
setDiskImage(diskImage);
|
||||
changed = false; // setDiskImage by default sets to true but we don't want that
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
package com.webcodepro.applecommander.ui.swt;
|
||||
|
||||
import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CTabFolder;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
@ -74,6 +75,13 @@ public class DiskWindow {
|
||||
dispose(event);
|
||||
}
|
||||
});
|
||||
shell.addListener(SWT.Close, (event) -> {
|
||||
if (disks[0].hasChanged()) {
|
||||
int button = SwtUtil.showYesNoDialog(shell, "Are you sure?",
|
||||
"The disk has been modified. Are you certain you want to quit?");
|
||||
event.doit = button == SWT.YES;
|
||||
}
|
||||
});
|
||||
|
||||
CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
|
||||
new DiskExplorerTab(tabFolder, disks, imageManager, this);
|
||||
|
Loading…
Reference in New Issue
Block a user