Bug 105746 - [65cat] Default action in gutter
[65cat] Default action in gutter
Status: NEW
Product: editor
Classification: Unclassified
Component: Hints & Annotations
6.x
All All
: P3 with 2 votes (vote)
: 8.0
Assigned To: Svata Dedic
issues@editor
:
: 118444 120128 120132 121985 130455 139078 141456 142446 145204 164796 172671 187180 210103 210455 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-05 15:21 UTC by ehucka
Modified: 2013-08-23 12:40 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Click on error badge unexpectedly sets breakpoint (8.94 KB, image/png)
2012-04-11 15:10 UTC, ulfzibis
Details
Proposed API change. (18.02 KB, patch)
2012-06-05 11:32 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ehucka 2007-06-05 15:21:01 UTC
I think it should be possible to invoke default gutter action on a line by click
on gutter in cases when the gutter contains some other actions like overrides
method, javadoc hints etc.
Debugger can insert fields and methods breakpoints by gutter but if there is
ae.g. overrides method annotation on method definition line user cannot use it
and he/she must use popup menu. It is quite confusing, one feature blocks
another one here.
Is it possible to detect if the mouse click was on annotation icon or not and if
it was in some distance of the icon use the default action instead of the
annotation?
Comment 1 Vitezslav Stejskal 2007-06-08 04:31:45 UTC
We could do that, but I am not sure if it is going to be less confusing. Funny
enough, sometimes javadoc hints can't be triggered by clicking on them, all you
get is a method breakpoint. I can't reproduce it reliably though.

IMO, clicking an annotation icon should do what the annotation is meant to do.
People see the icon, know what it means and click it because they want to use
it. The fact that an empty gutter sets/removes a line breakpoint is a bit
different story. I think most of the confusion comes from the fact that
adding/removing breakpoints is done from the editor popup menu and not the
gutter popup menu. Editor bookmarks for example are available in the gutter
menu. We could have something similar for breakpoints too.
Comment 2 ehucka 2007-06-27 19:45:31 UTC
As I remember toggle line breakpoint was always default action for click on gutter. The question is if the 'privileged
position' of breakpoints will be kept in future or bookmarks and profiling points will be placed to the same level. 
Comment 3 ehucka 2007-10-10 22:19:49 UTC
*** Issue 118444 has been marked as a duplicate of this issue. ***
Comment 4 ehucka 2007-10-10 22:26:06 UTC
IMO the default action should be invoked after click on gutter free space next to an annotation icon. There is no reason
why the annotation icons should occupy so wide area - whole gutter line. Icons are usually sensitive only in rectangle
area defined by their images' width and height.
Comment 5 ehucka 2007-10-26 08:38:41 UTC
*** Issue 120128 has been marked as a duplicate of this issue. ***
Comment 6 Martin Entlicher 2007-10-26 09:43:14 UTC
*** Issue 120132 has been marked as a duplicate of this issue. ***
Comment 7 Martin Entlicher 2007-11-15 12:56:58 UTC
*** Issue 121985 has been marked as a duplicate of this issue. ***
Comment 8 Jan Lahoda 2008-03-19 09:34:32 UTC
*** Issue 130455 has been marked as a duplicate of this issue. ***
Comment 9 Jiri Prox 2008-04-11 00:42:03 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 10 Vitezslav Stejskal 2008-08-01 10:58:32 UTC
*** Issue 142446 has been marked as a duplicate of this issue. ***
Comment 11 Petr Dvorak 2008-08-04 15:36:49 UTC
*** Issue 139078 has been marked as a duplicate of this issue. ***
Comment 12 Peter Pis 2008-08-06 11:04:58 UTC
*** Issue 141456 has been marked as a duplicate of this issue. ***
Comment 13 Vitezslav Stejskal 2008-10-03 10:58:39 UTC
*** Issue 145204 has been marked as a duplicate of this issue. ***
Comment 14 ulfzibis 2008-10-07 13:37:49 UTC
Just to bring some attention on this issue.
There are plenty of dups, but no votes ? I will set the first.
Comment 15 Max Sauer 2008-11-13 13:31:21 UTC
This should be finally fixed for 7.0.
Comment 16 Vitezslav Stejskal 2009-05-11 12:07:46 UTC
*** Issue 164796 has been marked as a duplicate of this issue. ***
Comment 17 Max Sauer 2009-09-21 13:12:48 UTC
*** Issue 172671 has been marked as a duplicate of this issue. ***
Comment 18 Marian Mirilovic 2009-09-21 13:25:16 UTC
wow ... 10 duplicates so far
Comment 19 Martin Entlicher 2010-06-04 08:46:41 UTC
*** Bug 187180 has been marked as a duplicate of this bug. ***
Comment 20 Jan Lahoda 2012-04-11 06:09:38 UTC
*** Bug 210455 has been marked as a duplicate of this bug. ***
Comment 21 tbrunhoff 2012-04-11 14:35:49 UTC
It seems unfortunate that this has been seen by several people as a problem for the past five years. This problem is still present in 7.2 dev. My comment below relates to c++, but Alex Simon points out that the same holds for java.
------------------------------------------
Whenever I search for something, the editor places a light bulb in the left
margin so that I can easily add an editor-fold comment. When writing code, I
can easily ignore this. However, when debugging, I most often search for
variables/methods/etc in order to place a breakpoint.... and its not possible
to set a breakpoint on any line that already has a light bulb in it. See
attached screenshot.

