United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4833524 BasicTreeUI.isToggleSelectionEvent() does not properly handle popup triggers
JDK-4833524 : BasicTreeUI.isToggleSelectionEvent() does not properly handle popup triggers

Details
Type:
Enhancement
Submit Date:
2003-03-17
Status:
Closed
Updated Date:
2009-12-28
Project Name:
JDK
Resolved Date:
2009-12-28
Component:
client-libs
OS:
linux,windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.1,5.0
Fixed Versions:

Related Reports
Backport:
Duplicate:

Sub Tasks

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

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.

###@###.###


======================================================================
                                     
2004-09-25
EVALUATION

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

This bug is affecting many Mathworks customers and must be addressed. See bugid 6231828.
                                     
2006-12-19
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
                                     
2009-06-30
EVALUATION

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



Hardware and Software, Engineered to Work Together