From: jprocter Date: Fri, 18 Feb 2011 17:29:50 +0000 (+0000) Subject: convenience method to discover all Jmols X-Git-Tag: Release_2_7~241 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=329abf57c756ac530604dce9136045b0bd5ffaca;p=jalview.git convenience method to discover all Jmols --- diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index c58de43..dbb6955 100755 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1986,6 +1986,42 @@ public class Desktop extends jalview.jbgui.GDesktop implements avp.clear(); return afs; } + public AppJmol[] getJmols() + { + JInternalFrame[] frames = Desktop.desktop.getAllFrames(); + + if (frames == null) + { + return null; + } + Vector avp = new Vector(); + try + { + // REVERSE ORDER + for (int i = frames.length - 1; i > -1; i--) + { + if (frames[i] instanceof AppJmol) + { + AppJmol af = (AppJmol) frames[i]; + avp.addElement(af); + } + } + } catch (Exception ex) + { + ex.printStackTrace(); + } + if (avp.size() == 0) + { + return null; + } + AppJmol afs[] = new AppJmol[avp.size()]; + for (int i = 0, j = avp.size(); i < j; i++) + { + afs[i] = (AppJmol) avp.elementAt(i); + } + avp.clear(); + return afs; + } /** * Add Groovy Support to Jalview @@ -2326,4 +2362,5 @@ public class Desktop extends jalview.jbgui.GDesktop implements return wsparamManager; } + }