Author: jfuerth
Date: Fri Oct 17 12:46:03 2008
New Revision: 2792

Modified:
   trunk/src/ca/sqlpower/architect/swingui/MultiDragTreeUI.java

Log:
Modified the toggle selection key on the UI of a DBTree so the command key is correctly used on a Mac and the ctrl key is used otherwise. Previously the ctrl key was being used for selecting multiple tree nodes on a Mac.

Modified: trunk/src/ca/sqlpower/architect/swingui/MultiDragTreeUI.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/MultiDragTreeUI.java        
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/MultiDragTreeUI.java Fri Oct 17 12:46:03 2008
@@ -22,6 +22,7 @@
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;

+import javax.swing.SwingUtilities;
 import javax.swing.plaf.basic.BasicTreeUI;

 import org.apache.log4j.Logger;
@@ -65,5 +66,18 @@
      */
        protected MouseListener createMouseListener() {
                return new MouseHandler();
+       }
+       
+       /**
+        * Provides command-click multiselection for Mac; passes through to
+        * BasicTreeUI on other platforms.
+        */
+       @Override
+       protected boolean isToggleSelectionEvent(MouseEvent event) {
+           if (System.getProperty("mrj.version") != null) {
+ return SwingUtilities.isLeftMouseButton(event) && event.isMetaDown();
+           } else {
+               return super.isToggleSelectionEvent(event);
+           }
        }
 }

Reply via email to