From: <ha...@us...> - 2011-04-08 02:22:11
|
Revision: 15370 http://jmol.svn.sourceforge.net/jmol/?rev=15370&view=rev Author: hansonr Date: 2011-04-08 02:22:05 +0000 (Fri, 08 Apr 2011) Log Message: ----------- version=12.1.42 # code: Swing class instantiation failure caught # bug fix - set picking identifyBond not implemented # bug fix - leaving modelKitMode does not leave bondPickingMode "ident" # new feature: for (var x in [....]) {...} # -- array option Modified Paths: -------------- trunk/Jmol/src/com/sparshui/inputdevice/JmolTouchSimulator.java trunk/Jmol/src/org/jmol/applet/Jmol.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/StatusManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/com/sparshui/inputdevice/JmolTouchSimulator.java =================================================================== --- trunk/Jmol/src/com/sparshui/inputdevice/JmolTouchSimulator.java 2011-04-05 21:27:17 UTC (rev 15369) +++ trunk/Jmol/src/com/sparshui/inputdevice/JmolTouchSimulator.java 2011-04-08 02:22:05 UTC (rev 15370) @@ -139,7 +139,12 @@ TouchData te = new TouchData(); te.id = (type == TouchState.BIRTH) ? ++_touchID : _touchID; Point p = new Point(x, y); - SwingUtilities.convertPointToScreen(p, _display); + try { + SwingUtilities.convertPointToScreen(p, _display); + } catch (Throwable e) { + // no Swing + return; + } te.x = p.x; te.y = p.y; //te.x = e.getLocationOnScreen().x; Modified: trunk/Jmol/src/org/jmol/applet/Jmol.java =================================================================== --- trunk/Jmol/src/org/jmol/applet/Jmol.java 2011-04-05 21:27:17 UTC (rev 15369) +++ trunk/Jmol/src/org/jmol/applet/Jmol.java 2011-04-08 02:22:05 UTC (rev 15370) @@ -263,7 +263,7 @@ try { UIManager.setLookAndFeel(UIManager .getCrossPlatformLookAndFeelClassName()); - } catch (Exception exc) { + } catch (Throwable exc) { System.err.println("Error loading L&F: " + exc); } if (Logger.debugging) { Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2011-04-05 21:27:17 UTC (rev 15369) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2011-04-08 02:22:05 UTC (rev 15370) @@ -1,8 +1,9 @@ # Developers: to add a description of changes you have made, # add it on a line starting with # below the "version=..." line -version=12.1.42_dev +version=12.1.42 +# code: Swing class instantiation failure caught # bug fix - set picking identifyBond not implemented # bug fix - leaving modelKitMode does not leave bondPickingMode "ident" # new feature: for (var x in [....]) {...} Modified: trunk/Jmol/src/org/jmol/viewer/StatusManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StatusManager.java 2011-04-05 21:27:17 UTC (rev 15369) +++ trunk/Jmol/src/org/jmol/viewer/StatusManager.java 2011-04-08 02:22:05 UTC (rev 15370) @@ -35,6 +35,7 @@ import java.util.List; import java.util.Map; +import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import org.jmol.api.Interface; @@ -699,5 +700,23 @@ return outputFileName; } + static String prompt(String label, String data, String[] list, + boolean asButtons) { + try { + if (!asButtons) + return JOptionPane.showInputDialog(label, data); + if (data != null) + list = TextFormat.split(data, "|"); + int i = JOptionPane.showOptionDialog(null, label, "Jmol prompt", + JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, + list, list[0]); + // ESCAPE will close the panel with no option selected. + return (data == null ? "" + i : i == JOptionPane.CLOSED_OPTION ? "null" + : list[i]); + } catch (Throwable e) { + return "null"; + } + } + } Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2011-04-05 21:27:17 UTC (rev 15369) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2011-04-08 02:22:05 UTC (rev 15370) @@ -90,7 +90,6 @@ import java.util.Map; import java.util.Properties; -import javax.swing.JOptionPane; import javax.vecmath.Point3f; import javax.vecmath.Tuple3f; import javax.vecmath.Vector3f; @@ -4860,6 +4859,7 @@ void popupMenu(int x, int y, char type) { if (!haveDisplay || !refreshing || isPreviewOnly || global.disablePopupMenu) return; + try { switch (type) { case 'j': getPopupMenu(); @@ -4878,6 +4878,10 @@ } modelkit.show(x, y, type); } + } catch (Throwable e) { + // no Swing -- tough luck! + global.disablePopupMenu = true; + } } public String getMenu(String type) { @@ -5370,8 +5374,8 @@ if (appConsole == null) getProperty("DATA_API", "getAppConsole", Boolean.TRUE); appConsole.setVisible(showConsole); - } catch (Exception e) { - // no console for this client... + } catch (Throwable e) { + // no console for this client... maybe no Swing } } @@ -9530,16 +9534,7 @@ public String prompt(String label, String data, String[] list, boolean asButtons) { - if (!asButtons) - return JOptionPane.showInputDialog(label, data); - if (data != null) - list = TextFormat.split(data, "|"); - int i = JOptionPane.showOptionDialog(null, label, "Jmol prompt", - JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, - list, list[0]); - // ESCAPE will close the panel with no option selected. - return (data == null ? "" + i : i == JOptionPane.CLOSED_OPTION ? "null" - : list[i]); + return StatusManager.prompt(label, data, list, asButtons); } String getMenuName(int i) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |