Don't show warning dialog if no warnings
This commit is contained in:
parent
546e9b5ee8
commit
dd344b261a
@ -1381,8 +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);
|
||||||
@ -1476,7 +1475,7 @@ public class BasicFrame extends JFrame {
|
|||||||
WarningSet warnings = ROCKET_SAVER.getWarnings();
|
WarningSet warnings = ROCKET_SAVER.getWarnings();
|
||||||
ErrorSet errors = ROCKET_SAVER.getErrors();
|
ErrorSet errors = ROCKET_SAVER.getErrors();
|
||||||
|
|
||||||
if (errors.isEmpty()) {
|
if (!warnings.isEmpty() && errors.isEmpty()) {
|
||||||
WarningDialog.showWarnings(this,
|
WarningDialog.showWarnings(this,
|
||||||
new Object[]{
|
new Object[]{
|
||||||
// // The following problems were encountered while saving
|
// // The following problems were encountered while saving
|
||||||
@ -1486,7 +1485,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 {
|
} else if (!errors.isEmpty()) {
|
||||||
ErrorWarningDialog.showErrorsAndWarnings(this,
|
ErrorWarningDialog.showErrorsAndWarnings(this,
|
||||||
new Object[]{
|
new Object[]{
|
||||||
// // The following problems were encountered while saving
|
// // The following problems were encountered while saving
|
||||||
@ -1604,26 +1603,11 @@ public class BasicFrame extends JFrame {
|
|||||||
* @return true if the file was saved, false otherwise
|
* @return true if the file was saved, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean saveAsAction() {
|
private boolean saveAsAction() {
|
||||||
File file = null;
|
File file = openFileSaveAsDialog(FileType.OPENROCKET);
|
||||||
|
|
||||||
final DesignFileSaveAsFileChooser chooser = DesignFileSaveAsFileChooser.build(document, FileType.OPENROCKET);
|
|
||||||
|
|
||||||
int option = chooser.showSaveDialog(BasicFrame.this);
|
|
||||||
|
|
||||||
if (option != JFileChooser.APPROVE_OPTION) {
|
|
||||||
log.info(Markers.USER_MARKER, "User decided not to save, option=" + option);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = chooser.getSelectedFile();
|
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
log.info(Markers.USER_MARKER, "User did not select a file");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
((SwingPreferences) Application.getPreferences()).setDefaultDirectory(chooser.getCurrentDirectory());
|
|
||||||
chooser.storeOptions(document.getDefaultStorageOptions());
|
|
||||||
|
|
||||||
file = FileHelper.forceExtension(file, "ork");
|
file = FileHelper.forceExtension(file, "ork");
|
||||||
boolean result = FileHelper.confirmWrite(file, this) && saveAsOpenRocket(file);
|
boolean result = FileHelper.confirmWrite(file, this) && saveAsOpenRocket(file);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user