mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-20 17:32:34 +00:00
Better error handling of invalid disks (or non-disks).
This commit is contained in:
parent
082b51c11a
commit
d205eda7f3
@ -25,8 +25,6 @@ import com.webcodepro.applecommander.storage.Disk.FilenameFilter;
|
|||||||
import com.webcodepro.applecommander.ui.AppleCommander;
|
import com.webcodepro.applecommander.ui.AppleCommander;
|
||||||
import com.webcodepro.applecommander.ui.UserPreferences;
|
import com.webcodepro.applecommander.ui.UserPreferences;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
@ -169,22 +167,31 @@ public class SwtAppleCommander implements Listener {
|
|||||||
DiskWindow window = new DiskWindow(shell, formattedDisks, imageManager);
|
DiskWindow window = new DiskWindow(shell, formattedDisks, imageManager);
|
||||||
window.open();
|
window.open();
|
||||||
} else {
|
} else {
|
||||||
Shell finalShell = shell;
|
showUnrecognizedDiskFormatMessage(fullpath);
|
||||||
MessageBox box = new MessageBox(finalShell, SWT.ICON_ERROR | SWT.OK);
|
|
||||||
box.setText("Unrecognized Disk Format");
|
|
||||||
box.setMessage(
|
|
||||||
"Unable to load '" + fullpath + "'.\n\n"
|
|
||||||
+ "AppleCommander did not recognize the format\n"
|
|
||||||
+ "of that disk. Either this is a new format\n"
|
|
||||||
+ "or a protected disk.\n\n"
|
|
||||||
+ "Sorry!");
|
|
||||||
box.open();
|
|
||||||
}
|
}
|
||||||
} catch (IOException ignored) {
|
} catch (Exception ignored) {
|
||||||
|
showUnrecognizedDiskFormatMessage(fullpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the unrecognized disk format message.
|
||||||
|
* @param fullpath
|
||||||
|
*/
|
||||||
|
private void showUnrecognizedDiskFormatMessage(String fullpath) {
|
||||||
|
Shell finalShell = shell;
|
||||||
|
MessageBox box = new MessageBox(finalShell, SWT.ICON_ERROR | SWT.OK);
|
||||||
|
box.setText("Unrecognized Disk Format");
|
||||||
|
box.setMessage(
|
||||||
|
"Unable to load '" + fullpath + "'.\n\n"
|
||||||
|
+ "AppleCommander did not recognize the format\n"
|
||||||
|
+ "of the disk. Either this is a new format\n"
|
||||||
|
+ "or a protected disk.\n\n"
|
||||||
|
+ "Sorry!");
|
||||||
|
box.open();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a disk image.
|
* Create a disk image.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user