Clean up code

This commit is contained in:
SiboVG 2023-03-27 22:58:14 +02:00
parent 522c3a49b6
commit 5fcf3e9850
2 changed files with 1 additions and 12 deletions

View File

@ -1284,34 +1284,24 @@ public class BasicFrame extends JFrame {
//// Handle the document
OpenRocketDocument doc = null;
try {
doc = worker.get();
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof FileNotFoundException) {
log.warn("File not found", cause);
JOptionPane.showMessageDialog(parent,
"File not found: " + displayName,
"Error opening file", JOptionPane.ERROR_MESSAGE);
return null;
} else if (cause instanceof RocketLoadException) {
log.warn("Error loading the file", cause);
JOptionPane.showMessageDialog(parent,
"Unable to open file '" + displayName + "': "
+ cause.getMessage(),
"Error opening file", JOptionPane.ERROR_MESSAGE);
return null;
} else {
throw new BugException("Unknown error when opening file", e);
}
} catch (InterruptedException e) {
@ -1322,7 +1312,6 @@ public class BasicFrame extends JFrame {
throw new BugException("Document loader returned null");
}
//// Show warnings
WarningSet warnings = worker.getRocketLoader().getWarnings();
if (!warnings.isEmpty()) {

View File

@ -107,7 +107,7 @@ public final class ExampleDesignFileAction extends JMenu {
/**
* When a user clicks on one of the recently used design files, open it.
*
* @param file the design file name (absolute path)
* @param example the design file name (absolute path)
*
* @return the action to open a design file
*/