- JOptionPane.ERROR_MESSAGE);
-
- }
- long lastnotify = jmb.getLoadNotifiesHandled();
- if (files.length() > 0)
- {
- if (!addingStructures)
- {
-
- try
- {
- initJmol("load FILES " + files.toString());
- } catch (OutOfMemoryError oomerror)
- {
- new OOMWarning("When trying to open the Jmol viewer!", oomerror);
- Cache.log.debug("File locations are " + files);
- } catch (Exception ex)
- {
- Cache.log.error("Couldn't open Jmol viewer!", ex);
- }
- }
- else
- {
- StringBuffer cmd = new StringBuffer();
- cmd.append("loadingJalviewdata=true\nload APPEND ");
- cmd.append(files.toString());
- cmd.append("\nloadingJalviewdata=null");
- final String command = cmd.toString();
- cmd = null;
- lastnotify = jmb.getLoadNotifiesHandled();
-
- try
- {
- jmb.evalStateCommand(command);
- } catch (OutOfMemoryError oomerror)
- {
- new OOMWarning(
- "When trying to add structures to the Jmol viewer!",
- oomerror);
- Cache.log.debug("File locations are " + files);
- } catch (Exception ex)
- {
- Cache.log.error("Couldn't add files to Jmol viewer!", ex);
- }
- }
-
- // need to wait around until script has finished
- while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled()
- : (!jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb
- .getPdbFile().length != jmb.getPdbCount()))
- {
- try
- {
- Cache.log.debug("Waiting around for jmb notify.");
- Thread.sleep(35);
- } catch (Exception e)
- {
- }
- }
-
- // refresh the sequence colours for the new structure(s)
- for (AlignmentPanel ap : _colourwith)
- {
- jmb.updateColours(ap);
- }
- // do superposition if asked to
- if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
- {
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- if (jmb.viewer.isScriptExecuting())
- {
- javax.swing.SwingUtilities.invokeLater(this);
- try
- {
- Thread.sleep(5);
- } catch (InterruptedException q)
- {
- }
- ;
- return;
- }
- else
- {
- alignStructs_withAllAlignPanels();
- }
- }
- });
- alignAddedStructures = false;
- }
- addingStructures = false;
-