mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2025-01-02 19:29:17 +00:00
Implemeting User Warnings for the disk related errors.
This commit is contained in:
parent
86b53fea37
commit
9e132b15ce
@ -33,7 +33,7 @@ public class DiskCorruptException extends DiskException {
|
||||
public enum Kind {
|
||||
RECURSIVE_DIRECTORY_STRUCTURE {
|
||||
public String toString() {
|
||||
return "Recursive Directory structure detected."; // FIXME NLS
|
||||
return "DiskCorruptException.RecursiveDirectoryStructure"; //$NON-NLS-1$
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ import org.eclipse.swt.widgets.TreeItem;
|
||||
import com.webcodepro.applecommander.compiler.ApplesoftCompiler;
|
||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
||||
import com.webcodepro.applecommander.storage.Disk;
|
||||
import com.webcodepro.applecommander.storage.DiskCorruptException;
|
||||
import com.webcodepro.applecommander.storage.DiskException;
|
||||
import com.webcodepro.applecommander.storage.FileEntry;
|
||||
import com.webcodepro.applecommander.storage.FileEntryComparator;
|
||||
@ -201,14 +202,6 @@ public class DiskExplorerTab {
|
||||
fileTable = null;
|
||||
currentFileList = null;
|
||||
}
|
||||
/**
|
||||
* Warns user about a problem
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
protected void warnUserAbout(final DiskException e) {
|
||||
// TODO Implement this!
|
||||
}
|
||||
/**
|
||||
* Create the FILES tab.
|
||||
*/
|
||||
@ -240,7 +233,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
changeCurrentFormat(getCurrentFormat()); // minor hack
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@ -279,7 +272,7 @@ public class DiskExplorerTab {
|
||||
}
|
||||
}
|
||||
} catch (DiskException e) {
|
||||
this.warnUserAbout(e);
|
||||
this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -292,7 +285,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
fillFileTable(disks[0].getFiles());
|
||||
} catch (DiskException e) {
|
||||
this.warnUserAbout(e);
|
||||
this.diskWindow.handle(e);
|
||||
}
|
||||
directoryTree.setSelection(new TreeItem[] { directoryTree.getItems()[0] });
|
||||
}
|
||||
@ -366,7 +359,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
importFiles();
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -421,7 +414,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
viewFile(null);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -480,7 +473,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
viewFile(TextFileFilter.class);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -492,7 +485,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
viewFile(GraphicsFileFilter.class);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -923,7 +916,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
viewFile(null);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1279,7 +1272,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_STANDARD);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1292,7 +1285,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_NATIVE);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1305,7 +1298,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
changeCurrentFormat(FormattedDisk.FILE_DISPLAY_DETAIL);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1337,7 +1330,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
importFiles();
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1382,7 +1375,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
viewFile(null);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1673,7 +1666,7 @@ public class DiskExplorerTab {
|
||||
break;
|
||||
}
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1713,7 +1706,7 @@ public class DiskExplorerTab {
|
||||
break;
|
||||
}
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
} else { // No CTRL key
|
||||
@ -1736,7 +1729,7 @@ public class DiskExplorerTab {
|
||||
break;
|
||||
}
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1811,7 +1804,7 @@ public class DiskExplorerTab {
|
||||
try {
|
||||
printFiles(disk, 1);
|
||||
} catch (DiskException e) {
|
||||
DiskExplorerTab.this.warnUserAbout(e);
|
||||
DiskExplorerTab.this.diskWindow.handle(e);
|
||||
}
|
||||
}
|
||||
if (y != clientArea.y) { // partial page
|
||||
|
@ -24,11 +24,15 @@ import org.eclipse.swt.custom.CTabFolder;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.webcodepro.applecommander.storage.DiskCorruptException;
|
||||
import com.webcodepro.applecommander.storage.DiskException;
|
||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
||||
import com.webcodepro.applecommander.ui.UiBundle;
|
||||
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
|
||||
import com.webcodepro.applecommander.util.TextBundle;
|
||||
|
||||
/**
|
||||
* Displays disk information on the screen.
|
||||
@ -46,6 +50,8 @@ public class DiskWindow {
|
||||
private DiskInfoTab diskInfoTab;
|
||||
private DiskMapTab[] diskMapTabs;
|
||||
|
||||
private TextBundle textBundle = UiBundle.getInstance();
|
||||
|
||||
/**
|
||||
* Construct the disk window.
|
||||
*/
|
||||
@ -84,6 +90,58 @@ public class DiskWindow {
|
||||
shell.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Warns user about a Disk Corrupt problem
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
protected void handle(final DiskCorruptException e) {
|
||||
Shell finalShell = shell;
|
||||
MessageBox box = new MessageBox(finalShell, SWT.ICON_ERROR | SWT.OK);
|
||||
box.setText(textBundle.get("SwtAppleCommander." + e.kind + ".Title")); //$NON-NLS-1$
|
||||
box.setMessage(
|
||||
textBundle.format("SwtAppleCommander.DiskCorruptException.Message", //$NON-NLS-1$
|
||||
e.imagepath
|
||||
));
|
||||
box.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Warns user about a Generic Disk Error problem
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
protected void handle(final DiskException e) {
|
||||
if (e instanceof DiskCorruptException) {
|
||||
this.handle((DiskCorruptException) e);
|
||||
return;
|
||||
}
|
||||
final MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK | SWT.MODELESS);
|
||||
box.setText(textBundle.get("SwtAppleCommander.DiskException.Title")); //$NON-NLS-1$
|
||||
box.setMessage(
|
||||
textBundle.format("SwtAppleCommander.DiskException.Message", //$NON-NLS-1$
|
||||
new Object[]{e.imagepath, e.toString()}
|
||||
));
|
||||
box.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Warns user about an Application Error problem
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
public void handle(final Exception e) {
|
||||
final TextBundle textBundle = UiBundle.getInstance();
|
||||
Shell finalShell = shell;
|
||||
MessageBox box = new MessageBox(finalShell, SWT.ICON_ERROR | SWT.OK);
|
||||
box.setText(textBundle.get("SwtAppleCommander.UnexpectedErrorTitle")); //$NON-NLS-1$
|
||||
box.setMessage(
|
||||
textBundle.get("SwtAppleCommander.UnexpectedErrorMessage" //$NON-NLS-1$
|
||||
));
|
||||
box.open();
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the standard AppleCommander disk window title.
|
||||
* This is referenced in DiskWindow as well as DiskExplorerTab.
|
||||
|
@ -277,6 +277,12 @@ SwtAppleCommander.CompareDiskImageTooltip=Compare two disk images (Ctrl+E)
|
||||
SwtAppleCommander.AboutTooltip=About AppleCommander (Ctrl+A)
|
||||
SwtAppleCommander.AboutTitle=About AppleCommander
|
||||
SwtAppleCommander.AboutMessage=AppleCommander\nVersion {0}\n{1}\n\nAppleCommander was created for the express\npurpose of assisting those-who-remember.\n\nI wish you many hours of vintage pleasure\!\n-Rob
|
||||
SwtAppleCommander.UnexpectedErrorTitle=Application Error
|
||||
SwtAppleCommander.UnexpectedErrorMessage=Unfortunately "{0}" triggered an unexpected application error.\n\nPlease report this to the developers.\n\nWe are terribly sorry for the inconvenience\!
|
||||
SwtAppleCommander.DiskCorruptException.RecursiveDirectoryStructure.Title=Recursive Directory structure detected.
|
||||
SwtAppleCommander.DiskCorruptException.Message=Unfortunately "{0}" is corrupted.\n\nYou can't use this disk safely. Please use a First Aid tool to recover your data.\n\nSorry\!
|
||||
SwtAppleCommander.DiskException.Title="Disk Generic Error"
|
||||
SwtAppleCommander.DiskException.Message=Unfortunately "{0}" has an unrecognizable but yet fatal error, internal code "{1}".\n\nYou can't use this disk safely.\n\nSorry\!
|
||||
|
||||
# SwingAppleCommander
|
||||
SwingAppleCommander.MenuFile=File
|
||||
|
Loading…
Reference in New Issue
Block a user