You can work around this by clicking on another line first or hitting the hot
key for setting a breakpoint, but this seems pretty irritating, because the
editor is suggesting that this is something I always want to do when I search,
and this is never something I do.

I think there are a couple of very good solutions that preserve this feature
for its fans:
- In java, there are usually multiple options that pop up with alt-enter.
Perhaps this should include an option for setting a breakpoint.
- Better, IMO, would be to allow the user to click in the column but provide a
way that a breakpoint can still be set.
- Even better, IMO, is a UI option for turning off this feature.

I note that, while debugging, the light-bulb does not show up for every search
target. Stop debugging and the light bulbs show up again.
Comment 22 ulfzibis 2012-04-11 15:10:09 UTC
Created attachment 118142 [details]
Click on error badge unexpectedly sets breakpoint

(In reply to comment #21)
> However, when debugging, I most often search for variables/methods/etc
> in order to place a breakpoint.... and its not possible to set a
> breakpoint on any line that already has a light bulb in it.

I often have the contrary problem. I see the red compile error badge, click on it, expecting a solution suggestion, but have set a breakpoint.
Comment 23 Petr Somol 2012-05-17 16:07:14 UTC
The current gutter annotation behavior is inconsistent and in some ways counter-intuitive as a whole. The gutter area to the left of one line effectively has a separate left and right part. In some contexts these parts act as one (e.g., with just the single error icon displayed on the right, clicking either on the right [the error icon itself] or left is interpreted as breakpoint toggle what rarely makes sense in this case), in others the two parts react differently (when the "multiple annotation" black arrow is shown and one of the icons is displayed to the left of it, then clicking the arrow has different meaning than clicking the icon). Generally there indeed is enough space in the gutter to distinguish the click on the left from the click on the right, or more precisely the click on a single icon from the click in the area left from it. Therefore, it is possible to consider the following proposal.

-------------------
To prevent user confusion, and to make handling of gutter annotation icons more intuitive and less prone to behavior perceived as unexpected by users, I suggest the following changes:

1) a click on an icon should never trigger an action unrelated to that icon

2) only the click to free area is interpreted as default (breakpoint toggle), i.e., a breakpoint is set only on click anywhere in a gutter area without any icons, or on click in the left empty space if there is just one icon on the right (including the black arrow alone on the right, see below). Clicking an existing breakpoint toggles it for free space (even if there remain multiple icons assigned to this line, in such case this leads to black arrow displayed alone on the right, see below). Note that if there exists a breakpoint and is the only icon in the gutter, then a click in the free area on the left from it is ignored.

3) if there are multiple annotations in the gutter as indicated by the black arrow on the right and one of the icons on the left, then clicking the arrow cycles through all relevant icons including one more previously unsupported state: no icon = free area. This state would enable setting a breakpoint if there is not one yet. Note that free area can be reached using the black arrow ONLY if there exists no breakpoint for this line (or as result of removing an existing breakpoint, e.g. by toggle).
-------------------

Advantages of the above proposal:
a) clarity - users always know that a click on an icon is related to that particular icon. Note that the proposal does not restrict the ability to set breakpoints in any way - on lines with a single icon this is achieved through a click to the left of the existing icon, in case of multiple icons this involves cycling for free area using black arrow first, but this still is more convenient and discoverable than what is necessary now - to think where and when to click as there is always an icon displayed while some of them lead to breakpoint toggle while some do not.
b) this opens up possibilities for future adding of menus to any icon that currently does not have one, if needed. One area that could benefit immediately is, e.g., bookmarks, where a click on the bookmark would make it possible to rename the bookmark etc.


