Fix some references to BasicFrame

This commit is contained in:
SiboVG 2023-03-31 02:13:56 +02:00
parent dead0ea75c
commit c48c3b8e4e

View File

@ -1381,7 +1381,7 @@ public class BasicFrame extends JFrame {
*/ */
private File openFileSaveAsDialog(FileType fileType) { private File openFileSaveAsDialog(FileType fileType) {
final DesignFileSaveAsFileChooser chooser = DesignFileSaveAsFileChooser.build(document, fileType); final DesignFileSaveAsFileChooser chooser = DesignFileSaveAsFileChooser.build(document, fileType);
int option = chooser.showSaveDialog(this); int option = chooser.showSaveDialog(BasicFrame.this);
if (option != JFileChooser.APPROVE_OPTION) { if (option != JFileChooser.APPROVE_OPTION) {
log.info(Markers.USER_MARKER, "User decided not to save, option=" + option); log.info(Markers.USER_MARKER, "User decided not to save, option=" + option);
@ -1415,7 +1415,7 @@ public class BasicFrame extends JFrame {
} }
file = FileHelper.forceExtension(file, RASAeroCommonConstants.FILE_EXTENSION); file = FileHelper.forceExtension(file, RASAeroCommonConstants.FILE_EXTENSION);
if (FileHelper.confirmWrite(file, this)) { if (FileHelper.confirmWrite(file, BasicFrame.this)) {
boolean result = saveAsRASAero(file); boolean result = saveAsRASAero(file);
if (!result) { if (!result) {
file.delete(); file.delete();
@ -1443,7 +1443,7 @@ public class BasicFrame extends JFrame {
} }
}); });
panel.add(check); panel.add(check);
int sel = JOptionPane.showOptionDialog(null, int sel = JOptionPane.showOptionDialog(BasicFrame.this,
panel, panel,
"", // title "", // title
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
@ -1476,7 +1476,7 @@ public class BasicFrame extends JFrame {
ErrorSet errors = ROCKET_SAVER.getErrors(); ErrorSet errors = ROCKET_SAVER.getErrors();
if (!warnings.isEmpty() && errors.isEmpty()) { if (!warnings.isEmpty() && errors.isEmpty()) {
WarningDialog.showWarnings(this, WarningDialog.showWarnings(BasicFrame.this,
new Object[]{ new Object[]{
// // The following problems were encountered while saving // // The following problems were encountered while saving
trans.get("BasicFrame.WarningDialog.saving.txt1") + " '" + file.getName() + "'.", trans.get("BasicFrame.WarningDialog.saving.txt1") + " '" + file.getName() + "'.",
@ -1486,7 +1486,7 @@ public class BasicFrame extends JFrame {
// // Warnings while opening file // // Warnings while opening file
trans.get("BasicFrame.WarningDialog.saving.title"), warnings); trans.get("BasicFrame.WarningDialog.saving.title"), warnings);
} else if (!errors.isEmpty()) { } else if (!errors.isEmpty()) {
ErrorWarningDialog.showErrorsAndWarnings(this, ErrorWarningDialog.showErrorsAndWarnings(BasicFrame.this,
new Object[]{ new Object[]{
// // The following problems were encountered while saving // // The following problems were encountered while saving
trans.get("BasicFrame.WarningDialog.saving.txt1") + " '" + file.getName() + "'.", trans.get("BasicFrame.WarningDialog.saving.txt1") + " '" + file.getName() + "'.",
@ -1525,7 +1525,7 @@ public class BasicFrame extends JFrame {
} }
file = FileHelper.forceExtension(file, "rkt"); file = FileHelper.forceExtension(file, "rkt");
if (FileHelper.confirmWrite(file, this) ) { if (FileHelper.confirmWrite(file, BasicFrame.this) ) {
return saveAsRockSim(file); return saveAsRockSim(file);
} }
return false; return false;
@ -1551,7 +1551,7 @@ public class BasicFrame extends JFrame {
} }
}); });
panel.add(check); panel.add(check);
int sel = JOptionPane.showOptionDialog(null, int sel = JOptionPane.showOptionDialog(BasicFrame.this,
panel, panel,
"", // title "", // title
JOptionPane.OK_CANCEL_OPTION, JOptionPane.OK_CANCEL_OPTION,
@ -1609,7 +1609,7 @@ public class BasicFrame extends JFrame {
} }
file = FileHelper.forceExtension(file, "ork"); file = FileHelper.forceExtension(file, "ork");
boolean result = FileHelper.confirmWrite(file, this) && saveAsOpenRocket(file); boolean result = FileHelper.confirmWrite(file, BasicFrame.this) && saveAsOpenRocket(file);
if (result) { if (result) {
MRUDesignFile opts = MRUDesignFile.getInstance(); MRUDesignFile opts = MRUDesignFile.getInstance();
opts.addFile(file.getAbsolutePath()); opts.addFile(file.getAbsolutePath());
@ -1629,7 +1629,7 @@ public class BasicFrame extends JFrame {
file = FileHelper.forceExtension(file, "ork"); file = FileHelper.forceExtension(file, "ork");
log.info("Saving document as " + file); log.info("Saving document as " + file);
if (!StorageOptionChooser.verifyStorageOptions(document, this)) { if (!StorageOptionChooser.verifyStorageOptions(document, BasicFrame.this)) {
// User cancelled the dialog // User cancelled the dialog
log.info(Markers.USER_MARKER, "User cancelled saving in storage options dialog"); log.info(Markers.USER_MARKER, "User cancelled saving in storage options dialog");
return false; return false;
@ -1638,7 +1638,7 @@ public class BasicFrame extends JFrame {
document.getDefaultStorageOptions().setFileType(FileType.OPENROCKET); document.getDefaultStorageOptions().setFileType(FileType.OPENROCKET);
SaveFileWorker worker = new SaveFileWorker(document, file, ROCKET_SAVER); SaveFileWorker worker = new SaveFileWorker(document, file, ROCKET_SAVER);
if (!SwingWorkerDialog.runWorker(this, "Saving file", if (!SwingWorkerDialog.runWorker(BasicFrame.this, "Saving file",
"Writing " + file.getName() + "...", worker)) { "Writing " + file.getName() + "...", worker)) {
// User cancelled the save // User cancelled the save
@ -1659,7 +1659,7 @@ public class BasicFrame extends JFrame {
if (cause instanceof IOException) { if (cause instanceof IOException) {
log.warn("An I/O error occurred while saving " + file, cause); log.warn("An I/O error occurred while saving " + file, cause);
JOptionPane.showMessageDialog(this, new String[] { JOptionPane.showMessageDialog(BasicFrame.this, new String[] {
"An I/O error occurred while saving:", "An I/O error occurred while saving:",
e.getMessage() }, "Saving failed", JOptionPane.ERROR_MESSAGE); e.getMessage() }, "Saving failed", JOptionPane.ERROR_MESSAGE);
return false; return false;
@ -1689,7 +1689,7 @@ public class BasicFrame extends JFrame {
if (!document.isSaved()) { if (!document.isSaved()) {
log.info("Confirming whether to save the design"); log.info("Confirming whether to save the design");
ComponentConfigDialog.disposeDialog(); ComponentConfigDialog.disposeDialog();
int result = JOptionPane.showConfirmDialog(this, int result = JOptionPane.showConfirmDialog(BasicFrame.this,
trans.get("BasicFrame.dlg.lbl1") + rocket.getName() + trans.get("BasicFrame.dlg.lbl1") + rocket.getName() +
trans.get("BasicFrame.dlg.lbl2") + " " + trans.get("BasicFrame.dlg.lbl2") + " " +
trans.get("BasicFrame.dlg.lbl3"), trans.get("BasicFrame.dlg.lbl3"),
@ -1714,12 +1714,12 @@ public class BasicFrame extends JFrame {
// Rocket has been saved or discarded // Rocket has been saved or discarded
log.debug("Disposing window"); log.debug("Disposing window");
this.dispose(); BasicFrame.this.dispose();
ComponentConfigDialog.disposeDialog(); ComponentConfigDialog.disposeDialog();
ComponentAnalysisDialog.hideDialog(); ComponentAnalysisDialog.hideDialog();
frames.remove(this); frames.remove(BasicFrame.this);
if (frames.isEmpty()) { if (frames.isEmpty()) {
// Don't quit the application on macOS, but keep the application open // Don't quit the application on macOS, but keep the application open
if (SystemInfo.getPlatform() == SystemInfo.Platform.MAC_OS) { if (SystemInfo.getPlatform() == SystemInfo.Platform.MAC_OS) {
@ -1733,13 +1733,13 @@ public class BasicFrame extends JFrame {
} }
public void exportDecalAction() { public void exportDecalAction() {
new ExportDecalDialog(this, document).setVisible(true); new ExportDecalDialog(BasicFrame.this, document).setVisible(true);
} }
public void printAction() { public void printAction() {
double rotation = rocketpanel.getFigure().getRotation(); double rotation = rocketpanel.getFigure().getRotation();
new PrintDialog(this, document, rotation).setVisible(true); new PrintDialog(BasicFrame.this, document, rotation).setVisible(true);
} }
/** /**