Author: kono
Date: 2010-11-01 19:06:30 -0700 (Mon, 01 Nov 2010)
New Revision: 22681

Modified:
   
cytoscape/trunk/application/src/main/java/cytoscape/visual/ui/editors/discrete/CyComboBoxPropertyEditor.java
Log:
To avoid crash, an exception handler had been added.

Modified: 
cytoscape/trunk/application/src/main/java/cytoscape/visual/ui/editors/discrete/CyComboBoxPropertyEditor.java
===================================================================
--- 
cytoscape/trunk/application/src/main/java/cytoscape/visual/ui/editors/discrete/CyComboBoxPropertyEditor.java
        2010-11-01 23:56:26 UTC (rev 22680)
+++ 
cytoscape/trunk/application/src/main/java/cytoscape/visual/ui/editors/discrete/CyComboBoxPropertyEditor.java
        2010-11-02 02:06:30 UTC (rev 22681)
@@ -19,6 +19,8 @@
 
 import com.l2fprod.common.beans.editor.AbstractPropertyEditor;
 
+import cytoscape.logger.CyLogger;
+
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Font;
@@ -71,19 +73,28 @@
 
                                public void 
popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                                        
-                                       if(combo.getSelectedItem() == null && 
combo.getItemCount() != 0) {
-                                               combo.setSelectedIndex(0);
-                                               
CyComboBoxPropertyEditor.this.firePropertyChange(oldValue,
-                                combo.getItemAt(0));
-                                       } else 
-                                       
CyComboBoxPropertyEditor.this.firePropertyChange(oldValue,
-                                                                               
         combo.getSelectedItem());
-                                       
+                                       try {
+                                               if(combo.getSelectedItem() == 
null && combo.getItemCount() != 0) {
+                                                       
combo.setSelectedIndex(0);
+                                                       
CyComboBoxPropertyEditor.this.firePropertyChange(oldValue,
+                                       combo.getItemAt(0));
+                                               } else {
+                                                       
CyComboBoxPropertyEditor.this.firePropertyChange(oldValue,
+                                                                               
                 combo.getSelectedItem());
+                                               }
+                                       } catch(Exception ex1) {
+                                               ex1.printStackTrace();
+                                               
CyLogger.getLogger().warning("Combo Box property editor caught an error.", ex1);
+                                               
+                                               // TODO: update table view if 
crash?
+                                               return;
+                                       }
                                }
 
                                public void 
popupMenuWillBecomeVisible(PopupMenuEvent e) {
                                }
                        });
+               
                combo.addKeyListener(new KeyAdapter() {
                                public void keyPressed(KeyEvent e) {
                                        if (e.getKeyCode() == KeyEvent.VK_ENTER)

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to