Oh, I see. What you don't realize is that a whole new viewer is created. I'm
not sure where your m_JmolApp.viewer comes from, but whatever it is, it
won't do anything after the load MENU command.

    public void setCallbackFunction(String callbackType, String
callbackFunction) {
      if (callbackType.equalsIgnoreCase("menu")) {
        menuStructure = callbackFunction;
        menuFile = null;
        setupNewFrame(viewer.getStateInfo());
        return;
      }
    ...
    }


  protected void setupNewFrame(String state) {
    JFrame newFrame = new JFrame();
    JFrame f = this.frame;
    Jmol j = new Jmol(null, newFrame, Jmol.this, startupWidth,
startupHeight,
        "", (state == null ? null : f.getLocationOnScreen()));
    newFrame.show();
    if (state != null) {
      dispose(f);
      j.viewer.evalStringQuiet(state);
    }
  }


Are you perhaps doing this from Jmol in an embedded application, not the
Jmol applet itself? If so, what does YOUR setCallbackFunction() do? Notice
that in setupNewFrame() we create a completely new instance of Jmol and load
the previous state. That new instance has a new viewer. That's what is
causing you the problem. You are using the wrong viewer. I don't think you
can string the commands together like that. Basically, the language changing
isn't generally applicable without some pretty tricky coding.

Bob







2009/2/12 Jeroen Logtenberg <[email protected]>

>  I thought it was harmless at first too, but I'm having problems getting
> script commands to work after the exception. My java code says for example:
> m_JmolApp.viewer.evalString("load MENU custom.mnu");
> m_JmolApp.viewer.evalString("set picking CENTER");
>
> The menu loads like it's supposed to, but the center picking refuses to
> activate.
>
> Jeroen
>
> ------------------------------
> Date: Thu, 12 Feb 2009 10:10:52 -0600
> From: [email protected]
> To: [email protected]
> Subject: Re: [Jmol-developers] (no subject)
>
> Yes, I get that, too. As far as I can tell it's harmless -- the menu is
> loaded, and Jmol continues past the exception. Could be a Java bug. --
> Right? I can see the code:
>
>       try {
>         f.dispose();
>         if (scriptWindow != null) {
>           scriptWindow.dispose();
>         }
>       } catch (Exception e) {
>         // ignore
>       }
>
> Oddly enough the message is displayed upon execution of f.dispose(), but
> Jmol continues on to the scriptWindowDispose() anyway, as though no
> exception were thrown (which is fine).
>
> Bob
>
>
> On Thu, Feb 12, 2009 at 9:28 AM, Jeroen Logtenberg <
> [email protected]> wrote:
>
>  Hello!
>
> I'm trying to convince the Jmol standalone application to load a custom
> menu using the 'load menu' script. However, this generates the following
> exception:
>
> Disposal was interrupted:
> java.lang.InterruptedException
>         at java.lang.Object.wait(Native Method)
>         at java.lang.Object.wait(Object.java:485)
>         at java.awt.EventQueue.invokeAndWait(Unknown Source)
>         at java.awt.Window.doDispose(Unknown Source)
>         at java.awt.Window.dispose(Unknown Source)
>         at org.openscience.jmol.app.Jmol.dispose(Unknown Source)
>         at org.openscience.jmol.app.Jmol.setupNewFrame(Unknown Source)
>         at
> org.openscience.jmol.app.Jmol$MyStatusListener.setCallbackFunction(Unknown
> Source)
>         at org.jmol.viewer.StatusManager.setCallbackFunction(Unknown
> Source)
>         at org.jmol.viewer.Viewer.setMenu(Unknown Source)
>         at org.jmol.viewer.Eval.load(Unknown Source)
>         at org.jmol.viewer.Eval.instructionDispatchLoop(Unknown Source)
>         at org.jmol.viewer.Eval.runEval(Unknown Source)
>         at org.jmol.viewer.Viewer.evalStringWaitStatus(Unknown Source)
>         at
> org.jmol.viewer.ScriptManager$ScriptQueueRunnable.runScript(Unknown Source)
>         at
> org.jmol.viewer.ScriptManager$ScriptQueueRunnable.runNextScript(Unknown
> Source)
>         at org.jmol.viewer.ScriptManager$ScriptQueueRunnable.run(Unknown
> Source)
>         at java.lang.Thread.run(Unknown Source)
>
> Even when loading the default menu (dumped with the 'write menu' script),
> this exception occurs. I've tried using different versions (11.7.25,
> 11.6.15, 11.4.6, even 11.2.14). I'm starting the application using
> org.openscience.jmol.app.getJmol.getJmol(...).
>
> Is it a bug or is there something that I'm doing wrong?
>
> thanks in advance,
> Jeroen
>
> ------------------------------
> Express yourself instantly with MSN Messenger! MSN 
> Messenger<http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/>
>
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code
> to
> build responsive, highly engaging applications that combine the power of
> local
> resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> _______________________________________________
> Jmol-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
>
>
>
> --
> Robert M. Hanson
> Professor of Chemistry
> St. Olaf College
> 1520 St. Olaf Ave.
> Northfield, MN 55057
> http://www.stolaf.edu/people/hansonr
> phone: 507-786-3107
>
>
> If nature does not answer first what we want,
> it is better to take what answer we get.
>
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>
> ------------------------------
> See all the ways you can stay connected to friends and 
> family<http://www.microsoft.com/windows/windowslive/default.aspx>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Jmol-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
>


-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to