Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 136219 - Make middle click go to declaration
Make middle click go to declaration
Product: editor
Classification: Unclassified
Component: Navigation
All All
: P4 (vote)
: 6.x
Assigned To: David Strupl
Depends on:
Blocks: 133913
  Show dependency treegraph
Reported: 2008-05-31 19:10 UTC by felix9x
Modified: 2010-03-11 04:52 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT

hg diff of (1.57 KB, patch)
2009-08-17 17:52 UTC, dynamite
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description felix9x 2008-05-31 19:10:11 UTC
Middle clicking does not do anything useful in the editor.
It should go to declaration of the item clicked on.
This would be really useful shortcut. 
IDEA does this and I use that feature constantly.
Comment 1 Vitezslav Stejskal 2008-06-06 11:42:34 UTC
Currently this is done by Ctrl + Left Mouse Click, but generally could be assigned to middle click as well. Ondro, would
you have any input on that?
Comment 2 Ondrej Langr 2008-06-06 12:09:42 UTC
I've no input. Sounds like a good thing to me. 
Comment 3 felix9x 2008-06-06 16:57:30 UTC
Did not know that Ctl-Left Click did it. Could somebody please add that to the Help screens. On the Java editor
shortcuts this was not mentioned.

Not sure if having multiple ways of doing the same thing is good. But I like the idea of being able to move around the
code with speed and not having to involve both hands.
Comment 4 Vladimir Voskresensky 2008-06-06 17:12:42 UTC
the most of Unix systems will insert a content of the clipboard by middle-click. And Unix users use middle click in
editor exactly for C&P. Don't you consider it as a problem?
Comment 5 felix9x 2008-06-06 17:27:40 UTC
Right about unix/linux. The keymap should really have this configurable.  This way you can have a linux profile or a mac
osx profile each with different variations.  Also the keymap should have a way to configure multiple shortcuts to the
same action.
Comment 6 Ondrej Langr 2008-06-09 12:16:09 UTC
I agree that we can't use middle click on unix systems. On Mac, it also has system function assigned, AFAIK.  

But since we are already using platform specific keybindings, I don't see this as a reason why we could not use it on
win. Configuration seems needless here. Obviously, unix users will want to keep using copy&paste, some win users don't
care (because they are used to ctrl+click) and some win users will use it.
Comment 7 Jan Becicka 2008-06-25 16:43:52 UTC
Ondro? Dusane? What do you think?
Comment 8 Ondrej Langr 2008-06-26 10:58:48 UTC
If we use mid-click for go to declaration on win (only), we'll make life a little bit easier for users coming from idea
and there's no downside to it. I would be for it, but I don't see it as high priority.
Comment 9 felix9x 2008-07-01 03:31:02 UTC
I started this thread so like to make a comment based on all the talking.

I agree its a nice little UI tweak for Windows. I like to see it make some todo list for future releases.
Comment 10 Jan Becicka 2008-11-06 14:17:10 UTC
Lets fix it for 7.0
Comment 11 Jiri Kovalsky 2009-03-30 14:51:33 UTC
Dusan Balek agreed that he would review and integrate a patch for this issue contributed by the NetFIX [1] team.

Comment 12 dynamite 2009-08-17 17:52:38 UTC
Created attachment 86340 [details]
hg diff of
Comment 13 dynamite 2009-08-17 18:03:45 UTC
I have attached a patch for this issue.

I have however noticed different behaviour in how it works between the XP desktop and Vista laptops at my disposal. 
Whilst a single click was required on XP, I needed two clicks when I tested on Vista.  The two clicks can be several
seconds apart so long as the mouse doesn't move.  It seems as though there is some event listener that is keeping track
of the mouse position and (on Vista only and not XP) consumes the event if the position has changed.  I was able to
determine that HyperlinkOperation always reports the clickCount as 1 even though I needed 2 clicks on Vista.

I have been unable to track down whether the first click gets swallowed on Vista.  Any ideas on what might be going on here?
Comment 14 Jiri Kovalsky 2009-08-17 20:17:31 UTC
Dusane, would you please be so kind and share your opinion with Daniel Sheppard (dynamite) on the matter?
Comment 15 Vitezslav Stejskal 2009-08-18 15:22:43 UTC
I don't think we have in Netbeans any special handling for mouse events under Vista OS. And I seriously doubt that there
is anything special for that in JDK. As for the patch I haven't tried it, but visually it looks ok. Neither Dusan nor I
have Windows readily available for testing, but I think we can test that the existing behavior is not broken on
linux/mac, integrate the patch and then let QE test the new functionality on Windows.
Comment 16 Vitezslav Stejskal 2009-08-18 15:43:32 UTC
On my mac hyperlinks seem to work as before - so I consider the patch ok. Thanks
Comment 17 Michel Graciano 2009-08-18 16:51:40 UTC
First of all, I tested the patch at Ubuntu and the behaviour is the same, what makes patch good for linux. For Windows XP 
it works as expected too. I have no Vista workstation here to test it.
BTW, the license header should be updated AFAIK and thanks Daniel for your patch.

Comment 18 dynamite 2010-03-09 17:34:41 UTC
Is there any reason why this patch hasn't been integrated?  It seems that everyone thinks that this is okay.
Comment 19 David Strupl 2010-03-10 04:26:28 UTC
I will integrate it.
Comment 20 David Strupl 2010-03-11 04:34:57 UTC
Comment 21 Jiri Kovalsky 2010-03-11 04:52:55 UTC
Thank you very much David and especially Daniel for contributing the patch!

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo