mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2025-04-27 18:48:38 +00:00
Update FileMapMakingdialog.java
update map making dialog to always fully dispose dialog
This commit is contained in:
parent
e69520a0b5
commit
c33ad18067
@ -23,6 +23,8 @@ public class FileMapMakingdialog extends PamDialog {
|
||||
private static FileMapMakingdialog singleInstance;
|
||||
|
||||
private OfflineFileServer offlineFileServer;
|
||||
|
||||
private static Object synchObject = new Object();
|
||||
|
||||
private FileMapMakingdialog(Window parentFrame) {
|
||||
super(parentFrame, "Map raw sound files", false);
|
||||
@ -42,19 +44,35 @@ public class FileMapMakingdialog extends PamDialog {
|
||||
getCancelButton().setVisible(false);
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
setModalityType(Dialog.ModalityType.MODELESS);
|
||||
|
||||
}
|
||||
|
||||
public static FileMapMakingdialog showDialog(Window parent, OfflineFileServer fileServer) {
|
||||
if (singleInstance == null || singleInstance.getOwner() != parent) {
|
||||
singleInstance = new FileMapMakingdialog(parent);
|
||||
// copy the reference, just in case it's deleted in a call to setVisible(false)
|
||||
FileMapMakingdialog anInstance = singleInstance;
|
||||
synchronized (synchObject) {
|
||||
if (singleInstance == null || singleInstance.getOwner() != parent) {
|
||||
anInstance = singleInstance = new FileMapMakingdialog(parent);
|
||||
}
|
||||
}
|
||||
singleInstance.offlineFileServer = fileServer;
|
||||
singleInstance.progress.setIndeterminate(true);
|
||||
singleInstance.fileName.setText(" ");
|
||||
singleInstance.setVisible(true);
|
||||
return singleInstance;
|
||||
anInstance.offlineFileServer = fileServer;
|
||||
anInstance.progress.setIndeterminate(true);
|
||||
anInstance.fileName.setText(" ");
|
||||
anInstance.setVisible(true);
|
||||
return anInstance;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
if (visible == false) {
|
||||
synchronized(synchObject) {
|
||||
super.dispose();
|
||||
singleInstance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setProgress(FileMapProgress mapProgress) {
|
||||
switch (mapProgress.countingState) {
|
||||
case FileMapProgress.STATE_LOADINGMAP:
|
||||
|
Loading…
Reference in New Issue
Block a user