Author: pwang
Date: 2012-11-09 14:18:13 -0800 (Fri, 09 Nov 2012)
New Revision: 30769

Modified:
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
Log:
Fixed bug#1510

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
        2012-11-09 21:23:11 UTC (rev 30768)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/PopupMenuHelper.java
        2012-11-09 22:18:13 UTC (rev 30769)
@@ -190,7 +190,7 @@
         * Creates a menu based on the NetworkView.
         */
        void createEmptySpaceMenu(Point rawPt, Point xformPt, String action) {
-               
+
                final JPopupMenu menu = createMenu("Double Click Menu: empty");
                final JMenuTracker tracker = new JMenuTracker(menu);
 
@@ -209,7 +209,22 @@
                        addMenuItem(null, menu, provisioner, null, tracker, 
m_view.networkViewLocationTfs.get( nvltf ) );
                }
                
-               menu.show(invoker,(int)(rawPt.getX()), (int)(rawPt.getY()));
+               int menuItemCount = usableTFs.size()+ usableTFs2.size();
+               if (action.equalsIgnoreCase("OPEN") && menuItemCount == 1){
+                       //Double click on open space and there is only one menu 
item, execute it
+                       if (usableTFs.size() == 1){
+                               NetworkViewTaskFactory tf  = 
usableTFs.iterator().next();
+                               
m_view.manager.execute(tf.createTaskIterator(m_view));
+                       }
+                       else if (usableTFs2.size() == 1){
+                               NetworkViewLocationTaskFactory tf = 
usableTFs2.iterator().next();
+                               
m_view.manager.execute(tf.createTaskIterator(m_view,rawPt, xformPt));
+                       }
+               }
+               else {
+                       // There are more than one menu item, let user make the 
selection
+                       menu.show(invoker,(int)(rawPt.getX()), 
(int)(rawPt.getY()));            
+               }
        }
 
        /**
@@ -230,10 +245,6 @@
                boolean useCheckBoxMenuItem = getBooleanProperty(props, 
"useCheckBoxMenuItem");
                double gravity;
 
-               // We really don't want to have double-click actions in our 
menus
-               if (prefAction != null && prefAction.equals("OPEN"))
-                       return;
-
                if (menuGravity != null) {
                        gravity = Double.parseDouble(menuGravity);
                } else  {

-- 
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