Remarks:
- toggle-delete of nondefault bookmarks (=bookmarks customized by user in properties window) should be undoable or should be made less harmful in some other way - currently the accidental deletion of complicatedly configured bookmark is all too possible and annoying
- Ctrl-Shift + click in gutter regardless its contents would set/toggle a bookmark. Note that customized bookmarks (with assigned name and/or with shortcut) should be prevented from accidental delete in the same way as breakpoints
- method breakpoint Properties dialog permits to check All Methods For Given Class. This creates an entry in the Bookmarks window, but it is not indicated in the gutter in any way - not even is the checkbox checked on next opening of the same dialog. Not indicating this in the gutter is OK (it would be a unintended visual mess), but it should be reflected somehow at least in context menu; e.g., whenever the user right-clicks the gutter belonging to line with a method, the menu should display entry Method Brakpoint->All Methods For Given Class Enabled or so. The similar problem may apply to any other bookmark type that just appears in the Bookmarks window and not anywhere in context menus reachable from gutter
- the right-click menu should generally provide more exact control over Breakpoint and Bookmark specific functionality. I would prefer the respective submenus to be extended by the following items: Bookmark->Add Bookmark (item disabled if bookmark exists for this line), Bookmark->Remove Bookmark (item disabled if no bookmark exists for this line), Breakpoint->Add Breakpoint (item disabled if breakpoint exists for this line), Breakpoint->Remove Breakpoint (item disabled if no breakpoint exists for this line). For better clarity also rename Bookmark->Next Bookmark to Bookmark->Go To Next Bookmark and Bookmark->Previous Bookmark to Bookmark->Go To Previous Bookmark

Comments, thoughts, have I overlooked something ?
Comment 24 Jan Lahoda 2012-06-05 11:32:49 UTC
Created attachment 120367 [details]
Proposed API change.
Comment 25 Jan Lahoda 2012-06-05 11:35:35 UTC
I have attached a patch that implements the following from Petr's proposal:
1. clicking on an annotation icon will only invoke an action associated with that annotation (see below), if any. The action may choose to delegate to other action (see below). The intent is to ensure that clicking on an annotation will never do anything not related to the action.
2. when clicking on the free space next to the annotation (or to the free space if there is no annotation), the default action will be invoked, which is expected to set a breakpoint.
3. clicking on the free space when a breakpoint exists on the line will not invoke the debugger's default action, i.e. it will do nothing. It is necessary to click on the breakpoint to unset it. (Petr, that is what you proposed, right?)

This all is based on three new values that can be set to the actions registered in "Editors/.../GlyphGutterActions":
-"default-action": if true, this action will be invoked when the free space is clicked
-"default-action-excluded-annotation-types": an array containing annotation types. When any of the annotations on the current line has any of these type, this action will not be invoked when the free space is clicked. (See below for combined annotations unrolling.)
-"supported-annotation-types": an array containing annotation types. When an annotation is clicked, the first action that contains its type in the supported-annotation-types attribute is invoked.

Notes:
-I am not sure what is the compatibility level of the "Editors/GlyphGutterActions" API - I would expect friend as is the rest of the legacy editor APIs? Currently the patch contains a certain level of backward compatibility: if there is no fitting action under this new scheme, the first legacy action is invoked. If this is kept, it is only for modules outside the std. distro, all actions in the std. distro must be updated to fulfill the UI requirements.
-the actions under the new scheme do not need to delegate to "next" action when they have nothing to do (because they are always called on "their own" annotations in the new scheme). But I kept the delegation for now, to help the backwards compatibility. Should probably be reconsidered to prevent unintended delegation.
-the "supported-annotation-types" and "default-action-excluded-annotation-types" do not need to contain any combination annotation types - these are unrolled automatically. Only the "base" annotation types need to be specified.

Please review, thanks.
Comment 26 Jan Lahoda 2012-06-13 09:10:29 UTC
I have integrated the above change:
http://hg.netbeans.org/main-silver/rev/6cf04d8eb9e4

I think this resolves the most pressing needs.
Comment 27 Jan Lahoda 2012-07-12 13:51:02 UTC
*** Bug 210103 has been marked as a duplicate of this bug. ***
Comment 28 markiewb 2012-10-02 22:26:56 UTC
(In reply to comment #23)
> if there remain multiple icons assigned to this line, in such case this leads to black arrow displayed alone on the right

Only a small enhancement: The tooltip of the black arrow should also display all the name/descriptions of the actions/annotations/breakpoints on this line.
Comment 29 Petr Somol 2012-10-03 11:16:54 UTC
(In reply to comment #28)
> Only a small enhancement: The tooltip of the black arrow should also display
> all the name/descriptions of the actions/annotations/breakpoints on this line.

I endorse this.


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