JDK-4833524 : BasicTreeUI.isToggleSelectionEvent() does not properly handle popup triggers
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1,5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,windows_xp
  • CPU: x86
  • Submitted: 2003-03-17
  • Updated: 2009-12-28
  • Resolved: 2009-12-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u18Fixed 7 b74Fixed
Related Reports
Duplicate :  
Description
Name: jk109818			Date: 03/17/2003


FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

FULL OS VERSION :
Linux vova 2.4.18-26.8.0 #1 Mon Feb 24 10:21:42 EST 2003 i686 i686 i386 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
The implementation of BasicTreeUI.isToggleSelectionEvent() doesn't take in account that the Ctrl+LeftMouseButton can be a popup trigger on some platforms. For example under Mac OS X it's true. As the result we have the following behaviour: let's suppose that user selected some node in the tree and press Ctrl+LeftMouseButton to show up the popup menu associated with the tree. This event causes clearing of the selecting item. As the result the action which works with the selected item (selection is empty now!!!) does nothing. Perhaps this sounds like exotic, but it's very serious problem for Mac OS X users (which work with IntelliJ IDEA, for example) in Metal Look And Feel. Metal is derived from BasicLookAndFeel therefore it has the same problem. I'd like to suggest to add the additional check to BasicTreeUI.isToggleSelectionMethod method:

  protected boolean isToggleSelectionEvent(MouseEvent event){
    return (SwingUtilities.isLeftMouseButton(event) &&event.isControlDown() && !event.isPopupTrigger());
  }



REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 182636) 
======================================================================

Comments
EVALUATION We should consult with guys from Apple about the best fix for this issue, I already sent the request
06-07-2009

EVALUATION In Mac OS tree or list items are selected with Meta key and popup menu is invoked with Ctrl+left mouse button So rather than checking event.isControlDown() in BasicTreeUI.isToggleSelectionEvent() we should check if Toolktit.getDefaultToolkit().getMenuShortcutKeyMask() is pressed
30-06-2009

EVALUATION This bug is affecting many Mathworks customers and must be addressed. See bugid 6231828.
19-12-2006

EVALUATION See also 6231828 which talks about the same problem with JTable.
19-09-2005

EVALUATION Name: apR10133 Date: 06/27/2003 The change suggested by submitter is reasonable for the popup functionality, but it will break the ability to do the multiple selections. ###@###.### ======================================================================
25-09-2004