Prevent the app from closing when a running task is detected

removed extra line
This commit is contained in:
bancika
2020-04-09 23:44:58 +02:00
parent fe687a99df
commit 6c3185c3ad
2 changed files with 10 additions and 6 deletions
@@ -643,7 +643,6 @@ public class ActionFactory {
super();
this.plugInPort = plugInPort;
this.drawingProvider = drawingProvider;
this.drawingProvider = drawingProvider;
this.swingUI = swingUI;
this.defaultSuffix = defaultSuffix;
putValue(AbstractAction.NAME, "Export to PNG");
@@ -107,7 +107,7 @@ public class MainFrame extends JFrame implements ISwingUI {
private CanvasPlugin canvasPlugin;
public MainFrame() {
super("DIYLC 3");
super("DIYLC 4");
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setPreferredSize(new Dimension(1024, 700));
createBasePanels();
@@ -149,12 +149,17 @@ public class MainFrame extends JFrame implements ISwingUI {
ConfigurationManager.getInstance().writeValue(IPlugInPort.ABNORMAL_EXIT_KEY, false);
dispose();
presenter.dispose();
LOG.info("Closing the app");
System.exit(0);
}
}
@Override
public void windowClosing(WindowEvent e) {
if (getGlassPane().isVisible()) {
LOG.info("Prevented the app from closing because a running task is detected");
return;
}
if (presenter.allowFileAction()) {
ConfigurationManager.getInstance().writeValue(IPlugInPort.ABNORMAL_EXIT_KEY, false);
dispose();