* Send this message to stderr as the warning that follows (due to
* reflection) also goes to stderr.
*/
- System.err.println(
+ jalview.bin.Console.errPrintln(
"Linux platform only! You may have the following warning next: \"WARNING: An illegal reflective access operation has occurred\"\nThis is expected and cannot be avoided, sorry about that.");
}
final String awtAppClassName = "awtAppClassName";
}
} catch (Exception ex)
{
- System.out.println(
+ jalview.bin.Console.outPrintln(
"Unable to paste alignment from system clipboard:\n" + ex);
}
}
setKeyBindings(frame);
- desktop.add(frame);
+ // Since the latest FlatLaf patch, we occasionally have problems showing structureViewer frames...
+ int tries=3;
+ boolean shown=false;
+ Exception last=null;
+ do
+ {
+ try
+ {
+ desktop.add(frame);
+ shown=true;
+ } catch (IllegalArgumentException iaex)
+ {
+ last=iaex;
+ tries--;
+ jalview.bin.Console.info(
+ "Squashed IllegalArgument Exception (" + tries + " left) for "+frame.getTitle(),
+ iaex);
+ try
+ {
+ Thread.sleep(5);
+ } catch (InterruptedException iex)
+ {
+ }
+ ;
+ }
+ } while (!shown && tries > 0);
+ if (!shown)
+ {
+ jalview.bin.Console.error("Serious Problem whilst showing window "+frame.getTitle(),last);
+ }
windowMenu.add(menuItem);
}
} catch (Exception ex)
{
- System.err.println("Error opening help: " + ex.getMessage());
+ jalview.bin.Console.errPrintln("Error opening help: " + ex.getMessage());
}
}
boolean autoSave = projectFile != null && !saveAs
&& BackupFiles.getEnabled();
- // System.out.println("autoSave="+autoSave+", projectFile='"+projectFile+"',
+ // jalview.bin.Console.outPrintln("autoSave="+autoSave+", projectFile='"+projectFile+"',
// saveAs="+saveAs+", Backups
// "+(BackupFiles.getEnabled()?"enabled":"disabled"));
{
if (Platform.isAMacAndNotJS())
{
- System.err.println(
+ jalview.bin.Console.errPrintln(
"Please ignore plist error - occurs due to problem with java 8 on OSX");
}
}
{
Desktop.instance.closeAll_actionPerformed(null);
Desktop.instance.setVisible(false);
- Desktop.instance.dispose();
+ Desktop us = Desktop.instance;
Desktop.instance = null;
+ // call dispose in a separate thread - try to avoid indirect deadlocks
+ new Thread(new Runnable() {
+ @Override
+ public void run()
+ {
+ ExecutorService dex = us.dialogExecutor;
+ if (dex!=null) {
+ dex.shutdownNow();
+ us.dialogExecutor=null;
+ us.block.drainPermits();
+ }
+ us.dispose();
+ }
+ }).start();
}
}