Prevent the app from closing while running background operations, like

saving and exporting files
This commit is contained in:
bancika
2020-04-10 10:53:25 +02:00
parent c2007f62b1
commit b1929e538b
2 changed files with 9 additions and 1 deletions
@@ -2910,6 +2910,10 @@
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Faster auto-scroll while dragging a component outside the visible portion of the canvas</description> <description>Faster auto-scroll while dragging a component outside the visible portion of the canvas</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Prevent the app from closing while running background operations, like saving and exporting files</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType> <changeType>BUG_FIX</changeType>
<description>Older files that contain "Open Jack 1/4" components sometimes open with the jacks rotated the wrong way</description> <description>Older files that contain "Open Jack 1/4" components sometimes open with the jacks rotated the wrong way</description>
@@ -145,6 +145,10 @@ public class MainFrame extends JFrame implements ISwingUI {
@Override @Override
public void windowClosed(WindowEvent e) { public void windowClosed(WindowEvent e) {
if (getGlassPane().isVisible()) {
LOG.info("Prevented the app from closing because a running task is detected");
return;
}
if (presenter.allowFileAction()) { if (presenter.allowFileAction()) {
ConfigurationManager.getInstance().writeValue(IPlugInPort.ABNORMAL_EXIT_KEY, false); ConfigurationManager.getInstance().writeValue(IPlugInPort.ABNORMAL_EXIT_KEY, false);
dispose(); dispose();