mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
close-then-save to avoid confusion as save may take some time
This commit is contained in:
+10
-8
@@ -47,7 +47,7 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
private JComponent myCenterPanel;
|
||||
private final String myDimensionKey;
|
||||
private final boolean myShowApplyButton;
|
||||
private boolean myChangesWereApplied;
|
||||
private boolean mySaveAllOnClose;
|
||||
|
||||
public SingleConfigurableEditor(@Nullable Project project,
|
||||
Configurable configurable,
|
||||
@@ -166,18 +166,16 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
|
||||
@Override
|
||||
public void doCancelAction() {
|
||||
if (myChangesWereApplied) {
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
}
|
||||
super.doCancelAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doOKAction() {
|
||||
try {
|
||||
if (myConfigurable.isModified()) myConfigurable.apply();
|
||||
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
if (myConfigurable.isModified()) {
|
||||
myConfigurable.apply();
|
||||
mySaveAllOnClose = true;
|
||||
}
|
||||
}
|
||||
catch (ConfigurationException e) {
|
||||
if (e.getMessage() != null) {
|
||||
@@ -237,7 +235,7 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
myPerformAction = true;
|
||||
if (myConfigurable.isModified()) {
|
||||
myConfigurable.apply();
|
||||
myChangesWereApplied = true;
|
||||
mySaveAllOnClose = true;
|
||||
setCancelButtonText(CommonBundle.getCloseButtonText());
|
||||
}
|
||||
}
|
||||
@@ -275,5 +273,9 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
super.dispose();
|
||||
myConfigurable.disposeUIResources();
|
||||
myConfigurable = null;
|
||||
|
||||
if (mySaveAllOnClose) {
|
||||
ApplicationManager.getApplication().saveAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user